wininet: Fix incrementing lpdwIndex in HTTP_HttpQueryInfoW

Rotem Zach rotemz at gmail.com
Mon Sep 8 13:24:25 CDT 2008


HttpQueryInfo should only advance lpdwIndex when the HTTP_QUERY_FLAG_REQUEST_HEADERS flag is set.
Also added conformance tests.
---
 dlls/wininet/http.c       |    4 +++-
 dlls/wininet/tests/http.c |   17 +++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index da8af45..d5c0e9d 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2322,8 +2322,10 @@ static BOOL WINAPI HTTP_HttpQueryInfoW( LPWININETHTTPREQW lpwhr, DWORD dwInfoLev
         return bSuccess;
     }
 
-    if (lpdwIndex)
+    if (lpdwIndex && (dwInfoLevel & HTTP_QUERY_FLAG_REQUEST_HEADERS))
+    {
         (*lpdwIndex)++;
+    }
 
     /* coalesce value to requested type */
     if (dwInfoLevel & HTTP_QUERY_FLAG_NUMBER)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 1c52f27..ac7a76f 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1601,6 +1601,7 @@ static void test_proxy_indirect(int port)
     HINTERNET hi, hc, hr;
     DWORD r, sz, val;
     char buffer[0x40];
+    INT index;
 
     hi = InternetOpen(NULL, 0, NULL, NULL, 0);
     ok(hi != NULL, "open failed\n");
@@ -1619,13 +1620,25 @@ static void test_proxy_indirect(int port)
     ok(r, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "Basic realm=\"placebo\""), "proxy auth info wrong\n");
 
+    index = 0;
     sz = sizeof buffer;
-    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, NULL);
+    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, &index);
     ok(r, "HttpQueryInfo failed\n");
     ok(!strcmp(buffer, "407"), "proxy code wrong\n");
 
+    sz = sizeof buffer;
+    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE, buffer, &sz, &index);
+    ok(r, "HttpQueryInfo failed\n");
+    ok(!strcmp(buffer, "407"), "proxy code wrong\n");
+    
+    index = 0;
+    sz = sizeof val;
+    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &val, &sz, &index);
+    ok(r, "HttpQueryInfo failed\n");
+    ok(val == 407, "proxy code wrong\n");
+    
     sz = sizeof val;
-    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &val, &sz, NULL);
+    r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &val, &sz, &index);
     ok(r, "HttpQueryInfo failed\n");
     ok(val == 407, "proxy code wrong\n");
 
-- 
1.6.0.1


--------------010804060702070501090905--



More information about the wine-patches mailing list