From 842b342dc59cca265feeef84cdb157d8c291549d Mon Sep 17 00:00:00 2001 From: Justin <52604018+hiimjustin000@users.noreply.github.com> Date: Fri, 1 Nov 2024 18:52:50 +0000 Subject: [PATCH] yeah... --- loader/include/Geode/utils/web.hpp | 9 +++++++++ loader/src/utils/web.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/loader/include/Geode/utils/web.hpp b/loader/include/Geode/utils/web.hpp index 6f6f2a25..ad06e247 100644 --- a/loader/include/Geode/utils/web.hpp +++ b/loader/include/Geode/utils/web.hpp @@ -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. diff --git a/loader/src/utils/web.cpp b/loader/src/utils/web.cpp index fe3dc7c1..c7f00e04 100644 --- a/loader/src/utils/web.cpp +++ b/loader/src/utils/web.cpp @@ -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;