wininet[3/3]: a small test for HttpQueryInfoA

Mikolaj Zalewski mikolaj at zalewski.pl
Wed Aug 15 19:03:28 CDT 2007


A small test I wrote. It passes on our wininet but might still be 
usefull to prevent regressions.
-------------- next part --------------
>From 0b2fd5f94e148cb97a0f4ab8e3327a9f801e28e2 Mon Sep 17 00:00:00 2001
From: Mikolaj Zalewski <mikolajz at mikolajz.smo.corp.google.com>
Date: Wed, 15 Aug 2007 16:56:43 -0700
Subject: [PATCH] wininet: a small test for HttpQueryInfoA
---
 dlls/wininet/tests/http.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index d16d93d..f76d88d 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -990,6 +990,13 @@ static void HttpHeaders_test(void)
     ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
                 buffer,&len,&index)==0,"Second Index Should Not Exist\n");
 
+    index = 0;
+    len = 5; /* could store the string but not the NULL terminator */
+    strcpy(buffer,"Warning");
+    ok(HttpQueryInfo(hRequest,HTTP_QUERY_CUSTOM|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+                buffer,&len,&index) == FALSE,"Query succeeded on a too small buffer\n");
+    ok(strcmp(buffer,"Warning")==0, "incorrect string was returned(%s)\n",buffer); /* string not touched */
+    ok(len == 6, "Invalid length (exp. 6, got %d)\n", len); /* unlike success, the length includes the NULL-terminator */
 
     /* a call with NULL will fail but will return the length */
     index = 0;
-- 
1.4.1



More information about the wine-patches mailing list