From: Rémi Bernon rbernon@codeweavers.com
--- dlls/wininet/http.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 92417714fac..7eed106b17c 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1915,6 +1915,21 @@ static void http_release_netconn(http_request_t *req, BOOL reuse) INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); }
+static BOOL has_keep_alive(const WCHAR *str) +{ + const WCHAR *next; + + for (; *str; str = next + wcsspn(next, L" ,")) + { + next = str + wcscspn(str, L" ,"); + if (next - str != 10) continue; + if (wcsnicmp(str, L"Keep-Alive", 10)) continue; + return TRUE; + } + + return FALSE; +} + static BOOL HTTP_KeepAlive(http_request_t *request) { WCHAR szVersion[10]; @@ -1934,7 +1949,7 @@ static BOOL HTTP_KeepAlive(http_request_t *request) if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_PROXY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS || HTTP_HttpQueryInfoW(request, HTTP_QUERY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS) { - keepalive = !wcsicmp(szConnectionResponse, L"Keep-Alive"); + keepalive = has_keep_alive(szConnectionResponse); }
return keepalive; @@ -4862,9 +4877,9 @@ static void http_process_keep_alive(http_request_t *req) EnterCriticalSection( &req->headers_section );
if ((index = HTTP_GetCustomHeaderIndex(req, L"Connection", 0, FALSE)) != -1) - req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, L"Keep-Alive"); + req->netconn->keep_alive = has_keep_alive(req->custHeaders[index].lpszValue); else if ((index = HTTP_GetCustomHeaderIndex(req, L"Proxy-Connection", 0, FALSE)) != -1) - req->netconn->keep_alive = !wcsicmp(req->custHeaders[index].lpszValue, L"Keep-Alive"); + req->netconn->keep_alive = has_keep_alive(req->custHeaders[index].lpszValue); else req->netconn->keep_alive = !wcsicmp(req->version, L"HTTP/1.1");