Fix http headers bug when using proxy server

This commit is contained in:
Bartosz Wieczorek 2025-06-05 13:04:28 +02:00
parent d423ac93e0
commit 4d456c56a8

View File

@ -202,16 +202,21 @@ namespace details {
s = s.substr(start, end - start); s = s.substr(start, end - start);
} }
} }
template < typename Headers > template < typename Headers >
inline void headers(std::string_view data, Headers & headers) { inline void headers(std::string_view data, Headers & headers) {
memory::Monotonic_4k_Resource stackResource; memory::Monotonic_4k_Resource stackResource;
std::pmr::string tmp{&stackResource}; std::pmr::string tmp{&stackResource};
tmp.reserve(300);
std::istringstream resp{}; std::istringstream resp{};
resp.rdbuf()->pubsetbuf(const_cast< char * >(data.data()), data.size()); resp.rdbuf()->pubsetbuf(const_cast< char * >(data.data()), data.size());
while(std::getline(resp, tmp) && !(trim(tmp).empty())) { while(std::getline(resp, tmp)) {
if(tmp == "\r")
continue;
if(trim(tmp).empty())
break;
auto line = std::string_view(tmp); auto line = std::string_view(tmp);
auto index = tmp.find(':', 0); auto index = tmp.find(':', 0);
if(index != std::string::npos) { if(index != std::string::npos) {