mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 11:05:08 -05:00
Compare commits
4 commits
d9e90111e7
...
2057da10f2
Author | SHA1 | Date | |
---|---|---|---|
|
2057da10f2 | ||
|
544689c945 | ||
|
44a70d391b | ||
|
7566292157 |
3 changed files with 19 additions and 1 deletions
|
@ -203,6 +203,15 @@ namespace geode::utils::web {
|
|||
*/
|
||||
WebRequest& followRedirects(bool enabled);
|
||||
|
||||
/**
|
||||
* Enables or disables ignoring the content length header.
|
||||
* The default is false.
|
||||
*
|
||||
* @param enabled
|
||||
* @return WebRequest&
|
||||
*/
|
||||
WebRequest& ignoreContentLength(bool enabled);
|
||||
|
||||
/**
|
||||
* Sets the Certificate Authority (CA) bundle content.
|
||||
* Defaults to not sending a CA bundle.
|
||||
|
|
|
@ -47,7 +47,7 @@ const char* geode::getCommonFilterAllowedChars(CommonFilter filter) {
|
|||
case CommonFilter::Float: return "-.0123456789";
|
||||
case CommonFilter::ID: return "abcdefghijklmnopqrstuvwxyz0123456789-_.";
|
||||
case CommonFilter::Name: return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ ";
|
||||
case CommonFilter::Any: return "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-+/\\&$%^~*\'\"{}()[]<>=!?@,;.:|• ";
|
||||
case CommonFilter::Any: return "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#_-+/\\&$%^~*\'\"{}()[]<>=!?@,;.:|• ";
|
||||
case CommonFilter::Hex: return "0123456789abcdefABCDEF";
|
||||
case CommonFilter::Base64Normal: return "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/=";
|
||||
case CommonFilter::Base64URL: return "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_=";
|
||||
|
|
|
@ -202,6 +202,7 @@ public:
|
|||
bool m_certVerification = true;
|
||||
bool m_transferBody = true;
|
||||
bool m_followRedirects = true;
|
||||
bool m_ignoreContentLength = false;
|
||||
std::string m_CABundleContent;
|
||||
ProxyOpts m_proxyOpts = {};
|
||||
HttpVersion m_httpVersion = HttpVersion::DEFAULT;
|
||||
|
@ -382,6 +383,9 @@ WebTask WebRequest::send(std::string_view method, std::string_view url) {
|
|||
// Follow request through 3xx responses
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, impl->m_followRedirects ? 1L : 0L);
|
||||
|
||||
// Ignore content length
|
||||
curl_easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, impl->m_ignoreContentLength ? 1L : 0L);
|
||||
|
||||
// Track progress
|
||||
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
|
||||
|
||||
|
@ -556,6 +560,11 @@ WebRequest& WebRequest::followRedirects(bool enabled) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::ignoreContentLength(bool enabled) {
|
||||
m_impl->m_ignoreContentLength = enabled;
|
||||
return *this;
|
||||
}
|
||||
|
||||
WebRequest& WebRequest::CABundleContent(std::string_view content) {
|
||||
m_impl->m_CABundleContent = content;
|
||||
return *this;
|
||||
|
|
Loading…
Reference in a new issue