37#define _SECURITY_FLAG_CERT_REV_FAILED 0x00800000
38#define _SECURITY_FLAG_CERT_INVALID_CA 0x01000000
39#define _SECURITY_FLAG_CERT_INVALID_CN 0x02000000
40#define _SECURITY_FLAG_CERT_INVALID_DATE 0x04000000
42#define TEST_URL "http://test.winehq.org/tests/hello.html"
49#define SET_EXPECT2(status, num) \
52#define SET_EXPECT(status) \
53 SET_EXPECT2(status, 1)
55#define SET_OPTIONAL2(status, num) \
56 optional[status] = num
58#define SET_OPTIONAL(status) \
59 SET_OPTIONAL2(status, 1)
63#define SET_WINE_ALLOW2(status, num) \
64 wine_allow[status] = num
66#define SET_WINE_ALLOW(status) \
67 SET_WINE_ALLOW2(status, 1)
69#define CHECK_EXPECT(status) \
71 if (!expect[status] && !optional[status] && wine_allow[status]) \
73 todo_wine ok(expect[status], "unexpected status %ld (%s)\n", status, \
74 status < MAX_INTERNET_STATUS && status_string[status] ? \
75 status_string[status] : "unknown"); \
76 wine_allow[status]--; \
80 ok(expect[status] || optional[status], "unexpected status %ld (%s)\n", status, \
81 status < MAX_INTERNET_STATUS && status_string[status] ? \
82 status_string[status] : "unknown"); \
83 if (expect[status]) expect[status]--; \
84 else if(optional[status]) optional[status]--; \
91#define CLEAR_NOTIFIED(status) \
92 expect[status] = optional[status] = wine_allow[status] = notified[status] = 0;
94#define CHECK_NOTIFIED2(status, num) \
96 ok(notified[status] + optional[status] == (num), \
97 "expected status %d (%s) %d times, received %d times\n", \
98 status, status < MAX_INTERNET_STATUS && status_string[status] ? \
99 status_string[status] : "unknown", (num), notified[status]); \
100 CLEAR_NOTIFIED(status); \
103#define CHECK_NOTIFIED(status) \
104 CHECK_NOTIFIED2(status, 1)
106#define CHECK_NOT_NOTIFIED(status) \
107 CHECK_NOTIFIED2(status, 0)
109#define MAX_INTERNET_STATUS (INTERNET_STATUS_COOKIE_HISTORY+1)
118#define TESTF_REDIRECT 0x01
119#define TESTF_COMPRESSED 0x02
120#define TESTF_CHUNKED 0x04
135 "http://test.winehq.org/tests/data.php",
136 "http://test.winehq.org/tests/data.php",
143 "http://test.winehq.org/tests/redirect",
144 "http://test.winehq.org/tests/hello.html",
151 "http://test.winehq.org/tests/gzip.php",
152 "http://test.winehq.org/tests/gzip.php",
155 "Accept-Encoding: gzip, deflate",
159 "http://test.winehq.org/tests/post.php",
160 "http://test.winehq.org/tests/post.php",
163 "Content-Type: application/x-www-form-urlencoded",
186 if (pGetThreadUILanguage)
188 if (pGetUserDefaultUILanguage)
247#define test_status_code(a,b) _test_status_code(__LINE__,a,b, FALSE)
248#define test_status_code_todo(a,b) _test_status_code(__LINE__,a,b, TRUE)
252 char exbuf[12], bufa[10];
259 ok_(__FILE__,
line)(
res,
"[1] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number) failed: %lu\n",
GetLastError());
261 ok_(__FILE__,
line)(
code == excode,
"code = %ld, expected %ld\n",
code, excode);
268 ok_(__FILE__,
line)(
res,
"[2] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE|number index) failed: %lu\n",
GetLastError());
278 ok_(__FILE__,
line)(!
strcmp(bufa, exbuf),
"unexpected status code %s, expected %s\n", bufa, exbuf);
284 "[4] HttpQueryInfoA(HTTP_QUERY_STATUS_CODE) failed: %lu\n",
GetLastError());
291 ok_(__FILE__,
line)(!
strcmp_wa(bufw, exbuf),
"unexpected status code %s, expected %s\n", bufa, exbuf);
297 "[6] HttpQueryInfoW(HTTP_QUERY_STATUS_CODE) failed: %lu\n",
GetLastError());
304 ok(
size ==
sizeof(bufw),
"unexpected size %ld\n",
size);
321#define test_request_flags(a,b) _test_request_flags(__LINE__,a,b,FALSE)
322#define test_request_flags_todo(a,b) _test_request_flags(__LINE__,a,b,TRUE)
331 ok_(__FILE__,
line)(
res,
"InternetQueryOptionW(INTERNET_OPTION_REQUEST_FLAGS) failed: %lu\n",
GetLastError());
334 flags &= ~INTERNET_REQFLAG_CACHE_WRITE_DISABLED;
336 ok_(__FILE__,
line)(
flags == exflags,
"flags = %lx, expected %lx\n",
flags, exflags);
339#define test_request_url(a,b) _test_request_url(__LINE__,a,b)
349 ok_(__FILE__,
line)(!
strcmp(
buf, expected_url),
"unexpected URL %s, expected %s\n",
buf, expected_url);
352#define test_http_version(a) _test_http_version(__LINE__,a)
361 ok_(__FILE__,
line)(
res,
"InternetQueryOptionW(INTERNET_OPTION_HTTP_VERSION) failed: %lu\n",
GetLastError());
362 ok_(__FILE__,
line)(
v.dwMajorVersion == 1,
"dwMajorVersion = %ld\n",
v.dwMajorVersion);
363 ok_(__FILE__,
line)(
v.dwMinorVersion == 1,
"dwMinorVersion = %ld\n",
v.dwMinorVersion);
371 DWORD dwInternetStatus,
372 LPVOID lpvStatusInformation,
373 DWORD dwStatusInformationLength
378 switch (dwInternetStatus)
382 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_RESOLVING_NAME \"%s\" %ld\n",
384 (
LPCSTR)lpvStatusInformation,dwStatusInformationLength);
385 *(
LPSTR)lpvStatusInformation =
'\0';
389 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_NAME_RESOLVED \"%s\" %ld\n",
391 (
LPCSTR)lpvStatusInformation,dwStatusInformationLength);
392 *(
LPSTR)lpvStatusInformation =
'\0';
396 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_CONNECTING_TO_SERVER \"%s\" %ld\n",
398 (
LPCSTR)lpvStatusInformation,dwStatusInformationLength);
399 ok(dwStatusInformationLength ==
strlen(lpvStatusInformation)+1,
"unexpected size %lu\n",
400 dwStatusInformationLength);
401 *(
LPSTR)lpvStatusInformation =
'\0';
405 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_CONNECTED_TO_SERVER \"%s\" %ld\n",
407 (
LPCSTR)lpvStatusInformation,dwStatusInformationLength);
408 ok(dwStatusInformationLength ==
strlen(lpvStatusInformation)+1,
"unexpected size %lu\n",
409 dwStatusInformationLength);
410 *(
LPSTR)lpvStatusInformation =
'\0';
414 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_SENDING_REQUEST %p %ld\n",
416 lpvStatusInformation,dwStatusInformationLength);
419 ok(dwStatusInformationLength ==
sizeof(
DWORD),
420 "info length should be sizeof(DWORD) instead of %ld\n",
421 dwStatusInformationLength);
423 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_REQUEST_SENT 0x%lx %ld\n",
425 *(
DWORD *)lpvStatusInformation,dwStatusInformationLength);
429 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_RECEIVING_RESPONSE %p %ld\n",
431 lpvStatusInformation,dwStatusInformationLength);
434 ok(dwStatusInformationLength ==
sizeof(
DWORD),
435 "info length should be sizeof(DWORD) instead of %ld\n",
436 dwStatusInformationLength);
438 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_RESPONSE_RECEIVED 0x%lx %ld\n",
440 *(
DWORD *)lpvStatusInformation,dwStatusInformationLength);
444 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_CTL_RESPONSE_RECEIVED %p %ld\n",
446 lpvStatusInformation,dwStatusInformationLength);
450 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_PREFETCH %p %ld\n",
452 lpvStatusInformation,dwStatusInformationLength);
456 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_CLOSING_CONNECTION %p %ld\n",
458 lpvStatusInformation,dwStatusInformationLength);
462 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_CONNECTION_CLOSED %p %ld\n",
464 lpvStatusInformation,dwStatusInformationLength);
468 "info length should be sizeof(HINTERNET) instead of %ld\n",
469 dwStatusInformationLength);
471 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_HANDLE_CREATED %p %ld\n",
473 *(
HINTERNET *)lpvStatusInformation,dwStatusInformationLength);
479 "info length should be sizeof(HINTERNET) instead of %ld\n",
480 dwStatusInformationLength);
482 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_HANDLE_CLOSING %p %ld\n",
484 *(
HINTERNET *)lpvStatusInformation, dwStatusInformationLength);
492 "info length should be sizeof(INTERNET_ASYNC_RESULT) instead of %ld\n",
493 dwStatusInformationLength);
496 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_REQUEST_COMPLETE {%Id,%ld} %ld\n",
506 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_REDIRECT \"%s\" %ld\n",
508 (
LPCSTR)lpvStatusInformation, dwStatusInformationLength);
509 *(
LPSTR)lpvStatusInformation =
'\0';
515 trace(
"%04lx:Callback %p 0x%Ix INTERNET_STATUS_INTERMEDIATE_RESPONSE %p %ld\n",
517 lpvStatusInformation, dwStatusInformationLength);
521 trace(
"%04lx:Callback %p 0x%Ix %ld %p %ld\n",
523 lpvStatusInformation, dwStatusInformationLength);
533#define open_simple_request(a,b,c,d,e) _open_simple_request(__LINE__,a,b,c,d,e,FALSE)
534#define open_simple_request_proxy(a,b,c,d,e) _open_simple_request(__LINE__,a,b,c,d,e,TRUE)
536 int port,
const char *verb,
const char *
url,
BOOL use_proxy)
549#define close_request(a) _close_request(__LINE__,a)
562#define receive_simple_request(a,b,c) _receive_simple_request(__LINE__,a,b,c)
589 BYTE expect_response[8192],
buf[8192];
596 if(hi == 0x0)
goto abort;
601 if(hic == 0x0)
goto abort;
607 if(hor == 0x0)
goto abort;
614 while(
size <
sizeof(expect_response)) {
620 ok(
size,
"InternetReadFile returned no content\n");
631 if(hi == 0x0)
goto abort;
633 pInternetSetStatusCallbackA(hi, &
callback);
639 if(hic == 0x0)
goto abort;
647 if(hor == 0x0)
goto abort;
654 ok(
expected,
"Expected ERROR_INVALID_HANDLE. Got %lu\n",
err);
658 ok(
expected,
"Expected ERROR_INVALID_HANDLE. Got %lu\n",
err);
662 ok(
expected,
"Expected ERROR_INVALID_HANDLE. Got %lu\n",
err);
668 ok(
expected,
"Expected ERROR_INTERNET_INVALID_OPERATION. Got %lu\n",
err);
672 ok(
expected,
"Expected ERROR_INTERNET_INVALID_OPERATION. Got %lu\n",
err);
676 ok(
expected,
"Expected ERROR_INTERNET_INVALID_OPERATION. Got %lu\n",
err);
700 ok(
expected,
"Expected ERROR_INTERNET_INVALID_OPERATION. Got %lu\n",
err);
704 ok(
expected,
"Expected ERROR_INTERNET_INVALID_OPERATION. Got %lu\n",
err);
708 ok(
expected,
"Expected ERROR_INTERNET_INVALID_OPERATION. Got %lu\n",
err);
718 if(hor == 0x0)
goto abort;
747 ok(
expected,
"Expected position %#lx. Got %#lx. GetLastError() %lu\n",
i,
pos,
err);
750 ok(
res,
"InternetReadFile failed: %lu\n",
err);
751 ok(
count,
"InternetReadFile returned no content\n");
753 "Unexpected result from InternetReadFile\n");
762 ok(
expected,
"Expected position %#lx. Got %#lx. GetLastError() %lu\n",
i,
pos,
err);
765 ok(
res,
"InternetReadFile failed: %lu\n",
err);
767 "Unexpected result from InternetReadFile\n");
779 ok(
expected,
"Expected position %#x. Got %#lx. GetLastError() %lu\n", -1,
pos,
err);
790 ok(
expected,
"Expected position %#lx. Got %#lx. GetLastError() %lu\n",
i,
pos,
err);
794 ok(
expected,
"Expected position %#lx. Got %#lx. GetLastError() %lu\n",
i,
pos,
err);
797 ok(
res,
"InternetReadFile failed: %lu\n",
err);
799 "Unexpected result from InternetReadFile\n");
804 ok(
expected,
"Expected ERROR_NEGATIVE_SEEK. Got %lu\n",
err);
808 ok(
expected,
"Expected position %#x. Got %#lx. GetLastError() %lu\n", 0,
pos,
err);
812 ok(
expected,
"Expected position %#x. Got %#lx. GetLastError() %lu\n", -1,
pos,
err);
816 ok(
expected,
"Expected ERROR_NEGATIVE_SEEK. Got %lu\n",
err);
867 DWORD contents_length, accepts_ranges;
870 trace(
"Starting InternetReadFile test with flags 0x%x on url %s\n",
flags,
test->url);
875 ok((hi != 0x0),
"InternetOpen failed with error %lu\n",
GetLastError());
877 if (hi == 0x0)
goto abort;
879 pInternetSetStatusCallbackA(hi,&
callback);
885 ok((hic != 0x0),
"InternetConnect failed with error %lu\n",
GetLastError());
887 if (hic == 0x0)
goto abort;
903 ok((hor != 0x0),
"HttpOpenRequest failed with error %lu\n",
GetLastError());
906 if (hor == 0x0)
goto abort;
913 ok(
res,
"HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n",
GetLastError());
915 ok(!
strcmp(
buffer,
""),
"HTTP_QUERY_RAW_HEADERS: expected string \"\", but got \"%s\"\n",
buffer);
955 if(
test->post_data) {
964 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
967 "Synchronous HttpSendRequest returning 0, error %lu\n",
GetLastError());
1011 ok(
res,
"InternetQueryOptionA(INTERNET_OPTION_URL) failed with error %ld\n",
GetLastError());
1017 ok(
res,
"HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n",
GetLastError());
1021 ok(
buffer[
length-2],
"Expected any header character, got 0x00\n");
1028 ok(!
res,
"Expected 0x00, got %d\n",
res);
1030 ok(length2 ==
length+1,
"Expected %ld, got %ld\n",
length+1, length2);
1035 ok(
res,
"HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n",
GetLastError());
1036 ok(
buffer[length2] == 0x00,
"Expected 0x00, got %02X\n",
buffer[length2]);
1037 ok(
buffer[length2+1] == 0x77,
"Expected 0x77, got %02X\n",
buffer[length2+1]);
1038 ok(length2 ==
length,
"Value should not have changed: %ld != %ld\n", length2,
length);
1041 memset(wbuffer, 0x77,
sizeof(wbuffer));
1043 ok(
res,
"HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n",
GetLastError());
1044 ok(
length %
sizeof(
WCHAR) == 0,
"Expected that length is a multiple of sizeof(WCHAR), got %ld.\n",
length);
1047 ok(wbuffer[
length-2],
"Expected any header character, got 0x0000\n");
1048 ok(!wbuffer[
length-1],
"Expected 0x0000, got %04X\n", wbuffer[
length-1]);
1049 ok(!wbuffer[
length],
"Expected 0x0000, got %04X\n", wbuffer[
length]);
1051 "Expected 0x7777, got %04X\n", wbuffer[
length+1]);
1055 ok(!
res,
"Expected 0x00, got %d\n",
res);
1057 ok(length2 %
sizeof(
WCHAR) == 0,
"Expected that length is a multiple of sizeof(WCHAR), got %ld.\n", length2);
1058 length2 /=
sizeof(
WCHAR);
1059 ok(length2 ==
length+1,
"Expected %ld, got %ld\n",
length+1, length2);
1062 memset(wbuffer, 0x77,
sizeof(wbuffer));
1064 ok(
res,
"HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %ld\n",
GetLastError());
1065 ok(length2 %
sizeof(
WCHAR) == 0,
"Expected that length is a multiple of sizeof(WCHAR), got %ld.\n", length2);
1066 length2 /=
sizeof(
WCHAR);
1067 ok(!wbuffer[length2],
"Expected 0x0000, got %04X\n", wbuffer[length2]);
1068 ok(wbuffer[length2+1] == 0x7777,
"Expected 0x7777, got %04X\n", wbuffer[length2+1]);
1069 ok(length2 ==
length,
"Value should not have changed: %ld != %ld\n", length2,
length);
1079 "expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n",
GetLastError());
1080 ok(
index == 0,
"Index was incremented\n");
1089 "expected ERROR_HTTP_HEADER_NOT_FOUND, got %x (%lu)\n",
res,
GetLastError());
1090 contents_length = 0;
1096 ok(!
res ||
index == 1,
"Index was not incremented although result is %x (index = %lu)\n",
res,
index);
1112 trace(
"Option HTTP_QUERY_CONTENT_ENCODING -> %i %s\n",
res,
buffer);
1121 "Got unexpected length %#lx, GetLastError() %lu, contents_length %lu, accepts_ranges %#lx.\n",
1124 ok(not_supported,
"Got unexpected length %#lx, GetLastError() %lu.\n",
length,
GetLastError());
1136 ok(!
res,
"InternetReadFile should have failed\n");
1138 "InternetReadFile should have set last error to ERROR_INVALID_HANDLE instead of %lu\n",
1159 trace(
"Entering Query loop\n");
1191 ok(!
length,
"InternetQueryDataAvailable returned ERROR_IO_PENDING and %lu length\n",
length);
1194 ok(exlen,
"length = 0\n");
1200 ok(0,
"InternetQueryDataAvailable failed: %lu\n",
GetLastError());
1227 ok(!on_async,
"Returned zero size in response to request complete\n");
1238 trace(
"aborting\n");
1251 trace(
"Starting InternetReadFile chunked test\n");
1254 ok((hi != 0x0),
"InternetOpen failed with error %lu\n",
GetLastError());
1256 if (hi == 0x0)
goto abort;
1260 ok((hic != 0x0),
"InternetConnect failed with error %lu\n",
GetLastError());
1262 if (hic == 0x0)
goto abort;
1275 ok((hor != 0x0),
"HttpOpenRequest failed with error %lu\n",
GetLastError());
1278 if (hor == 0x0)
goto abort;
1283 "Synchronous HttpSendRequest returning 0, error %lu\n",
GetLastError());
1298 "Failed to get TRANSFER_ENCODING option, error %lu\n",
GetLastError() );
1300 "Wrong transfer encoding '%s'\n",
buffer );
1305 ok( !
res,
"Found CONTENT_LENGTH option '%s'\n",
buffer );
1309 trace(
"Entering Query loop\n");
1314 ok(!(!
res &&
length != 0),
"InternetQueryDataAvailable failed with non-zero length\n");
1327 trace(
"ReadFile -> %i %li\n",
res,got);
1328 ok(
length == got,
"only got %lu of %lu available\n", got,
length );
1329 ok(
buffer[got-1] ==
'\n',
"received partial line '%s'\n",
buffer );
1342 ok( !got,
"got %lu\n", got );
1347 trace(
"aborting\n");
1350 ok (
res,
"InternetCloseHandle of handle opened by HttpOpenRequestA failed\n");
1354 ok (
res,
"InternetCloseHandle of handle opened by InternetOpenA failed\n");
1366 trace(
"Starting InternetReadFileExA test with flags 0x%x\n",
flags);
1370 ok((hi != 0x0),
"InternetOpen failed with error %lu\n",
GetLastError());
1372 if (hi == 0x0)
goto abort;
1374 pInternetSetStatusCallbackA(hi,&
callback);
1380 ok((hic != 0x0),
"InternetConnect failed with error %lu\n",
GetLastError());
1382 if (hic == 0x0)
goto abort;
1398 ok((hor != 0x0),
"HttpOpenRequest failed with error %lu\n",
GetLastError());
1401 if (hor == 0x0)
goto abort;
1432 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
1435 "Synchronous HttpSendRequest returning 0, error %lu\n",
GetLastError());
1471 "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %lu\n",
1485 "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %lu\n",
1500 ok(rc,
"InternetReadFileEx failed with error %lu\n",
GetLastError());
1505 "InternetReadFileEx should have failed with ERROR_INVALID_HANDLE instead of %s, %lu\n",
1509 trace(
"Entering Query loop\n");
1527 trace(
"InternetReadFileEx -> PENDING\n");
1529 "Should not get ERROR_IO_PENDING without INTERNET_FLAG_ASYNC\n");
1544 trace(
"InternetReadFileEx -> SUCCEEDED\n");
1563 "InternetReadFileEx sets offsets to 0x%lx%08lx\n",
1573 ok(
length > 0,
"failed to read any of the document\n");
1590 "DeleteUrlCacheEntry returned %x, GetLastError() = %ld\n",
ret,
GetLastError());
1593 ok((myhinternet != 0),
"InternetOpen failed, error %lu\n",
GetLastError());
1603 ok((myhttp != 0),
"InternetOpenUrl failed, error %lu\n",
GetLastError());
1606 totalbytes += readbytes;
1608 totalbytes += readbytes;
1609 trace(
"read 0x%08lx bytes\n",totalbytes);
1630 static char szPostData[] =
"mode=Test";
1631 static const char szContentType[] =
"Content-Type: application/x-www-form-urlencoded";
1635 ok( hSession !=
NULL ,
"Unable to open Internet session\n");
1639 ok( hConnect !=
NULL,
"Unable to connect to http://test.winehq.org\n");
1644 skip(
"Network unreachable, skipping test\n" );
1665 ok(
ret,
"HttpSendRequestEx Failed with error %lu\n",
error);
1670 for (
i = 3; szPostData[
i];
i++)
1672 "InternetWriteFile failed\n");
1681 "Unable to read response\n");
1682 szBuffer[dwBytesRead] = 0;
1684 ok(dwBytesRead == 13,
"Read %lu bytes instead of 13\n",dwBytesRead);
1696 static const char *
types[] = {
"*",
"",
NULL };
1697 static const WCHAR slash[] = {
'/', 0}, any[] = {
'*', 0},
empty[] = {0};
1706 ok(
connect ==
NULL,
"InternetConnectA should have failed\n");
1711 ok(
connect ==
NULL,
"InternetConnectA should have failed\n");
1721 skip(
"Network unreachable, skipping test\n" );
1754 static const char cache_only_url[] =
"http://test.winehq.org/tests/cache-only";
1755 BYTE cache_headers[] =
"HTTP/1.1 200 OK\r\n\r\n";
1757 trace(
"Testing cache read...\n");
1764 li.
u.HighPart =
now.dwHighDateTime;
1765 li.
u.LowPart =
now.dwLowDateTime;
1783 cache_headers,
sizeof(cache_headers)-1,
"", 0);
1851 static const char cached_content[] =
"data read from cache";
1852 static const char *
types[] = {
"*",
"",
NULL };
1864 skip(
"Network unreachable, skipping test\n" );
1875 ok(
ret,
"InternetQueryOptionA(INTERNET_OPTION_URL) failed: %lu\n",
GetLastError());
1876 ok(!
strcmp(
url,
"http://test.winehq.org/tests/hello.html"),
"Wrong URL %s\n",
url);
1880 ok(!
ret,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n");
1889 ok(
ret,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %lu\n",
GetLastError());
1924 ok(
ret,
"HttpSendRequest failed\n");
1948 ok(!
ret,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n");
1968 ok(
file_name[0] == 0,
"Didn't expect a file name\n");
1990 ok(!
ret,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) succeeded\n");
2003 ok(
ret,
"InternetQueryOptionA(INTERNET_OPTION_DATAFILE_NAME) failed: %lu\n",
GetLastError());
2011 ok(
lock == lock2,
"lock != lock2\n");
2045 ok( hSession !=
NULL ,
"Unable to open Internet session\n");
2049 ok( hConnect !=
NULL,
"Unable to connect to http://test.winehq.org\n");
2054 skip(
"Network unreachable, skipping test\n" );
2057 ok( hRequest !=
NULL,
"Failed to open request handle\n");
2063 buffer,&
len,&
index)==0,
"Warning hearder reported as Existing\n");
2066 "Failed to add new header\n");
2073 ok(
index == 1,
"Index was not incremented\n");
2075 ok(
len == 5,
"Invalid length (exp. 5, got %ld)\n",
len);
2088 ok(
index == 0,
"Index was incremented\n");
2090 ok(
len == 6,
"Invalid length (exp. 6, got %ld)\n",
len);
2099 ok(
len > 40,
"Invalid length (exp. more than 40, got %ld)\n",
len);
2100 ok(
index == 0,
"Index was incremented\n");
2109 ok(
len > 40,
"Invalid length (exp. more than 40, got %ld)\n",
len);
2110 ok(
index == 0,
"Index was incremented\n");
2118 ok(
len > 40,
"Invalid length (exp. more than 40, got %ld)\n",
len);
2119 ok(
index == 0,
"Index was incremented\n");
2129 ok(
len +
sizeof(
CHAR) <= oldlen,
"Result longer than advertised\n");
2133 ok(
strncmp(
buffer,
"POST /tests/post.php HTTP/1", 25)==0,
"Invalid beginning of headers string\n");
2135 ok(
index == 0,
"Index was incremented\n");
2145 ok(
len > 80,
"Invalid length (exp. more than 80, got %ld)\n",
len);
2146 ok(
index == 0,
"Index was incremented\n");
2151 len =
sizeof(wbuffer);
2152 memset(wbuffer,
'x',
sizeof(wbuffer));
2154 wbuffer,&
len,&
index),
"Unable to query header\n");
2155 ok(
len +
sizeof(
WCHAR) <= oldlen,
"Result longer than advertised\n");
2157 ok((
len <
sizeof(wbuffer)-
sizeof(
WCHAR)) && (wbuffer[
len/
sizeof(
WCHAR)] == 0),
"No NUL at end\n");
2158 ok(
index == 0,
"Index was incremented\n");
2168 ok(
len == 2 ||
len == 4 ,
"Expected 2 or 4, got %ld\n",
len);
2170 ok(
index == 0,
"Index was incremented\n");
2173 "Failed to add duplicate header using HTTP_ADDREQ_FLAG_ADD\n");
2180 ok(
index == 1,
"Index was not incremented\n");
2186 ok(
index == 2,
"Index was not incremented\n");
2200 ok(
index == 1,
"Index was not incremented\n");
2206 ok(
index == 2,
"Index was not incremented\n");
2220 ok(
index == 1,
"Index was not incremented\n");
2226 ok(
index == 2,
"Index was not incremented\n");
2240 ok(
index == 1,
"Index was not incremented\n");
2245 ok(
index == 2,
"Index was not incremented\n");
2257 ok(
index == 1,
"Index was not incremented\n");
2262 ok(
index == 2,
"Index was not incremented\n");
2274 ok(
index == 1,
"Index was not incremented\n");
2275 ok(
strcmp(
buffer,
"test2, test4, test5; test6")==0,
"incorrect string was returned(%s)\n",
buffer);
2279 ok(
index == 2,
"Index was not incremented\n");
2291 ok(
index == 1,
"Index was not incremented\n");
2296 ok(
index == 2,
"Index was not incremented\n");
2309 ok(
index == 1,
"Index was not incremented\n");
2314 "Failed to add header with malformed entries in list\n");
2320 ok(
index == 1,
"Index was not incremented\n");
2326 ok(
index == 1,
"Index was not incremented\n");
2332 ok(
index == 1,
"Index was not incremented\n");
2343 ok(
index == 1,
"index was not incremented\n");
2353 "header still present\n");
2371 "Header with empty value is present.\n");
2378 "Header with empty value is present.\n");
2389"Garbage: Header\r\n";
2392"HTTP/1.1 100 Continue\r\n";
2395"HTTP/1.1 100 Continue\r\n"
2396"Server: winecontinue\r\n"
2397"Tag: something witty\r\n";
2400"HTTP/1.1 200 OK\r\n"
2401"Server: winetest\r\n"
2405"HTTP/1.1 201 OK\r\n"
2406"Server: winetest\r\n"
2410"HTTP/1.1 200 OK\r\n"
2411"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n"
2412"Server: winetest\r\n"
2413"Content-Length: 0\r\n"
2414"Set-Cookie: one\r\n"
2415"Set-Cookie: two\r\n"
2416"Last-Modified: Mon, 01 Dec 2008 13:44:34 UTC\r\n"
2421"HTTP/1.1 200 OK\r\n"
2422"Content-Length: %I64u\r\n"
2426"HTTP/1.1 400 Bad Request\r\n"
2427"Server: winetest\r\n"
2431"HTTP/1.1 401 Unauthorized\r\n"
2432"Server: winetest\r\n"
2433"Connection: close\r\n"
2434"WWW-Authenticate: Basic realm=\"placebo\"\r\n"
2438"HTTP/1.0 401 Anonymous requests or requests on unsecure channel are not allowed\r\n"
2439"HTTP/1.0 401 Anonymous requests or requests on unsecure channel are not allowed"
2441"Server: winetest\r\n";
2444"HTTP/1.1 407 Proxy Authentication Required\r\n"
2445"Server: winetest\r\n"
2446"Proxy-Connection: close\r\n"
2447"Proxy-Authenticate: Basic realm=\"placebo\"\r\n"
2452"<HEAD><TITLE>wininet test page</TITLE></HEAD>\r\n"
2453"<BODY>The quick brown fox jumped over the lazy dog<P></BODY>\r\n"
2457"HTTP/1.1 200 OK\r\n"
2458"Connection: Keep-Alive\r\n"
2459"Content-Length: 18\r\n\r\n"
2460"HTTP/1.1 211 OK\r\n\r\n";
2463"HTTP/1.1 210 OK\r\n"
2464"Connection: Keep-Alive\r\n"
2465"Content-Length: 19\r\n\r\n"
2466"HTTP/1.1 211 OK\r\n\r\n";
2469"function FindProxyForURL(url, host) {\r\n"
2470" return 'PROXY localhost:%d';\r\n"
2491 int last_request = 0;
2492 char host_header[22];
2493 char host_header_override[30];
2518 sprintf(host_header,
"Host: localhost:%d",
si->port);
2519 sprintf(host_header_override,
"Host: test.local:%d\r\n",
si->port);
2560 if (
strstr(
buffer,
"Proxy-Authorization: Basic bWlrZToxMTAx"))
2570 if (
strstr(
buffer,
"Authorization: Basic dXNlcjpwd2Q="))
2700 if (
strstr(
buffer,
"GET /test_no_content_content_length"))
2702 static const char nocontentmsg[] =
"HTTP/1.1 204 No Content\r\nConnection: close\r\n"
2703 "Content-Length: 10\r\n\r\n0123456789";
2708 static const char nocontentmsg[] =
"HTTP/1.1 204 No Content\r\nConnection: close\r\n\r\n"
2712 if (
strstr(
buffer,
"GET /test_not_modified_content_length"))
2714 static const char notmodifiedmsg[] =
"HTTP/1.1 304 Not Modified\r\nConnection: close\r\n"
2715 "Content-Length: 10\r\n\r\n0123456789";
2716 send(
c, notmodifiedmsg,
sizeof(notmodifiedmsg)-1, 0);
2720 static const char notmodifiedmsg[] =
"HTTP/1.1 304 Not Modified\r\nConnection: close\r\n"
2722 send(
c, notmodifiedmsg,
sizeof(notmodifiedmsg)-1, 0);
2726 static const char headmsg[] =
"HTTP/1.1 200 OK\r\nConnection: close\r\n"
2727 "Content-Length: 10\r\n\r\n0123456789";
2732 static const char headmsg[] =
"HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n0123456789";
2737 static const char allokmsg[] =
"HTTP/1.1 200 OK\r\nServer: winetest\r\n";
2738 char header[4000 +
sizeof(
"wine-header: ") - 1];
2741 memcpy(
header,
"wine-header: ",
sizeof(
"wine-header: ") - 1);
2742 send(
c, allokmsg,
sizeof(allokmsg) - 1, 0);
2744 send(
c,
"\r\n\r\n", 4, 0);
2748 static const char conn_close_response[] =
"HTTP/1.1 200 OK\r\nConnection: close\r\n\r\nsome content";
2749 send(
c, conn_close_response,
sizeof(conn_close_response)-1, 0);
2751 trace(
"closing connection\n");
2753 if (
strstr(
buffer,
"GET /test_cache_control_no_cache"))
2755 static const char no_cache_response[] =
"HTTP/1.1 200 OK\r\nCache-Control: no-cache\r\n\r\nsome content";
2757 send(
c, no_cache_response,
sizeof(no_cache_response)-1, 0);
2761 if (
strstr(
buffer,
"GET /test_cache_control_no_store"))
2763 static const char no_cache_response[] =
"HTTP/1.1 200 OK\r\nCache-Control: junk, \t No-StOrE\r\n\r\nsome content";
2764 send(
c, no_cache_response,
sizeof(no_cache_response)-1, 0);
2768 static const char gzip_response[] =
"HTTP/1.1 200 OK\r\nContent-Encoding: gzip\r\nContent-Type: text/html\r\n\r\n"
2769 "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\x4b\xaf\xca\x2c\x50\x28"
2770 "\x49\x2d\x2e\xe1\x02\x00\x62\x92\xc7\x6c\x0a\x00\x00\x00";
2772 send(
c, gzip_response,
sizeof(gzip_response), 0);
2777 static const char head_response[] =
2778 "HTTP/1.1 200 OK\r\n"
2779 "Connection: Keep-Alive\r\n"
2780 "Content-Length: 100\r\n"
2783 send(
c, head_response,
sizeof(head_response), 0);
2797 static char msg[] =
"HTTP/1.1 200 OK\r\nConnection: Keep-Alive\r\n\r\n";
2798 static int seen_content_length;
2800 if (!seen_content_length)
2804 seen_content_length = 1;
2818 trace(
"closing connection\n");
2821 if (
strstr(
buffer,
"Authorization: Basic dXNlcjpwd2Q="))
2828 if (
strstr(
buffer,
"Authorization: Basic dXNlcjpwd2Q="))
2835 if (
strstr(
buffer,
"Authorization: Basic dXNlcjE6cHdkMQ=="))
2842 if (
strstr(
buffer,
"Authorization: Bearer dXNlcjE6cHdkMQ=="))
2844 else if (
strstr(
buffer,
"Authorization: Basic dXNlcjpwd2Q="))
2858 const char *page1_mid =
page1 + (
sizeof page1 - 1)/2;
2859 const char *page1_end =
page1 +
sizeof page1 - 1;
2863 send(
c, page1_mid, page1_end - page1_mid, 0);
2893 if (
strstr(
buffer,
"GET http://test.winehq.org/tests/hello.html"))
2901 }
while (!last_request);
2915 trace(
"basic request %s %s\n", verb,
url);
2952 skip(
"missing proxy header, not testing remaining proxy headers\n");
2955 ok(!
strcmp(
buffer,
"Basic realm=\"placebo\""),
"proxy auth info wrong\n");
2962 ok(
r,
"HttpQueryInfo failed\n");
2963 ok(!
strcmp(
buffer,
"Proxy Authentication Required"),
"proxy text wrong\n");
2967 ok(
r,
"HttpQueryInfo failed\n");
2972 ok(
r,
"HttpQueryInfo failed\n");
2978 ok(
r ==
FALSE,
"HttpQueryInfo failed\n");
2989 WCHAR bufferW[0x40];
2990 static const char url_fmt[] =
"http://test.winehq.org:%u/test2";
2993 useragent[] =
"winetest";
2994 static const WCHAR usernameW[] = {
'm',
'i',
'k',
'e',0},
2995 passwordW[] = {
'1',
'1',
'0',
'1',0},
2996 useragentW[] = {
'w',
'i',
'n',
'e',
't',
'e',
's',
't',0};
3004 ok(hi ==
NULL ||
broken(!!hi) ,
"open should have failed\n");
3008 ok(hi !=
NULL,
"open failed\n");
3012 ok(hc !=
NULL,
"connect failed\n");
3015 ok(
hr !=
NULL,
"HttpOpenRequest failed\n");
3021 ok(!
r,
"unexpected success\n");
3022 ok(sz == 1,
"got %lu\n", sz);
3028 ok(!
r,
"unexpected success\n");
3029 ok(sz == 1,
"got %lu\n", sz);
3035 ok(!sz,
"got %lu\n", sz);
3041 ok(!sz,
"got %lu\n", sz);
3047 ok(!
r,
"unexpected success\n");
3048 ok(sz == 1,
"got %lu\n", sz);
3054 ok(!
r,
"unexpected success\n");
3055 ok(sz == 1,
"got %lu\n", sz);
3061 ok(!sz,
"got %lu\n", sz);
3067 ok(!sz,
"got %lu\n", sz);
3073 ok(!
r,
"unexpected success\n");
3074 ok(sz == 34,
"got %lu\n", sz);
3080 ok(sz == 33,
"got %lu\n", sz);
3086 win_skip(
"skipping proxy tests on broken wininet\n");
3094 ok(!
r,
"unexpected success\n");
3097 ok(
r,
"failed to set user\n");
3100 ok(
r,
"failed to set user\n");
3115 ok(!
r,
"unexpected success\n");
3123 ok(!
r,
"unexpected success\n");
3129 ok(
r,
"failed to get username\n");
3134 sz =
sizeof(bufferW);
3136 ok(
r,
"failed to get username\n");
3137 ok(!
lstrcmpW(bufferW, usernameW),
"wrong username\n");
3138 ok(sz ==
lstrlenW(usernameW),
"got %lu\n", sz);
3141 ok(
r,
"failed to set user\n");
3146 ok(
r,
"failed to get username\n");
3151 ok(
r,
"failed to set useragent\n");
3158 ok(!
r,
"unexpected success\n");
3159 ok(sz ==
strlen(useragent) + 1,
"got %lu\n", sz);
3164 ok(
r,
"failed to get user agent\n");
3166 ok(sz ==
strlen(useragent),
"got %lu\n", sz);
3173 ok(!
r,
"unexpected success\n");
3174 ok(sz == (
lstrlenW(useragentW) + 1) *
sizeof(
WCHAR),
"got %lu\n", sz);
3177 sz =
sizeof(bufferW);
3179 ok(
r,
"failed to get user agent\n");
3180 ok(!
lstrcmpW(bufferW, useragentW),
"wrong user agent\n");
3181 ok(sz ==
lstrlenW(useragentW),
"got %lu\n", sz);
3184 ok(
r,
"failed to set user\n");
3191 ok(!
r,
"unexpected success\n");
3197 ok(
r,
"failed to get user\n");
3206 ok(!
r,
"unexpected success\n");
3210 sz =
sizeof(bufferW);
3212 ok(
r,
"failed to get user\n");
3213 ok(!
lstrcmpW(bufferW, usernameW),
"wrong user\n");
3214 ok(sz ==
lstrlenW(usernameW),
"got %lu\n", sz);
3217 ok(
r,
"failed to set password\n");
3224 ok(!
r,
"unexpected success\n");
3230 ok(
r,
"failed to get password\n");
3239 ok(!
r,
"unexpected success\n");
3243 sz =
sizeof(bufferW);
3245 ok(
r,
"failed to get password\n");
3246 ok(!
lstrcmpW(bufferW, passwordW),
"wrong password\n");
3247 ok(sz ==
lstrlenW(passwordW),
"got %lu\n", sz);
3256 ok(!
r,
"unexpected success\n");
3262 ok(
r,
"failed to get url\n");
3271 ok(!
r,
"unexpected success\n");
3275 sz =
sizeof(bufferW);
3277 ok(
r,
"failed to get url\n");
3283 ok(
r,
"failed to set password\n");
3290 ok(!
r,
"unexpected success\n");
3296 ok(
r,
"failed to get password\n");
3305 ok(!
r,
"unexpected success\n");
3309 sz =
sizeof(bufferW);
3311 ok(
r,
"failed to get password\n");
3312 ok(!
lstrcmpW(bufferW, passwordW),
"wrong password\n");
3313 ok(sz ==
lstrlenW(passwordW),
"got %lu\n", sz);
3318 win_skip(
"skipping proxy tests on broken wininet\n");
3324 ok(
r,
"HttpQueryInfo failed\n");
3333 ok(hi !=
NULL,
"InternetOpen failed\n");
3336 ok(hc !=
NULL,
"InternetConnect failed\n");
3339 ok(
hr !=
NULL,
"HttpOpenRequest failed\n");
3354 static const char authorization[] =
"Authorization: Basic dXNlcjpwd2Q=";
3355 static const char connection[] =
"Connection: Close";
3356 static const char *
types[2] = {
"*",
NULL };
3372 ok(
ret,
"HttpAddRequestHeaders failed\n");
3375 ok(
ret,
"HttpSendRequest failed\n");
3386 ok(
ret,
"HttpSendRequest failed\n");
3391 ok(
ret,
"HttpQueryInfo failed\n");
3404 ok(
ret,
"HttpAddRequestHeaders failed\n");
3407 ok(
ret,
"HttpSendRequest failed\n");
3412 ok(
ret,
"HttpQueryInfo failed\n");
3425 ok(
ret,
"HttpAddRequestHeaders failed\n");
3427 data_len =
sizeof(
data);
3435 ok(
ret,
"HttpQueryInfo failed\n");
3449 ok(ses !=
NULL,
"InternetOpen failed\n");
3452 ok(con !=
NULL,
"InternetConnect failed\n");
3455 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3458 ok(
ret,
"HttpSendRequest failed\n");
3465 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3468 ok(
ret,
"HttpSendRequest failed\n");
3475 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3478 ok(
ret,
"HttpSendRequest failed\n");
3485 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3488 ok(
ret,
"HttpSendRequest failed\n");
3499 char buffer[128], host_header_override[30], full_url[128];
3504 sprintf(host_header_override,
"Host: test.local:%d\r\n",
port);
3505 sprintf(full_url,
"http://localhost:%d/test_host_override",
port);
3508 ok(ses !=
NULL,
"InternetOpen failed\n");
3511 ok(con !=
NULL,
"InternetConnect failed\n");
3514 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3521 ok(!
ret,
"HttpQueryInfo succeeded\n");
3527 ok(
ret,
"HttpAddRequestHeaders failed\n");
3533 ok(
ret,
"HttpQueryInfo failed\n");
3538 ok(
ret,
"HttpSendRequest failed\n");
3544 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3547 ok(
ret,
"HttpAddRequestHeaders failed\n");
3550 ok(
ret,
"HttpAddRequestHeaders failed\n");
3553 ok(
ret,
"HttpSendRequest failed\n");
3559 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3562 ok(
ret,
"HttpAddRequestHeaders failed\n");
3565 ok(
ret,
"HttpSendRequest failed\n");
3571 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3575 trace(
"replacing host header is supported.\n");
3578 ok(
ret,
"HttpSendRequest failed\n");
3582 trace(
"replacing host header is not supported.\n");
3588 ok(
ret,
"HttpSendRequest failed\n");
3634 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
3664 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
3694 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
3752 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
3780 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
3807 trace(
"Testing 204 no content response...\n");
3841 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
3871 ok(ses !=
NULL,
"InternetOpen failed\n");
3874 ok(con !=
NULL,
"InternetConnect failed\n");
3877 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3891 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3905 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3919 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3933 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3947 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3972 ok(ses !=
NULL,
"InternetOpen failed\n");
3975 ok(con !=
NULL,
"InternetConnect failed\n");
3978 ok(req !=
NULL,
"HttpOpenRequest failed\n");
3990 ok(!
ret,
"HttpQueryInfoA succeeded\n");
4005 trace(
"Testing connection close connection...\n");
4037 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
4053 ok(
avail != 0,
"avail = 0\n");
4065 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
4086 static const char cache_control_no_cache[] =
"/test_cache_control_no_cache";
4087 static const char cache_control_no_store[] =
"/test_cache_control_no_store";
4088 static const char cache_url_fmt[] =
"http://localhost:%d%s";
4090 char cache_url[256],
buf[256];
4095 trace(
"Testing no-cache header\n");
4104 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4106 sprintf(cache_url, cache_url_fmt,
port, cache_control_no_cache);
4114 ok(
size == 12,
"read %ld bytes of data\n",
size);
4118 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4125 ok(
size == 0,
"read %ld bytes of data\n",
size);
4130 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4132 sprintf(cache_url, cache_url_fmt,
port, cache_control_no_store);
4140 ok(
size == 12,
"read %ld bytes of data\n",
size);
4152 static const char cache_url_fmt[] =
"http://localhost:%d%s";
4153 static const char get_gzip[] =
"/test_cache_gzip";
4154 static const char content[] =
"gzip test\n";
4155 static const char text_html[] =
"text/html";
4156 static const char raw_header[] =
"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n";
4160 char cache_url[256],
buf[256];
4163 trace(
"Testing reading compressed content from cache\n");
4172 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4177 win_skip(
"INTERNET_OPTION_HTTP_DECODING not supported\n");
4183 ok(
ret,
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n",
GetLastError());
4190 ok(
size == 10,
"read %ld bytes of data\n",
size);
4196 ok(
ret,
"HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %ld\n",
GetLastError());
4202 ok(
ret,
"HttpQueryInfo(HTTP_QUERY_CONTENT_TYPE) failed: %ld\n",
GetLastError());
4208 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4212 ok(
ret,
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n",
GetLastError());
4226 "HttpQueryInfo(HTTP_QUERY_CONTENT_ENCODING) returned %d, %ld\n",
4238 sprintf(cache_url, cache_url_fmt,
port, get_gzip);
4242 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4249 ok(
size == 31,
"read %ld bytes of data\n",
size);
4253 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4257 ok(
ret,
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n",
GetLastError());
4276 sprintf(cache_url, cache_url_fmt,
port, get_gzip);
4284 ok(
ret,
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n",
GetLastError());
4290 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4297 ok(
size == 10,
"read %ld bytes of data\n",
size);
4307 sprintf(cache_url, cache_url_fmt,
port, get_gzip);
4318 ok(
ret,
"InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %ld\n",
GetLastError());
4321 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4328 ok(
size == 10,
"read %ld bytes of data\n",
size);
4341 static const WCHAR header[] = {
'U',
'A',
'-',
'C',
'P',
'U',
':',
' ',
'x',
'8',
'6',0};
4347 ok(ses !=
NULL,
"InternetOpen failed\n");
4350 ok(con !=
NULL,
"InternetConnect failed\n");
4353 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4358 ok(!
ret,
"HttpSendRequestW succeeded\n");
4362 "got %lu expected ERROR_IO_PENDING\n",
error);
4377 ok(ses !=
NULL,
"InternetOpen failed\n");
4380 ok(con !=
NULL,
"InternetConnect failed\n");
4385 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4392 ok(!
ret,
"HttpQueryInfo succeeded\n");
4402 ok(!
strcmp(
buffer,
"cookie=not biscuit"),
"got '%s' expected \'cookie=not biscuit\'\n",
buffer);
4480 ok(
ret,
"HttpQueryInfo failed\n");
4481 ok(!
strcmp(
buffer,
"HTTP/1.0 401 Anonymous requests or requests on unsecure channel are not allowed"),
4482 "headers wrong \"%s\"\n",
buffer);
4487 ok(
ret,
"HttpQueryInfo failed\n");
4587 ok(
ret,
"HttpSendRequest failed\n");
4602 size =
sizeof(st) + 1;
4603 memset(&st, 0,
sizeof(st));
4612 memset(&st, 0,
sizeof(st));
4635 "Expected ERROR_HTTP_HEADER_NOT_FOUND, got %lu\n",
GetLastError());
4658 ok(!
ret,
"HttpQueryInfo succeeded\n");
4659 ok(
index == 0xdeadbeef,
"expected 0xdeadbeef got %lu\n",
index);
4697 ok(ses !=
NULL,
"InternetOpen failed\n");
4702 ok(!
ret,
"InternetSetOption succeeded\n");
4707 ok(!
ret,
"InternetSetOption succeeded\n");
4713 ok(!
ret,
"InternetSetOption succeeded\n");
4724 ok(!
ret,
"InternetQueryOption succeeded\n");
4730 ok(!
ret,
"InternetQueryOption succeeded\n");
4737 ok(!
ret,
"InternetQueryOption succeeded\n");
4744 ok(!
ret,
"InternetQueryOption succeeded\n");
4751 ok(
ctx == 1,
"expected 1 got %Iu\n",
ctx);
4754 ok(con !=
NULL,
"InternetConnect failed\n");
4760 ok(
ctx == 0,
"expected 0 got %Iu\n",
ctx);
4770 ok(
ctx == 2,
"expected 2 got %Iu\n",
ctx);
4773 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4779 ok(
ctx == 0,
"expected 0 got %Iu\n",
ctx);
4789 ok(
ctx == 3,
"expected 3 got %Iu\n",
ctx);
4791 size =
sizeof(idsi);
4799 ok(!
ret,
"InternetQueryOption succeeded\n");
4806 ok(!
ret,
"InternetQueryOption succeeded\n");
4812 ok(!
ret,
"InternetQueryOption succeeded\n");
4819 ok(!
ret,
"InternetQueryOption succeeded\n");
4837 "HTTP/1.1 200 OK\r\n"
4838 "Content-Length: 1\r\n"
4844 "HTTP/1.1 404 Fail\r\n"
4845 "Content-Length: 1\r\n"
4852 "Content-Length: 1\r\n"
4859 "Content-Length: 1\r\n"
4866 "Content-Length: 1\r\n"
4886 ok(
res,
"HttpSendRequest failed\n");
4949 char data[] = {
't',
'e',
's',
't'};
4977 ok(ses !=
NULL,
"InternetOpen failed\n");
4980 ok(con !=
NULL,
"InternetConnect failed\n");
4983 ok(req !=
NULL,
"HttpOpenRequest failed\n");
4986 ok(
ret,
"HttpAddRequestHeaders failed\n");
4989 ok(
ret,
"HttpSendRequestA failed\n");
4993 ok(
strstr(
buf,
"Accept-Encoding: gzip") !=
NULL,
"Accept-Encoding header not found in %s\n",
buf);
4998 ok(req !=
NULL,
"HttpOpenRequest failed\n");
5001 ok(
ret,
"HttpSendRequestA failed\n");
5005 ok(
strstr(
buf,
"Accept-Encoding: gzip") !=
NULL,
"Accept-Encoding header not found in %s\n",
buf);
5020 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5057 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5102 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5139 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5188 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5225 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5272 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5287 ok(
ret,
"HttpAddRequestHeaders Failed\n");
5304 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5326 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5337 ok(
ret,
"HttpAddRequestHeaders Failed\n");
5363 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5390 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5401 ok(
ret,
"HttpAddRequestHeaders Failed\n");
5422 DWORD pending_reads;
5430 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5431 pInternetSetStatusCallbackA( ses, &
callback );
5457 ok( !
ret,
"HttpSendRequestA unexpectedly succeeded\n" );
5475 memset( &ib, 0,
sizeof(ib) );
5496 if (!pending_reads++)
5516 ok( pending_reads == 1,
"expected 1 pending read, got %lu\n", pending_reads );
5523 ok( ses !=
NULL,
"InternetOpenA failed\n" );
5524 pInternetSetStatusCallbackA( ses, &
callback );
5550 ok( !
ret,
"HttpSendRequestA unexpectedly succeeded\n" );
5585 if (!pending_reads++)
5596 ok(
bytes != 0,
"expected bytes != 0\n" );
5610 ok( pending_reads == 1,
"expected 1 pending read, got %lu\n", pending_reads );
5625#define server_read_request(a) _server_read_request(__LINE__,a)
5668 if(new_connection) {
5679 ok(!
ret,
"HttpSendRequestA unexpectedly succeeded\n");
5688 if(new_connection) {
5746#define readex_expect_sync_data_len(a,b,c,d,e,f,g) _readex_expect_sync_data_len(__LINE__,a,b,c,d,e,f,g)
5759 buf->dwBufferLength = buf_size;
5762 ok_(__FILE__,
line)(
buf->dwBufferLength ==
len,
"dwBufferLength = %lu, expected %lu\n",
buf->dwBufferLength,
len);
5773#define readex_expect_sync_data(a,b,c,d,e,f) _readex_expect_sync_data(__LINE__,a,b,c,d,e,f)
5775 DWORD buf_size,
const char *exdata,
DWORD expect_receive)
5780#define read_expect_sync_data_len(a,b,c,d,e) _read_expect_sync_data_len(__LINE__,a,b,c,d,e)
5806#define read_expect_sync_data(a,b,c,d) _read_expect_sync_data(__LINE__,a,b,c,d)
5808 DWORD buf_size,
const char *exdata)
5820#define send_response_and_wait(a,b,c,d,e,f,g,h) _send_response_and_wait(__LINE__,a,b,c,d,e,f,g,h)
5823 DWORD expected_size,
DWORD expected_req_error,
DWORD expected_receive_size)
5832 if(do_close_connection)
5854#define send_response_ex_and_wait(a,b,c,d,e,f) _send_response_ex_and_wait(__LINE__,a,b,c,d,e,f)
5857 DWORD expected_receive_size)
5860 exdata, exdata ?
strlen(exdata) :
buf->dwBufferLength, expected_req_error,
5861 expected_receive_size);
5875#define readex_expect_async(a,b,c,d,e) _readex_expect_async(__LINE__,a,b,c,d,e)
5877 DWORD buf_size,
const char *exdata)
5886 buf->dwBufferLength = buf_size;
5889 ok_(__FILE__,
line)(
buf->dwBufferLength == buf_size,
"dwBufferLength = %lu, expected %lu\n",
buf->dwBufferLength, buf_size);
5894 ok_(__FILE__,
line)(!*(
DWORD*)
buf->lpvBuffer,
"buffer data changed\n");
5918 for(
p = (
const char*)
buf +
len;
p < (
const char*)
buf + buf_size;
p++) {
5920 ok(0,
"buffer data changed\n");
5926#define expect_data_available(a,b) _expect_data_available(__LINE__,a,b)
5935 ok_(__FILE__,
line)(
size == exsize,
"size = %lu, expected %u\n",
size, exsize);
5940#define async_query_data_available(a,b) _async_query_data_available(__LINE__,a,b)
5951 "InternetQueryDataAvailable returned: %x(%lu)\n",
res,
GetLastError());
5969 memset(&ib, 0,
sizeof(ib));
5973 trace(
"Testing InternetReadFileExW with IRF_ASYNC flag...\n");
5976 "HTTP/1.1 200 OK\r\n"
5977 "Server: winetest\r\n"
5992 trace(
"Testing InternetReadFileExW with no flags...\n");
5995 "HTTP/1.1 200 OK\r\n"
5996 "Server: winetest\r\n"
6011 trace(
"Testing InternetReadFile...\n");
6014 "HTTP/1.1 200 OK\r\n"
6015 "Server: winetest\r\n"
6030 trace(
"Testing InternetReadFileExW with IRF_NO_WAIT flag...\n");
6033 "HTTP/1.1 200 OK\r\n"
6034 "Server: winetest\r\n"
6043 win_skip(
"Skipping receive notification tests on too old Windows.\n");
6062 "HTTP/1.1 200 OK\r\n"
6063 "Server: winetest\r\n"
6064 "Transfer-Encoding: chunked\r\n"
6089 "HTTP/1.1 200 OK\r\n"
6090 "Server: winetest\r\n"
6091 "Transfer-Encoding: chunked\r\n"
6103 "HTTP/1.1 200 OK\r\n"
6104 "Server: winetest\r\n"
6105 "Connection: close\r\n"
6117 trace(
"Testing InternetQueryDataAvailable...\n");
6120 "HTTP/1.1 200 OK\r\n"
6121 "Server: winetest\r\n"
6139 "HTTP/1.1 200 OK\r\n"
6140 "Server: winetest\r\n"
6141 "Connection: close\r\n"
6158 for(
i = 0;
i < 10;
i++)
6186 memset(&ib, 0,
sizeof(ib));
6191 "HTTP/1.1 200 OK\r\n"
6192 "Server: winetest\r\n"
6193 "Content-Length: 100\r\n"
6260 memset(&ib, 0,
sizeof(ib));
6264 trace(
"Testing InternetReadFileExW on broken connection...\n");
6267 "HTTP/1.1 200 OK\r\n"
6268 "Server: winetest\r\n"
6269 "Content-Length: 10000\r\n"
6285 char buf[
sizeof(long_path)*2],
url[
sizeof(
buf)];
6294 long_path[
sizeof(long_path)-1] = 0;
6308 ok(
ret,
"InternetQueryOptionA(INTERNET_OPTION_URL) failed: %lu\n",
GetLastError());
6325 memset(&ib, 0,
sizeof(ib));
6331 trace(
"Testing persistent connection...\n");
6334 "HTTP/1.1 200 OK\r\n"
6335 "Server: winetest\r\n"
6336 "Content-Length: 2\r\n"
6347 "Server: winetest\r\n"
6348 "Transfer-Encoding: chunked\r\n"
6365 "Server: winetest\r\n"
6366 "Transfer-Encoding: chunked\r\n"
6386 "Server: winetest\r\n"
6387 "Content-Length: 0\r\n"
6388 "Connection: keep-alive\r\n"
6403 "Server: winetest\r\n"
6404 "Transfer-Encoding: chunked\r\n"
6439 memset(&ib, 0,
sizeof(ib));
6443 trace(
"Testing redirection...\n");
6453 "Server: winetest\r\n"
6454 "Location: test_redirection\r\n"
6455 "Connection: keep-alive\r\n"
6456 "Content-Length: 0\r\n"
6463 sprintf(expect_url,
"http://localhost:%u/test_redirection",
port);
6469 "Server: winetest\r\n"
6470 "Content-Length: 3\r\n"
6487 trace(
"Test redirect to non-http URL...\n");
6494 "Server: winetest\r\n"
6495 "Location: test:non:http/url\r\n"
6496 "Connection: keep-alive\r\n"
6497 "Content-Length: 0\r\n"
6505 sprintf(expect_url,
"http://localhost:%u/socket",
port);
6512 trace(
"Test redirect to http URL with no host name...\n");
6519 "Server: winetest\r\n"
6520 "Location: http:///nohost\r\n"
6521 "Connection: keep-alive\r\n"
6522 "Content-Length: 0\r\n"
6530 sprintf(expect_url,
"http://localhost:%u/socket",
port);
6586 sizelen =
sizeof(
len);
6592 ok(
ret,
"HttpQueryInfo should have succeeded\n");
6601 ok(!
ret,
"HttpQueryInfo should have failed\n");
6603 "expected ERROR_HTTP_INVALID_HEADER, got %lx\n",
GetLastError());
6604 ok(
len == ~0,
"expected ~0, got %lu\n",
len);
6606 ok(sizelen ==
sizeof(
DWORD),
"sizelen %lu\n", sizelen);
6611 sizelen =
sizeof(len64);
6615 ok(!
ret,
"HttpQueryInfo should have failed\n");
6617 "expected ERROR_HTTP_INVALID_HEADER, got %lx\n",
GetLastError());
6618 ok(sizelen ==
sizeof(
DWORD64),
"sizelen %lu\n", sizelen);
6619 ok(len64 == ~0,
"len64 %I64x\n", len64);
6625 "HTTP/1.1 200 OK\r\n"
6626 "Server: winetest\r\n"
6627 "Content-Length: 4294967296\r\n"
6647 char header[] =
"Test-Header: winetest";
6648 WCHAR wheader[] =
L"Test-Header: winetest";
6655 ok(
ret ==
FALSE,
"HttpSendRequestA should have failed\n");
6673 ok(
ret ==
FALSE,
"HttpSendRequestExA should have failed\n");
6695 static const WCHAR autoconf_url_fmt[] =
L"http://localhost:%d/proxy.pac?ver=1";
6698 WCHAR autoconf_url[64];
6707 memset(&option_list, 0,
sizeof(option_list));
6708 option_list.
dwSize =
sizeof(option_list);
6712 options[0].Value.pszValue = autoconf_url;
6724 ok(
len ==
sizeof(
page1) - 1,
"unexpected buffer size\n");
6729 len =
sizeof(option_list);
6804 skip(
"Skipping test_redirect and test_persistent_connection due to hang. See ROSTESTS-294.\n");
6854 "test.winehq.com\r\n"
6855 "webmaster@winehq.org",
6862 "test.winehq.com\r\n"
6863 "webmaster@winehq.org"
6867 "Subject:\r\n%s\r\n"
6869 "Effective Date:\t%s %s\r\n"
6870 "Expiration Date:\t%s %s\r\n"
6871 "Security Protocol:\t%s\r\n"
6872 "Signature Type:\t%s\r\n"
6873 "Encryption Type:\t%s\r\n"
6874 "Privacy Strength:\t%s (%u bits)";
6879 char expiry_date[32];
6880 char expiry_time[32];
6881 char start_date[32];
6882 char start_time[32];
6888 size =
sizeof(actual);
6890 memset(actual, 0x55,
sizeof(actual));
6903 start_date, start_time, expiry_date, expiry_time,
6904 info->lpszSignatureAlgName,
info->lpszEncryptionAlgName,
info->lpszProtocolName,
6905 info->dwKeySize >= 128 ?
"High" :
"Low",
info->dwKeySize);
6911 memset(actual, 0x55,
sizeof(actual));
6914 ok(
size == 1,
"unexpected size: %lu\n",
size);
6915 ok(actual[0] == 0x55,
"unexpected byte: %02x\n", actual[0]);
6930 win_skip(
"Querying INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT failed, skipping tests\n");
6937 ok(!
strcmp(
info.lpszSubjectInfo,
test->ex_subject),
"lpszSubjectInfo = %s\n",
info.lpszSubjectInfo);
6939 ok(!
info.lpszSignatureAlgName,
"lpszSignatureAlgName = %s\n",
info.lpszSignatureAlgName);
6940 ok(!
info.lpszEncryptionAlgName,
"lpszEncryptionAlgName = %s\n",
info.lpszEncryptionAlgName);
6941 ok(!
info.lpszProtocolName,
"lpszProtocolName = %s\n",
info.lpszProtocolName);
6942 ok(
info.dwKeySize >= 128 &&
info.dwKeySize <= 256,
"dwKeySize = %lu\n",
info.dwKeySize);
6947 skip(
"Skipping tests that are English-only\n");
6951#define test_security_info(a,b,c) _test_security_info(__LINE__,a,b,c)
6959 if(!pInternetGetSecurityInfoByURLA) {
6960 win_skip(
"pInternetGetSecurityInfoByURLA not available\n");
6965 chain = (
void*)0xdeadbeef;
6977 "InternetGetSecurityInfoByURLA returned: %x(%lu)\n",
res,
GetLastError());
6987 "InternetGetSecurityInfoByURLA returned: %x(%lu), expected %lu\n",
res,
GetLastError(),
error);
6991#define test_secflags_option(a,b,c) _test_secflags_option(__LINE__,a,b,c)
7000 ok_(__FILE__,
line)(
res,
"InternetQueryOptionW(INTERNET_OPTION_SECURITY_FLAGS) failed: %lu\n",
GetLastError());
7001 ok_(__FILE__,
line)((
flags & ~opt_flags) == ex_flags,
"INTERNET_OPTION_SECURITY_FLAGS flags = %lx, expected %lx\n",
7009 ok_(__FILE__,
line)((
flags & ~opt_flags) == ex_flags,
"INTERNET_OPTION_SECURITY_FLAGS(98) flags = %lx, expected %lx\n",
7013#define set_secflags(a,b,c) _set_secflags(__LINE__,a,b,c)
7019 ok_(__FILE__,
line)(
res,
"InternetSetOption(INTERNET_OPTION_SECURITY_FLAGS) failed: %lu\n",
GetLastError());
7032 win_skip(
"Can't make https connections, skipping security flags test\n");
7036 trace(
"Testing security flags...\n");
7040 ok(ses !=
NULL,
"InternetOpen failed\n");
7042 pInternetSetStatusCallbackA(ses, &
callback);
7054 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7061 win_skip(
"Incomplete security flags support, skipping\n");
7129 ok(
res,
"InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n",
GetLastError());
7135 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7140 ok(
res,
"InternetQueryOption(INTERNET_OPTION_ERROR_MASK failed: %lu\n",
GetLastError());
7169 cert->lpszSignatureAlgName = (
char *)0xdeadbeef;
7170 cert->lpszEncryptionAlgName = (
char *)0xdeadbeef;
7171 cert->lpszProtocolName = (
char *)0xdeadbeef;
7172 cert->dwKeySize = 0xdeadbeef;
7177 ok(
cert->lpszSubjectInfo &&
strlen(
cert->lpszSubjectInfo) > 1,
"expected a non-empty subject name\n");
7178 ok(
cert->lpszIssuerInfo &&
strlen(
cert->lpszIssuerInfo) > 1,
"expected a non-empty issuer name\n");
7179 ok(!
cert->lpszSignatureAlgName,
"unexpected signature algorithm name\n");
7180 ok(!
cert->lpszEncryptionAlgName,
"unexpected encryption algorithm name\n");
7181 ok(!
cert->lpszProtocolName,
"unexpected protocol name\n");
7182 ok(
cert->dwKeySize != 0xdeadbeef,
"unexpected key size\n");
7197 ok(
size == 1,
"unexpected size: %lu\n",
size);
7204 ok(
size == 1,
"unexpected size: %lu\n",
size);
7205 ok(
buf[0] == 0x55,
"unexpected byte: %02x\n",
buf[0]);
7223 skip(
"Unexpected cert errors %lu, skipping security flags tests\n",
req_error);
7320 ok(
res,
"InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n",
GetLastError());
7325 ok(ses !=
NULL,
"InternetOpen failed\n");
7327 pInternetSetStatusCallbackA(ses, &
callback);
7339 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7393 static const WCHAR gizmo5[] = {
'G',
'i',
'z',
'm',
'o',
'5',0};
7394 static const WCHAR testsite[] = {
't',
'e',
's',
't',
'.',
'w',
'i',
'n',
'e',
'h',
'q',
'.',
'o',
'r',
'g',0};
7395 static const WCHAR get[] = {
'G',
'E',
'T',0};
7396 static const WCHAR testpage[] = {
'/',
't',
'e',
's',
't',
's',
'/',
'h',
'e',
'l',
'l',
'o',
'.',
'h',
't',
'm',
'l',0};
7401 char certstr1[512], certstr2[512];
7406 ok(ses !=
NULL,
"InternetOpen failed\n");
7411 ok(con !=
NULL,
"InternetConnect failed\n");
7415 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7423 win_skip(
"Cannot connect to https.\n");
7452 certificate_structW, &
size);
7459 "expected a non-empty subject name\n");
7462 "expected a non-empty issuer name\n");
7464 "unexpected signature algorithm name\n");
7466 "unexpected encryption algorithm name\n");
7468 "unexpected protocol name\n");
7469 ok(certificate_structA->
dwKeySize,
"expected a non-zero key size\n");
7475 size =
sizeof(certstr1);
7480 size2 =
sizeof(certstr2);
7484 ok(
size == size2,
"expected same size\n");
7485 ok(!
strcmp(certstr1, certstr2),
"expected same string\n");
7493 ok(ses !=
NULL,
"InternetOpen failed\n");
7498 ok(con !=
NULL,
"InternetConnect failed\n");
7502 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7518 certificate_structA, &
size);
7524 "expected a non-empty subject name\n");
7527 "expected a non-empty issuer name\n");
7529 "unexpected signature algorithm name\n");
7531 "unexpected encryption algorithm name\n");
7533 "unexpected protocol name\n");
7534 ok(certificate_structA->
dwKeySize,
"expected a non-zero key size\n");
7549 certificate_structW, &
size);
7556 "expected a non-empty subject name\n");
7559 "expected a non-empty issuer name\n");
7561 "unexpected signature algorithm name\n");
7563 "unexpected encryption algorithm name\n");
7565 "unexpected protocol name\n");
7566 ok(certificate_structA->
dwKeySize,
"expected a non-zero key size\n");
7585 ok(ses !=
NULL,
"InternetOpen failed\n");
7588 ok(con !=
NULL,
"InternetConnect failed\n");
7594 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7600 ok(!
ret,
"HttpQueryInfo succeeded\n");
7604 ok(
ret,
"HttpSendRequest failed\n");
7610 ok(!
ret,
"HttpQueryInfo succeeded\n");
7618 ok(
ret,
"InternetSetOptionA failed to set user agent for session\n");
7624 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7630 ok(!
ret,
"HttpQueryInfo succeeded\n");
7641 ok(!
ret,
"HttpQueryInfo succeeded\n");
7651 ok(con !=
NULL,
"InternetConnect failed\n");
7657 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7663 ok(!
ret,
"HttpQueryInfo succeeded\n");
7673 ok(
ret,
"HttpQueryInfo failed\n");
7681 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7687 ok(!
ret,
"HttpAddRequestHeaders succeeded\n");
7696 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7699 ok(
ret,
"HttpAddRequestHeaders failed\n");
7704 ok(
ret,
"HttpQueryInfo failed\n");
7714 ok(
ret,
"HttpQueryInfo failed\n");
7722 ok(req !=
NULL,
"HttpOpenRequest failed\n");
7728 ok(!
ret,
"HttpQueryInfo succeeded\n");
7732 ok(
ret,
"HttpAddRequestHeaders failed\n");
7738 ok(!
strcmp(
buffer,
"audio/*, image/*, text/*"),
"got '%s' expected 'audio/*, image/*, text/*'\n",
buffer);
7755 static const char *
types[] = { (
const char *)6240,
"*/*",
"%p",
"", (
const char *)0xffffffff,
"*/*",
NULL };
7798 trace(
"request handle: 0x%08Ix\n",
result->dwResult);
7830 ok(
ret,
"InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n",
GetLastError());
7844 ok(ses !=
NULL,
"InternetOpen failed\n");
7849 ok(!
ret,
"InternetSetOptionA succeeded\n");
7854 ok(!
ret,
"InternetSetOptionA failed\n");
7857 pInternetSetStatusCallbackW(ses,
cb);
7870 "expected INTERNET_HANDLE_TYPE_HTTP_REQUEST, got %lu\n",
type);
7875 ok(
size > 0,
"expected size > 0\n");
7921 BOOL status_ok, function_ok;
7957 i < info->
count - 1 &&
8102 "Public ID=codeweavers"
8129 static const char *
accept[2] = {
"*/*",
NULL};
8132 trace(
"Async HttpSendRequestEx test (%s %s)\n", nd->
method, nd->
host);
8136 ok(
ret,
"InternetSetOption(INTERNET_OPTION_END_BROWSER_SESSION) failed: %lu\n",
GetLastError());
8148 ok( ses !=
NULL,
"InternetOpen failed\n" );
8167 b.lpcszHeader =
"Content-Type: application/x-www-form-urlencoded";
8168 b.dwHeadersLength =
strlen(
b.lpcszHeader );
8179 skip(
"WaitForSingleObject returned %ld, assuming DNS problem\n",
error);
8194 "expected ERROR_INTERNET_INCORRECT_HANDLE_STATE got %lu\n",
error );
8204 ok( written ==
size,
"expected %lu got %lu\n", written,
size );
8211 ok( !
ret,
"HttpEndRequestA succeeded\n" );
8220 ok( !
ret,
"HttpEndRequestA succeeded\n" );
8241 LPVOID lpvStatusInformation,
DWORD dwStatusInformationLength)
8247 trace(
"closetest_callback %p: %ld\n", hInternet, dwInternetStatus);
8250 "Unexpected hInternet %p\n", hInternet);
8257 "InternetQueryOptionA(%p INTERNET_OPTION_HANDLE_TYPE) failed: %x %lu, expected TRUE ERROR_INVALID_HANDLE\n",
8280 "Asynchronous HttpSendRequest NOT returning 0 with error ERROR_IO_PENDING\n");
8287 trace(
"Closed session handle\n");
8300 "InternetQueryOptionA(%p INTERNET_OPTION_REQUEST_FLAGS) failed: %x %lu, expected TRUE ERROR_INVALID_HANDLE\n",
8315 ok(!
ret,
"unexpected success\n");
8344 ok(!
ret,
"HttpSendRequest succeeded\n");
8346 "got %lu\n",
error);
8367 win_skip(
"Can't make https connection\n");
8395 ok(!
strcmp(
buffer,
"test.winehq.org:443"),
"Expected test.winehg.org:443, got '%s'\n",
buffer);
8411#define STATUS_STRING(status) status_string[status] = #status
8460 ok(
strstr(
buf,
"winetest: winetest" ) !=
NULL,
"header missing\n" );
8473 ok( ses !=
NULL,
"InternetOpenA failed\n" );
8482 pInternetSetStatusCallbackA( req,
header_cb );
8487 ok( !
ret,
"HttpSendRequestA succeeded\n" );
8508 ok( ses !=
NULL,
"InternetOpenA failed\n" );
8517 size =
sizeof(actual);
8519 memset( actual, 0x55,
sizeof(actual) );
8523 ok(
size == 0,
"unexpected size: %lu\n",
size );
8524 ok( actual[0] == 0x55,
"unexpected byte: %02x\n", actual[0] );
8543 win_skip(
"Too old IE (older than 6.0)\n");
8547 pInternetSetStatusCallbackA = (
void*)
GetProcAddress(
hdll,
"InternetSetStatusCallbackA");
8548 pInternetSetStatusCallbackW = (
void*)
GetProcAddress(
hdll,
"InternetSetStatusCallbackW");
8549 pInternetGetSecurityInfoByURLA = (
void*)
GetProcAddress(
hdll,
"InternetGetSecurityInfoByURLA");
8551 if(!pInternetGetSecurityInfoByURLA) {
8553 win_skip(
"IE6 found. It's too old for some tests.\n");
static unsigned char bytes[4]
static struct sockaddr_in sa
#define InterlockedDecrement
void get(int argc, const char *argv[])
#define RegCloseKey(hKey)
static const WCHAR proxy_enable[]
static const WCHAR internet_settings[]
#define ERROR_INSUFFICIENT_BUFFER
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
static const WCHAR empty[1]
VOID WINAPI CertFreeCertificateChain(PCCERT_CHAIN_CONTEXT pChainContext)
#define ERROR_INVALID_PARAMETER
#define INVALID_SET_FILE_POINTER
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
#define MultiByteToWideChar
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
LANGID WINAPI GetUserDefaultLangID(void)
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
_ACRTIMP int __cdecl atoi(const char *)
_ACRTIMP size_t __cdecl strlen(const char *)
_ACRTIMP char *__cdecl strstr(const char *, const char *)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI HttpEndRequestA(HINTERNET hRequest, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, LPCSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, LPCSTR lpszVerb, LPCSTR lpszObjectName, LPCSTR lpszVersion, LPCSTR lpszReferrer, LPCSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest, LPINTERNET_BUFFERSA lpBuffersIn, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength)
BOOL WINAPI InternetLockRequestFile(HINTERNET hInternet, HANDLE *lphLockReqHandle)
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetUnlockRequestFile(HANDLE hLockHandle)
BOOL WINAPI InternetCanonicalizeUrlA(LPCSTR lpszUrl, LPSTR lpszBuffer, LPDWORD lpdwBufferLength, DWORD dwFlags)
DWORD WINAPI InternetSetFilePointer(HINTERNET hFile, LONG lDistanceToMove, PVOID pReserved, DWORD dwMoveContext, DWORD_PTR dwContext)
BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, DWORD dwNumOfBytesToRead, LPDWORD pdwNumOfBytesRead)
HINTERNET WINAPI InternetOpenA(LPCSTR lpszAgent, DWORD dwAccessType, LPCSTR lpszProxy, LPCSTR lpszProxyBypass, DWORD dwFlags)
BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, LPCSTR lpszHeaders, DWORD dwHeadersLength, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
HINTERNET WINAPI InternetConnectA(HINTERNET hInternet, LPCSTR lpszServerName, INTERNET_PORT nServerPort, LPCSTR lpszUserName, LPCSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, DWORD dwBufferLength)
BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName)
BOOL WINAPI CreateUrlCacheEntryA(LPCSTR lpszUrlName, DWORD dwExpectedFileSize, LPCSTR lpszFileExtension, LPSTR lpszFileName, DWORD dwReserved)
BOOL WINAPI CommitUrlCacheEntryA(LPCSTR lpszUrlName, LPCSTR lpszLocalFileName, FILETIME ExpireTime, FILETIME LastModifiedTime, DWORD CacheEntryType, LPBYTE lpHeaderInfo, DWORD dwHeaderSize, LPCSTR lpszFileExtension, LPCSTR lpszOriginalUrl)
INT WSAAPI recvfrom(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags, OUT LPSOCKADDR from, IN OUT INT FAR *fromlen)
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLboolean GLboolean GLboolean b
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLsizei GLsizei * length
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
HLOCAL NTAPI LocalFree(HLOCAL hMem)
#define todo_wine_if(is_todo)
#define memcpy(s1, s2, n)
#define ERROR_FILE_NOT_FOUND
static struct test_info tests[]
static IPrintDialogCallback callback
static HINSTANCE hkernel32
static void ULONG ULONG * ret_size
static const CHAR post_data[]
static BOOL test_redirect
static void test_http_connection(void)
#define CHECK_EXPECT(status)
static void test_basic_auth_credentials_different(int port)
static const struct notification async_send_request_ex_test[]
static const char okmsg2[]
#define _SECURITY_FLAG_CERT_REV_FAILED
static void test_pac(int port)
static int optional[MAX_INTERNET_STATUS]
static void _test_status_code(unsigned line, HINTERNET req, DWORD excode, BOOL is_todo)
static void _readex_expect_sync_data(unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata, DWORD expect_receive)
static void _read_expect_sync_data_len(unsigned line, HINTERNET req, void *buf, DWORD buf_size, const char *exdata, DWORD len)
static const char ok_with_length2[]
static HINTERNET closetest_session
static void test_connection_header(int port)
static void test_request_content_length(int port)
static void server_send_string(const char *msg)
static LONG close_handle_cnt
#define async_query_data_available(a, b)
static int notified[MAX_INTERNET_STATUS]
static void test_proxy_direct(int port)
static HANDLE conn_wait_event
static const char expandcontmsg[]
static DWORD _expect_data_available(unsigned line, HINTERNET req, int exsize)
static void _readex_expect_async(unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata)
static DWORD CALLBACK server_thread(LPVOID param)
static void WINAPI header_cb(HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info, DWORD len)
static void HttpSendRequestEx_test(void)
#define test_http_version(a)
static HANDLE complete_event
static void _open_simple_request(unsigned line, test_request_t *req, const char *host, int port, const char *verb, const char *url, BOOL use_proxy)
#define test_secflags_option(a, b, c)
static const char okmsg[]
static const char largemsg[]
static void _send_response_ex_and_wait(unsigned line, const char *response, BOOL close_connection, INTERNET_BUFFERSW *buf, const char *exdata, DWORD expected_req_error, DWORD expected_receive_size)
static void _test_security_info(unsigned line, const char *urlc, DWORD error, DWORD ex_flags)
static void test_basic_auth_credentials_end_session(int port)
static BOOL https_support
static CRITICAL_SECTION notification_cs
#define test_request_flags_todo(a, b)
static void setup_test(struct info *info, enum api function, unsigned int line, DWORD expect_result)
static void test_no_cache(int port)
static void test_basic_auth_credentials_reuse(int port)
static void test_no_content(int port)
#define SET_WINE_ALLOW(status)
static const struct notification async_send_request_ex_resolve_failure_test[]
#define receive_simple_request(a, b, c)
static const char noauthmsg2[]
static void release_cert_info(INTERNET_CERTIFICATE_INFOA *info)
static void test_large_header(int port)
static void test_cookie_header(int port)
static HANDLE conn_close_event
#define test_request_flags(a, b)
static const char noauthmsg[]
#define send_response_and_wait(a, b, c, d, e, f, g, h)
static void open_read_test_request(int port, test_request_t *req, const char *response)
static void test_remove_dot_segments(int port)
static void read_expect_async(HINTERNET req, void *buf, DWORD buf_size, DWORD *ret_size, const char *exdata)
static void _send_response_and_wait(unsigned line, const char *response, BOOL do_close_connection, void *buf, DWORD *ret_size, const char *exdata, DWORD expected_size, DWORD expected_req_error, DWORD expected_receive_size)
static void test_connection_break(int port)
#define open_simple_request_proxy(a, b, c, d, e)
#define MAX_INTERNET_STATUS
static void _server_read_request(unsigned line, const char *expected_request)
static const http_status_test_t http_status_tests[]
#define STATUS_STRING(status)
static void test_secure_connection(void)
static void test_proxy_indirect(int port)
static void test_connection_closing(int port)
static const char notokmsg[]
static const char proxy_pac[]
#define CHECK_NOTIFIED(status)
static const char page1[]
static void test_response_without_headers(int port)
static void test_concurrent_header_access(void)
static void test_basic_authentication(int port)
#define send_response_ex_and_wait(a, b, c, d, e, f)
static int strcmp_wa(LPCWSTR strw, const char *stra)
static HINTERNET closetest_req
static const char garbagemsg[]
#define CLEAR_NOTIFIED(status)
static void WINAPI closetest_callback(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
static void _close_request(unsigned line, test_request_t *req)
static const char ok_with_length[]
static BOOL closetest_closed
static int test_cache_gzip
static void test_header_override(int port)
static void init_status_tests(void)
static void test_cert_struct(HINTERNET req, const cert_struct_test_t *test)
static INTERNET_STATUS_CALLBACK
#define set_secflags(a, b, c)
static void init_events(void)
static void _test_http_version(unsigned line, HINTERNET req)
static void test_http_cache(void)
static void test_cache_control_verb(int port)
static void test_open_url_async(void)
static void test_large_content(int port)
#define SET_OPTIONAL(status)
static BOOL first_connection_to_test_url
#define expect_data_available(a, b)
#define CHECK_NOTIFIED2(status, num)
#define read_expect_sync_data(a, b, c, d)
static void InternetReadFile_chunked_test(void)
static void test_basic_auth_credentials_cached_manual(int port)
static void send_socket_request(test_request_t *req, BOOL new_connection)
#define test_request_url(a, b)
static void test_user_agent_header(void)
static const char * status_string[MAX_INTERNET_STATUS]
#define server_read_request(a)
static void _async_query_data_available(unsigned line, HINTERNET req, DWORD *size)
static void InternetOpenUrlA_test(void)
static void test_head_request(int port)
static void test_header_handling_order(int port)
#define open_simple_request(a, b, c, d, e)
static void test_async_read(int port)
#define CHECK_NOT_NOTIFIED(status)
static const cert_struct_test_t test_winehq_org_cert
static void test_basic_request(int port, const char *verb, const char *url)
static DWORD received_response_size
static void reset_events(void)
static void test_not_modified(int port)
static void InternetOpenRequest_test(void)
static void test_async_HttpSendRequestEx(const struct notification_data *nd)
static void HttpHeaders_test(void)
static void CALLBACK check_notification(HINTERNET handle, DWORD_PTR context, DWORD status, LPVOID buffer, DWORD buflen)
static void test_InternetCloseHandle(void)
static void test_persistent_connection(int port)
static const struct notification async_send_request_ex_chunked_test[]
static void test_successive_HttpSendRequest(int port)
static DWORD _receive_simple_request(unsigned line, HINTERNET req, char *buf, size_t buf_size)
static void InternetSetFilePointer_test(const char *host, const char *path)
static void close_connection(void)
static void test_HttpSendRequestW(int port)
#define test_security_info(a, b, c)
static const char * send_buffer
static void test_basic_auth_credentials_manual(int port)
static void test_default_service_port(void)
static void test_cache_read_gzipped(int port)
static void test_cert_struct_string(HINTERNET req, const INTERNET_CERTIFICATE_INFOA *info)
static void _test_request_flags(unsigned line, HINTERNET req, DWORD exflags, BOOL is_todo)
static void close_async_handle(HINTERNET handle, int handle_cnt)
static int wine_allow[MAX_INTERNET_STATUS]
static void _test_secflags_option(unsigned line, HINTERNET req, DWORD ex_flags, DWORD opt_flags)
static void test_premature_disconnect(int port)
static void _test_request_url(unsigned line, HINTERNET req, const char *expected_url)
static const char okmsg201[]
static void test_cache_read(void)
static const char * cert_string_fmt
static void test_HttpQueryInfo(int port)
static void InternetLockRequestFile_test(void)
static void test_connection_failure(void)
#define test_status_code(a, b)
#define SET_OPTIONAL2(status, num)
static HANDLE request_sent_event
#define readex_expect_sync_data(a, b, c, d, e, f)
static void test_http_status(int port)
static const struct notification async_send_request_ex_test2[]
static HANDLE server_req_rec_event
static void open_socket_request(int port, test_request_t *req, const char *verb)
static void test_header_length(int port)
static const char contmsg[]
static void test_bogus_accept_types_array(void)
static void test_file_pointer(int port)
static HINTERNET closetest_conn
static void WINAPI readex_callback(HINTERNET handle, DWORD_PTR context, DWORD status, void *info, DWORD info_size)
static void InternetReadFileExA_test(int flags)
static const cert_struct_test_t test_winehq_com_cert
static void _read_expect_sync_data(unsigned line, HINTERNET req, void *buf, DWORD buf_size, const char *exdata)
#define SET_EXPECT2(status, num)
static void test_http_read(int port)
static int expect[MAX_INTERNET_STATUS]
static void test_cert_string(void)
#define readex_expect_async(a, b, c, d, e)
static void test_accept_encoding(int port)
static void InternetReadFile_test(int flags, const test_data_t *test)
static BOOL skip_receive_notification_tests
static const char proxymsg[]
static BOOL proxy_active(void)
static void test_invalid_response_headers(int port)
static void test_conn_close(int port)
static DWORD64 content_length
static void test_options(int port)
static void _readex_expect_sync_data_len(unsigned line, HINTERNET req, DWORD flags, INTERNET_BUFFERSW *buf, DWORD buf_size, const char *exdata, DWORD len, DWORD expect_receive)
#define _SECURITY_FLAG_CERT_INVALID_CA
static void free_events(void)
static void _set_secflags(unsigned line, HINTERNET req, BOOL use_undoc, DWORD flags)
static void test_security_flags(void)
#define SET_EXPECT(status)
static PCCERT_CHAIN_CONTEXT DWORD *static BOOL is_lang_english(void)
static void send_response_len_and_wait(unsigned len, BOOL close_connection, INTERNET_BUFFERSW *buf)
static void test_long_url(void)
#define server_read_data(a)
#define LOCALE_USER_DEFAULT
static unsigned int file_size
TCHAR file_path[MAX_PATH]
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
INT WSAAPI shutdown(IN SOCKET s, IN INT how)
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
wchar_t const *const size_t const buffer_size
LPSTR lpszSignatureAlgName
LPSTR lpszEncryptionAlgName
struct _INTERNET_BUFFERSA * Next
LPINTERNET_PER_CONN_OPTIONW pOptions
const char * response_text
const struct notification * test
const struct notification * test
const char * redirected_url
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
struct _LARGE_INTEGER::@2753 u
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentThreadId(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
u_long WINAPI inet_addr(const char *str)
#define ERROR_SHARING_VIOLATION
#define ERROR_NEGATIVE_SEEK
static const char headmsg[]
static const char nocontentmsg[]
#define HTTP_STATUS_BAD_REQUEST
#define SECURITY_FLAG_SECURE
#define INTERNET_DEFAULT_HTTP_PORT
#define SECURITY_FLAG_STRENGTH_STRONG
#define SECURITY_FLAG_IGNORE_UNKNOWN_CA
#define SECURITY_FLAG_IGNORE_CERT_CN_INVALID
#define INTERNET_DEFAULT_HTTPS_PORT
BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName, LPCSTR lpCookieData)
#define HTTP_ADDREQ_FLAG_REPLACE
#define INTERNET_FLAG_FROM_CACHE
#define INTERNET_STATUS_RECEIVING_RESPONSE
#define INTERNET_ERROR_MASK_COMBINED_SEC_CERT
#define INTERNET_OPTION_SECURITY_FLAGS
#define INTERNET_FLAG_DONT_CACHE
#define INTERNET_OPTION_PROXY_PASSWORD
#define HTTP_QUERY_SET_COOKIE
#define PROXY_TYPE_AUTO_PROXY_URL
#define HTTP_QUERY_LAST_MODIFIED
#define INTERNET_HANDLE_TYPE_HTTP_REQUEST
#define INTERNET_STATUS_CONNECTION_CLOSED
#define HTTP_QUERY_PROXY_AUTHENTICATE
#define INTERNET_FLAG_RELOAD
#define ERROR_INTERNET_INVALID_URL
#define INTERNET_STATUS_STATE_CHANGE
#define INTERNET_FLAG_RESYNCHRONIZE
#define INTERNET_PER_CONN_FLAGS
#define INTERNET_OPTION_PROXY_USERNAME
#define INTERNET_MAX_URL_LENGTH
#define ERROR_INTERNET_OPERATION_CANCELLED
#define HTTP_QUERY_FLAG_SYSTEMTIME
#define HTTP_QUERY_ACCEPT
#define INTERNET_FLAG_ASYNC
#define HTTP_QUERY_RAW_HEADERS_CRLF
#define INTERNET_STATUS_REQUEST_SENT
#define INTERNET_FLAG_KEEP_CONNECTION
#define INTERNET_STATUS_COOKIE_RECEIVED
#define INTERNET_STATUS_USER_INPUT_REQUIRED
#define HTTP_QUERY_STATUS_TEXT
#define INTERNET_OPTION_USER_AGENT
#define HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON
#define HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA
#define ERROR_INTERNET_ITEM_NOT_FOUND
#define INTERNET_OPTION_PASSWORD
#define ERROR_INTERNET_SECURITY_CHANNEL_ERROR
#define HTTP_QUERY_USER_AGENT
#define INTERNET_STATUS_SENDING_REQUEST
#define INTERNET_OPTION_DATAFILE_NAME
#define INTERNET_STATUS_PREFETCH
#define INTERNET_ERROR_MASK_LOGIN_FAILURE_DISPLAY_ENTITY_BODY
#define HTTP_QUERY_VERSION
#define HTTP_QUERY_FLAG_NUMBER
#define INTERNET_STATUS_HANDLE_CLOSING
#define ERROR_INTERNET_INVALID_CA
#define ERROR_INTERNET_OPTION_NOT_SETTABLE
#define HTTP_QUERY_FORWARDED
#define INTERNET_FLAG_NEED_FILE
#define INTERNET_STATUS_RESOLVING_NAME
#define INTERNET_PER_CONN_AUTOCONFIG_URL
#define INTERNET_FLAG_NO_CACHE_WRITE
#define INTERNET_FLAG_TRANSFER_BINARY
#define NORMAL_CACHE_ENTRY
#define INTERNET_STATUS_INTERMEDIATE_RESPONSE
#define INTERNET_FLAG_SECURE
#define HTTP_ADDREQ_FLAG_ADD
#define INTERNET_OPTION_URL
#define HTTP_QUERY_ACCEPT_RANGES
#define HTTP_QUERY_CONTENT_TYPE
#define INTERNET_REQFLAG_NO_HEADERS
struct _INTERNET_BUFFERSA INTERNET_BUFFERSA
#define INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT
#define INTERNET_STATUS_RESPONSE_RECEIVED
#define INTERNET_OPEN_TYPE_DIRECT
#define INTERNET_STATUS_REDIRECT
#define HTTP_QUERY_COOKIE
#define INTERNET_OPTION_PROXY
#define INTERNET_STATUS_REQUEST_COMPLETE
#define INTERNET_STATUS_CONNECTING_TO_SERVER
#define HTTP_QUERY_AUTHORIZATION
#define ERROR_INTERNET_INCORRECT_HANDLE_STATE
#define INTERNET_MAX_PATH_LENGTH
#define ERROR_INTERNET_INVALID_OPERATION
#define INTERNET_OPEN_TYPE_PROXY
#define HTTP_QUERY_TRANSFER_ENCODING
#define INTERNET_OPTION_PER_CONNECTION_OPTION
#define INTERNET_INVALID_PORT_NUMBER
#define INTERNET_STATUS_HANDLE_CREATED
#define INTERNET_STATUS_COOKIE_HISTORY
#define HTTP_ADDREQ_FLAG_COALESCE
#define HTTP_QUERY_STATUS_CODE
#define INTERNET_OPEN_TYPE_PRECONFIG
#define INTERNET_STATUS_COOKIE_SENT
#define HTTP_QUERY_RAW_HEADERS
#define SECURITY_FLAG_IGNORE_REVOCATION
#define HTTP_QUERY_CONTENT_ENCODING
#define INTERNET_OPTION_ERROR_MASK
#define HTTP_QUERY_CUSTOM
#define ERROR_INTERNET_INVALID_OPTION
#define ERROR_HTTP_INVALID_SERVER_RESPONSE
#define INTERNET_HANDLE_TYPE_CONNECT_HTTP
#define ERROR_INTERNET_CANNOT_CONNECT
#define HTTP_QUERY_SERVER
#define INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT
#define INTERNET_OPTION_HTTP_VERSION
#define ERROR_HTTP_INVALID_QUERY_REQUEST
#define HTTP_ADDREQ_FLAG_ADD_IF_NEW
#define ERROR_INTERNET_NAME_NOT_RESOLVED
#define ERROR_HTTP_INVALID_HEADER
#define INTERNET_STATUS_CONNECTED_TO_SERVER
#define INTERNET_OPTION_CONTEXT_VALUE
#define INTERNET_STATUS_NAME_RESOLVED
#define INTERNET_OPTION_HANDLE_TYPE
#define INTERNET_FLAG_FORMS_SUBMIT
#define INTERNET_OPTION_SECURITY_CERTIFICATE
#define INTERNET_STATUS_CTL_RESPONSE_RECEIVED
#define ERROR_INTERNET_INCORRECT_HANDLE_TYPE
#define HTTP_QUERY_FLAG_REQUEST_HEADERS
#define INTERNET_STATUS_P3P_HEADER
#define ERROR_INTERNET_SEC_CERT_ERRORS
#define INTERNET_STATUS_CLOSING_CONNECTION
#define INTERNET_OPTION_USERNAME
#define INTERNET_OPTION_HTTP_DECODING
#define INTERNET_STATUS_PRIVACY_IMPACTED
#define INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO
#define INTERNET_OPTION_SETTINGS_CHANGED
#define ERROR_HTTP_HEADER_NOT_FOUND
#define INTERNET_OPTION_END_BROWSER_SESSION
#define INTERNET_STATUS_DETECTING_PROXY
#define HTTP_QUERY_CONTENT_LENGTH
#define INTERNET_OPTION_CALLBACK
#define INTERNET_SERVICE_HTTP
#define INTERNET_OPTION_REQUEST_FLAGS
#define INTERNET_STATUS_P3P_POLICYREF
#define HKEY_CURRENT_USER