Jacek Caban : wininet: Added test of cookies with long URL.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 17 11:19:37 CDT 2016


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May 16 22:46:08 2016 +0200

wininet: Added test of cookies with long URL.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wininet/tests/internet.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 37490c2..d762768 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -614,6 +614,7 @@ static void test_cookie_attrs(void)
 
 static void test_cookie_url(void)
 {
+    char long_url[5000] = "http://long.url.test.com/", *p;
     WCHAR bufw[512];
     char buf[512];
     DWORD len;
@@ -640,6 +641,23 @@ static void test_cookie_url(void)
     res = pInternetGetCookieExW(about_blankW, NULL, bufw, &len, 0, NULL);
     ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
        "InternetGetCookeExW failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
+
+    p = long_url + strlen(long_url);
+    memset(p, 'x', long_url+sizeof(long_url)-p);
+    p += (long_url+sizeof(long_url)-p) - 3;
+    p[0] = '/';
+    p[2] = 0;
+    res = InternetSetCookieA(long_url, NULL, "A=B");
+    ok(res, "InternetSetCookieA failed: %u\n", GetLastError());
+
+    len = sizeof(buf);
+    res = InternetGetCookieA(long_url, NULL, buf, &len);
+    ok(res, "InternetGetCookieA failed: %u\n", GetLastError());
+    ok(!strcmp(buf, "A=B"), "buf = %s\n", buf);
+
+    len = sizeof(buf);
+    res = InternetGetCookieA("http://long.url.test.com/", NULL, buf, &len);
+    ok(!res && GetLastError() == ERROR_NO_MORE_ITEMS, "InternetGetCookieA failed: %u\n", GetLastError());
 }
 
 static void test_null(void)




More information about the wine-cvs mailing list