Compare commits

...

4 commits

Author SHA1 Message Date
Justin
2057da10f2
Merge 05fe8d22b5 into 544689c945 2024-11-07 13:06:47 -05:00
The Bearodactyl
544689c945
add hashtag symbol to CommonFilter::Any (#1131)
Some checks failed
Build Binaries / Build Windows (push) Has been cancelled
Build Binaries / Build macOS (push) Has been cancelled
Build Binaries / Build Android (64-bit) (push) Has been cancelled
Build Binaries / Build Android (32-bit) (push) Has been cancelled
Build Binaries / Publish (push) Has been cancelled
2024-11-07 20:27:41 +03:00
fig
44a70d391b
Merge pull request #1126 from hiimjustin000/ignore-length
WebRequest::ignoreContentLength
2024-11-07 11:40:58 -05:00
Justin
7566292157 yeah... 2024-11-01 18:52:50 +00:00
3 changed files with 19 additions and 1 deletions

View file

@ -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.

View file

@ -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-_=";

View file

@ -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;