From 59a217847cb6a173653f7923ba0aa711354b96a2 Mon Sep 17 00:00:00 2001 From: Eric van Beurden Date: Thu, 4 Jun 2009 10:52:59 -0400 Subject: [PATCH] wininet: Rearrange invalid header checks. --- dlls/wininet/http.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index c6873ae86ea..1bba8d97f17 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -4235,33 +4235,28 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr, BOOL clear) TRACE("got line %s, now interpreting\n", debugstr_a(bufferA)); if (!bufferA[0]) break; - if (!strchr(bufferA, ':')) - { - WARN("invalid header\n"); - continue; - } MultiByteToWideChar( CP_ACP, 0, bufferA, buflen, buffer, MAX_REPLY_LEN ); - while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) - cchMaxRawHeaders *= 2; - temp = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); - if (temp == NULL) goto lend; - lpszRawHeaders = temp; - memcpy(lpszRawHeaders+cchRawHeaders, buffer, (buflen-1)*sizeof(WCHAR)); - cchRawHeaders += (buflen-1); - memcpy(lpszRawHeaders+cchRawHeaders, szCrLf, sizeof(szCrLf)); - cchRawHeaders += sizeof(szCrLf)/sizeof(szCrLf[0])-1; - lpszRawHeaders[cchRawHeaders] = '\0'; - pFieldAndValue = HTTP_InterpretHttpHeader(buffer); - if (!pFieldAndValue) - break; + if (pFieldAndValue) + { + while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) + cchMaxRawHeaders *= 2; + temp = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); + if (temp == NULL) goto lend; + lpszRawHeaders = temp; + memcpy(lpszRawHeaders+cchRawHeaders, buffer, (buflen-1)*sizeof(WCHAR)); + cchRawHeaders += (buflen-1); + memcpy(lpszRawHeaders+cchRawHeaders, szCrLf, sizeof(szCrLf)); + cchRawHeaders += sizeof(szCrLf)/sizeof(szCrLf[0])-1; + lpszRawHeaders[cchRawHeaders] = '\0'; - HTTP_ProcessHeader(lpwhr, pFieldAndValue[0], pFieldAndValue[1], - HTTP_ADDREQ_FLAG_ADD ); + HTTP_ProcessHeader(lpwhr, pFieldAndValue[0], pFieldAndValue[1], + HTTP_ADDREQ_FLAG_ADD ); - HTTP_FreeTokens(pFieldAndValue); - } + HTTP_FreeTokens(pFieldAndValue); + } + } else { cbreaks++;