lib/curl/Request: move code to IsResponseBoundaryHeader()

This commit is contained in:
Max Kellermann 2017-03-10 16:24:30 +01:00
parent 1b6666fa39
commit 190d525099

View File

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