diff --git a/src/lib/curl/Request.cxx b/src/lib/curl/Request.cxx index 3b619dacf..b0e3cfca9 100644 --- a/src/lib/curl/Request.cxx +++ b/src/lib/curl/Request.cxx @@ -168,13 +168,20 @@ CurlRequest::Done(CURLcode result) } } +gcc_pure +static bool +IsResponseBoundaryHeader(StringView s) +{ + return s.size > 5 && memcmp(s.data, "HTTP/", 5) == 0; +} + inline void CurlRequest::HeaderFunction(StringView s) { if (state > State::HEADERS) return; - if (s.size > 5 && memcmp(s.data, "HTTP/", 5) == 0) { + if (IsResponseBoundaryHeader(s)) { /* this is the boundary to a new response, for example after a redirect */ headers.clear();