From 190d525099ac3ac6b983c5d3c946ef98614fe1cf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 10 Mar 2017 16:24:30 +0100 Subject: [PATCH] lib/curl/Request: move code to IsResponseBoundaryHeader() --- src/lib/curl/Request.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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();