wininet: Handle empty expires for cookie setting.
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
305da71c7d
commit
c06e00ee6a
|
@ -977,7 +977,7 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D
|
||||||
|
|
||||||
substr_skip(&data, len);
|
substr_skip(&data, len);
|
||||||
|
|
||||||
if(end_ptr - data.str < ARRAY_SIZE(buf)-1) {
|
if(end_ptr > data.str && (end_ptr - data.str < ARRAY_SIZE(buf) - 1)) {
|
||||||
memcpy(buf, data.str, data.len*sizeof(WCHAR));
|
memcpy(buf, data.str, data.len*sizeof(WCHAR));
|
||||||
buf[data.len] = 0;
|
buf[data.len] = 0;
|
||||||
|
|
||||||
|
|
|
@ -510,7 +510,7 @@ static void test_complicated_cookie(void)
|
||||||
len = 1024;
|
len = 1024;
|
||||||
ret = InternetGetCookieA("http://testing.example.com/bar/foo", NULL, buffer, &len);
|
ret = InternetGetCookieA("http://testing.example.com/bar/foo", NULL, buffer, &len);
|
||||||
ok(ret == TRUE,"InternetGetCookie failed\n");
|
ok(ret == TRUE,"InternetGetCookie failed\n");
|
||||||
ok(len == 24, "len = %u\n", 24);
|
ok(len == 24, "len = %u\n", len);
|
||||||
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
|
ok(strstr(buffer,"A=B")!=NULL,"A=B missing\n");
|
||||||
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
|
ok(strstr(buffer,"C=D")!=NULL,"C=D missing\n");
|
||||||
ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
|
ok(strstr(buffer,"E=F")!=NULL,"E=F missing\n");
|
||||||
|
@ -524,16 +524,26 @@ static void test_complicated_cookie(void)
|
||||||
len = 1024;
|
len = 1024;
|
||||||
ret = InternetGetCookieA("http://testing.example.com/bar/foo", "A", buffer, &len);
|
ret = InternetGetCookieA("http://testing.example.com/bar/foo", "A", buffer, &len);
|
||||||
ok(ret == TRUE,"InternetGetCookie failed\n");
|
ok(ret == TRUE,"InternetGetCookie failed\n");
|
||||||
ok(len == 24, "len = %u\n", 24);
|
ok(len == 24, "len = %u\n", len);
|
||||||
|
|
||||||
/* test persistent cookies */
|
/* test persistent cookies */
|
||||||
ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B; expires=Fri, 01-Jan-2038 00:00:00 GMT");
|
ret = InternetSetCookieA("http://testing.example.com", NULL, "A=B; expires=Fri, 01-Jan-2038 00:00:00 GMT");
|
||||||
ok(ret, "InternetSetCookie failed with error %d\n", GetLastError());
|
ok(ret, "InternetSetCookie failed with error %d\n", GetLastError());
|
||||||
|
|
||||||
|
/* test invalid expires parameter */
|
||||||
|
ret = InternetSetCookieA("http://testing.example.com", NULL, "Q=R; expires=");
|
||||||
|
ok(ret, "InternetSetCookie failed %#x.\n", GetLastError());
|
||||||
|
len = 1024;
|
||||||
|
memset(buffer, 0xac, sizeof(buffer));
|
||||||
|
ret = InternetGetCookieA("http://testing.example.com/", NULL, buffer, &len);
|
||||||
|
ok(ret, "InternetGetCookie failed %#x.\n", GetLastError());
|
||||||
|
ok(len == 29, "got len %u.\n", len);
|
||||||
|
ok(!!strstr(buffer, "Q=R"), "cookie is not present.\n");
|
||||||
|
|
||||||
len = sizeof(buffer);
|
len = sizeof(buffer);
|
||||||
ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
|
ret = InternetGetCookieA("http://testing.example.com/foobar", NULL, buffer, &len);
|
||||||
ok(ret, "got error %u\n", GetLastError());
|
ok(ret, "got error %#x\n", GetLastError());
|
||||||
ok(len == 24, "got len %u\n", len);
|
ok(len == 29, "got len %u\n", len);
|
||||||
ok(!!strstr(buffer, "A=B"), "cookie is not present\n");
|
ok(!!strstr(buffer, "A=B"), "cookie is not present\n");
|
||||||
|
|
||||||
/* remove persistent cookie */
|
/* remove persistent cookie */
|
||||||
|
|
Loading…
Reference in New Issue