Paul TBBle Hampson : wininet: HTTP_HttpAddRequestHeadersW should ignore 0-length headers.

Alexandre Julliard julliard at winehq.org
Mon Apr 27 08:04:07 CDT 2009


Module: wine
Branch: master
Commit: 4d57ee3409222d6705793572df8073199e30fe7f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4d57ee3409222d6705793572df8073199e30fe7f

Author: Paul TBBle Hampson <Paul.Hampson at Pobox.com>
Date:   Sat Apr 25 02:31:06 2009 +1000

wininet: HTTP_HttpAddRequestHeadersW should ignore 0-length headers.

---

 dlls/wininet/http.c       |    7 +++++++
 dlls/wininet/tests/http.c |    2 --
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 3bda535..ac0b88f 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -610,6 +610,13 @@ static BOOL HTTP_HttpAddRequestHeadersW(LPWININETHTTPREQW lpwhr,
             lpszEnd += 2; /* Jump over \r\n */
         }
         TRACE("interpreting header %s\n", debugstr_w(lpszStart));
+        if (*lpszStart == '\0')
+        {
+            /* Skip 0-length headers */
+            lpszStart = lpszEnd;
+            bSuccess = TRUE;
+            continue;
+        }
         pFieldAndValue = HTTP_InterpretHttpHeader(lpszStart);
         if (pFieldAndValue)
         {
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 79b5683..e3c33bd 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1275,7 +1275,6 @@ static void HttpHeaders_test(void)
     ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index)==0,"Third Header Should Not Exist\n");
 
     /* Ensure that blank headers are ignored and don't cause a failure */
-    todo_wine{
     ok(HttpAddRequestHeaders(hRequest,"\r\nBlankTest:value\r\n\r\n",-1, HTTP_ADDREQ_FLAG_ADD_IF_NEW), "Failed to add header with blank entries in list\n");
 
     index = 0;
@@ -1284,7 +1283,6 @@ static void HttpHeaders_test(void)
     ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer,&len,&index),"Unable to query header\n");
     ok(index == 1, "Index was not incremented\n");
     ok(strcmp(buffer,"value")==0, "incorrect string was returned(%s)\n",buffer);
-    }
 
     ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
 done:




More information about the wine-cvs mailing list