mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 04:35:07 +00:00
[WININET_WINETEST] Sync with Wine 3.0. CORE-14225
This commit is contained in:
parent
c95e9203e6
commit
f40fd12dfd
|
@ -115,6 +115,7 @@ static void test_connect(HINTERNET hInternet)
|
||||||
ok ( hFtp != NULL, "InternetConnect failed : %d\n", GetLastError());
|
ok ( hFtp != NULL, "InternetConnect failed : %d\n", GetLastError());
|
||||||
ok ( GetLastError() == ERROR_SUCCESS,
|
ok ( GetLastError() == ERROR_SUCCESS,
|
||||||
"ERROR_SUCCESS, got %d\n", GetLastError());
|
"ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
|
InternetCloseHandle(hFtp);
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", NULL,
|
hFtp = InternetConnectA(hInternet, "ftp.winehq.org", INTERNET_DEFAULT_FTP_PORT, "", NULL,
|
||||||
|
@ -128,6 +129,7 @@ static void test_connect(HINTERNET hInternet)
|
||||||
{
|
{
|
||||||
ok(GetLastError() == ERROR_SUCCESS,
|
ok(GetLastError() == ERROR_SUCCESS,
|
||||||
"Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
"Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
|
InternetCloseHandle(hFtp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -725,7 +725,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
|
||||||
res = InternetQueryOptionA(hor,INTERNET_OPTION_URL,buffer,&length);
|
res = InternetQueryOptionA(hor,INTERNET_OPTION_URL,buffer,&length);
|
||||||
ok(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed with error %d\n", GetLastError());
|
ok(res, "InternetQueryOptionA(INTERNET_OPTION_URL) failed with error %d\n", GetLastError());
|
||||||
|
|
||||||
length = sizeof(buffer)-1;
|
length = sizeof(buffer)-2;
|
||||||
memset(buffer, 0x77, sizeof(buffer));
|
memset(buffer, 0x77, sizeof(buffer));
|
||||||
res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length,0x0);
|
res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length,0x0);
|
||||||
ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
|
ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
|
||||||
|
@ -749,7 +749,7 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
|
||||||
ok(buffer[length2+1] == 0x77, "Expected 0x77, got %02X\n", buffer[length2+1]);
|
ok(buffer[length2+1] == 0x77, "Expected 0x77, got %02X\n", buffer[length2+1]);
|
||||||
ok(length2 == length, "Value should not have changed: %d != %d\n", length2, length);
|
ok(length2 == length, "Value should not have changed: %d != %d\n", length2, length);
|
||||||
|
|
||||||
length = sizeof(wbuffer)-sizeof(WCHAR);
|
length = sizeof(wbuffer)-2*sizeof(WCHAR);
|
||||||
memset(wbuffer, 0x77, sizeof(wbuffer));
|
memset(wbuffer, 0x77, sizeof(wbuffer));
|
||||||
res = HttpQueryInfoW(hor, HTTP_QUERY_RAW_HEADERS, wbuffer, &length, 0x0);
|
res = HttpQueryInfoW(hor, HTTP_QUERY_RAW_HEADERS, wbuffer, &length, 0x0);
|
||||||
ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
|
ok(res, "HttpQueryInfoW(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
|
||||||
|
@ -2057,22 +2057,6 @@ static const char okmsg2[] =
|
||||||
"Set-Cookie: two\r\n"
|
"Set-Cookie: two\r\n"
|
||||||
"\r\n";
|
"\r\n";
|
||||||
|
|
||||||
static const char okmsg_cookie_path[] =
|
|
||||||
"HTTP/1.1 200 OK\r\n"
|
|
||||||
"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n"
|
|
||||||
"Server: winetest\r\n"
|
|
||||||
"Content-Length: 0\r\n"
|
|
||||||
"Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n"
|
|
||||||
"\r\n";
|
|
||||||
|
|
||||||
static const char okmsg_cookie[] =
|
|
||||||
"HTTP/1.1 200 OK\r\n"
|
|
||||||
"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n"
|
|
||||||
"Server: winetest\r\n"
|
|
||||||
"Content-Length: 0\r\n"
|
|
||||||
"Set-Cookie: testcookie=testvalue\r\n"
|
|
||||||
"\r\n";
|
|
||||||
|
|
||||||
static const char notokmsg[] =
|
static const char notokmsg[] =
|
||||||
"HTTP/1.1 400 Bad Request\r\n"
|
"HTTP/1.1 400 Bad Request\r\n"
|
||||||
"Server: winetest\r\n"
|
"Server: winetest\r\n"
|
||||||
|
@ -2116,12 +2100,6 @@ static const char ok_with_length2[] =
|
||||||
"Content-Length: 19\r\n\r\n"
|
"Content-Length: 19\r\n\r\n"
|
||||||
"HTTP/1.1 211 OK\r\n\r\n";
|
"HTTP/1.1 211 OK\r\n\r\n";
|
||||||
|
|
||||||
static const char redir_no_host[] =
|
|
||||||
"HTTP/1.1 302 Found\r\n"
|
|
||||||
"Location: http:///test1\r\n"
|
|
||||||
"Server: winetest\r\n"
|
|
||||||
"\r\n";
|
|
||||||
|
|
||||||
struct server_info {
|
struct server_info {
|
||||||
HANDLE hEvent;
|
HANDLE hEvent;
|
||||||
int port;
|
int port;
|
||||||
|
@ -2297,7 +2275,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
}
|
}
|
||||||
if (strstr(buffer, "/testC"))
|
if (strstr(buffer, "/testC"))
|
||||||
{
|
{
|
||||||
if (strstr(buffer, "cookie=biscuit"))
|
if (strstr(buffer, "Cookie: cookie=biscuit"))
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
send(c, okmsg, sizeof okmsg-1, 0);
|
||||||
else
|
else
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
send(c, notokmsg, sizeof notokmsg-1, 0);
|
||||||
|
@ -2442,51 +2420,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
else
|
else
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
send(c, notokmsg, sizeof notokmsg-1, 0);
|
||||||
}
|
}
|
||||||
if (strstr(buffer, "/test_cookie_path1"))
|
|
||||||
{
|
|
||||||
if (strstr(buffer, "subcookie=data"))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_cookie_path2"))
|
|
||||||
{
|
|
||||||
if (strstr(buffer, "subcookie2=data"))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_cookie_set_path"))
|
|
||||||
{
|
|
||||||
send(c, okmsg_cookie_path, sizeof okmsg_cookie_path-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_cookie_merge"))
|
|
||||||
{
|
|
||||||
if (strstr(buffer, "subcookie=data") &&
|
|
||||||
!strstr(buffer, "manual_cookie=test"))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_cookie_set_host_override"))
|
|
||||||
{
|
|
||||||
send(c, okmsg_cookie, sizeof okmsg_cookie-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_cookie_check_host_override"))
|
|
||||||
{
|
|
||||||
if (strstr(buffer, "Cookie:") && strstr(buffer, "testcookie=testvalue"))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_cookie_check_different_host"))
|
|
||||||
{
|
|
||||||
if (!strstr(buffer, "foo") &&
|
|
||||||
strstr(buffer, "cookie=biscuit"))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, notokmsg, sizeof notokmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "/test_host_override"))
|
if (strstr(buffer, "/test_host_override"))
|
||||||
{
|
{
|
||||||
if (strstr(buffer, host_header_override))
|
if (strstr(buffer, host_header_override))
|
||||||
|
@ -2518,24 +2451,6 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
{
|
{
|
||||||
send(c, okmsg, sizeof(okmsg)-1, 0);
|
send(c, okmsg, sizeof(okmsg)-1, 0);
|
||||||
}
|
}
|
||||||
if (strstr(buffer, "HEAD /test_auth_host1"))
|
|
||||||
{
|
|
||||||
if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzcw=="))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, noauthmsg, sizeof noauthmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "HEAD /test_auth_host2"))
|
|
||||||
{
|
|
||||||
if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzczI="))
|
|
||||||
send(c, okmsg, sizeof okmsg-1, 0);
|
|
||||||
else
|
|
||||||
send(c, noauthmsg, sizeof noauthmsg-1, 0);
|
|
||||||
}
|
|
||||||
if (strstr(buffer, "GET /test_redirect_no_host"))
|
|
||||||
{
|
|
||||||
send(c, redir_no_host, sizeof redir_no_host-1, 0);
|
|
||||||
}
|
|
||||||
shutdown(c, 2);
|
shutdown(c, 2);
|
||||||
closesocket(c);
|
closesocket(c);
|
||||||
c = -1;
|
c = -1;
|
||||||
|
@ -3231,152 +3146,6 @@ static void test_header_override(int port)
|
||||||
test_status_code(req, 400);
|
test_status_code(req, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
InternetSetCookieA("http://localhost", "cookie", "biscuit");
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_set_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
InternetSetCookieA("http://test.local", "foo", "bar");
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
InternetCloseHandle(con);
|
|
||||||
InternetCloseHandle(ses);
|
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
|
||||||
ok(ses != NULL, "InternetOpenA failed\n");
|
|
||||||
|
|
||||||
con = InternetConnectA(ses, "localhost", port, "test1", "pass", INTERNET_SERVICE_HTTP, 0, 0);
|
|
||||||
ok(con != NULL, "InternetConnectA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
req = HttpOpenRequestA( con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
InternetCloseHandle(con);
|
|
||||||
InternetCloseHandle(ses);
|
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
|
||||||
ok(ses != NULL, "InternetOpenA failed\n");
|
|
||||||
|
|
||||||
con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
|
|
||||||
ok(con != NULL, "InternetConnectA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
|
|
||||||
ok( ret, "HttpSendRequestA failed %u\n", GetLastError() );
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
InternetCloseHandle(con);
|
|
||||||
InternetCloseHandle(ses);
|
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
|
||||||
ok(ses != NULL, "InternetOpenA failed\n");
|
|
||||||
|
|
||||||
con = InternetConnectA(ses, "localhost", port, "test1", "pass2", INTERNET_SERVICE_HTTP, 0, 0);
|
|
||||||
ok(con != NULL, "InternetConnectA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
InternetCloseHandle(con);
|
|
||||||
InternetCloseHandle(ses);
|
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
|
||||||
ok(ses != NULL, "InternetOpenA failed\n");
|
|
||||||
|
|
||||||
con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
|
|
||||||
ok(con != NULL, "InternetConnectA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequestA failed %u\n", GetLastError());
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
InternetCloseHandle(req);
|
||||||
InternetCloseHandle(con);
|
InternetCloseHandle(con);
|
||||||
InternetCloseHandle(ses);
|
InternetCloseHandle(ses);
|
||||||
|
@ -3927,68 +3696,6 @@ static void test_cache_read_gzipped(int port)
|
||||||
InternetCloseHandle(con);
|
InternetCloseHandle(con);
|
||||||
InternetCloseHandle(ses);
|
InternetCloseHandle(ses);
|
||||||
|
|
||||||
/* Decompression doesn't work while reading from cache */
|
|
||||||
test_cache_gzip = 0;
|
|
||||||
sprintf(cache_url, cache_url_fmt, port, get_gzip);
|
|
||||||
DeleteUrlCacheEntryA(cache_url);
|
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
|
||||||
ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
ret = InternetSetOptionA(ses, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
|
|
||||||
ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
|
|
||||||
|
|
||||||
con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
|
|
||||||
ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
|
|
||||||
size = 0;
|
|
||||||
while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
|
|
||||||
size += read;
|
|
||||||
ok(size == 10, "read %d bytes of data\n", size);
|
|
||||||
buf[size] = 0;
|
|
||||||
ok(!strncmp(buf, content, size), "incorrect page content: %s\n", buf);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
InternetCloseHandle(con);
|
|
||||||
InternetCloseHandle(ses);
|
|
||||||
|
|
||||||
/* Decompression doesn't work while reading from cache */
|
|
||||||
test_cache_gzip = 0;
|
|
||||||
sprintf(cache_url, cache_url_fmt, port, get_gzip);
|
|
||||||
DeleteUrlCacheEntryA(cache_url);
|
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
|
||||||
ok(ses != NULL,"InternetOpen failed with error %u\n", GetLastError());
|
|
||||||
|
|
||||||
con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
|
|
||||||
ok(con != NULL, "InternetConnect failed with error %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = TRUE;
|
|
||||||
ret = InternetSetOptionA(con, INTERNET_OPTION_HTTP_DECODING, &ret, sizeof(ret));
|
|
||||||
ok(ret, "InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %d\n", GetLastError());
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, get_gzip, NULL, NULL, NULL, 0, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, "Accept-Encoding: gzip", -1, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed with error %u\n", GetLastError());
|
|
||||||
size = 0;
|
|
||||||
while(InternetReadFile(req, buf+size, sizeof(buf)-1-size, &read) && read)
|
|
||||||
size += read;
|
|
||||||
ok(size == 10, "read %d bytes of data\n", size);
|
|
||||||
buf[size] = 0;
|
|
||||||
ok(!strncmp(buf, content, size), "incorrect page content: %s\n", buf);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
InternetCloseHandle(con);
|
|
||||||
InternetCloseHandle(ses);
|
|
||||||
|
|
||||||
DeleteUrlCacheEntryA(cache_url);
|
DeleteUrlCacheEntryA(cache_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4027,7 +3734,7 @@ static void test_cookie_header(int port)
|
||||||
HINTERNET ses, con, req;
|
HINTERNET ses, con, req;
|
||||||
DWORD size, error;
|
DWORD size, error;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
char buffer[256];
|
char buffer[64];
|
||||||
|
|
||||||
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
||||||
ok(ses != NULL, "InternetOpen failed\n");
|
ok(ses != NULL, "InternetOpen failed\n");
|
||||||
|
@ -4055,7 +3762,7 @@ static void test_cookie_header(int port)
|
||||||
size = sizeof(buffer);
|
size = sizeof(buffer);
|
||||||
ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
|
ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
|
||||||
ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
|
ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
|
||||||
ok(!!strstr(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer);
|
ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer);
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
||||||
ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
|
ok(ret, "HttpSendRequest failed: %u\n", GetLastError());
|
||||||
|
@ -4066,61 +3773,9 @@ static void test_cookie_header(int port)
|
||||||
size = sizeof(buffer);
|
size = sizeof(buffer);
|
||||||
ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
|
ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL);
|
||||||
ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
|
ok(ret, "HttpQueryInfo failed: %u\n", GetLastError());
|
||||||
ok(!strstr(buffer, "cookie=not biscuit"), "'%s' should not contain \'cookie=not biscuit\'\n", buffer);
|
ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer);
|
||||||
ok(!!strstr(buffer, "cookie=biscuit"), "'%s' should contain \'cookie=biscuit\'\n", buffer);
|
|
||||||
|
|
||||||
InternetCloseHandle(req);
|
InternetCloseHandle(req);
|
||||||
|
|
||||||
InternetSetCookieA("http://localhost/testCCCC", "subcookie", "data");
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_path1", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_path1/abc", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_set_path", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_path2", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 400);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
req = HttpOpenRequestA(con, NULL, "/test_cookie_merge", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
|
|
||||||
ok(req != NULL, "HttpOpenRequest failed\n");
|
|
||||||
|
|
||||||
ret = HttpAddRequestHeadersA(req, "Cookie: manual_cookie=test\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD);
|
|
||||||
ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError());
|
|
||||||
|
|
||||||
ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
|
|
||||||
ok(ret, "HttpSendRequest failed\n");
|
|
||||||
|
|
||||||
test_status_code(req, 200);
|
|
||||||
InternetCloseHandle(req);
|
|
||||||
|
|
||||||
InternetCloseHandle(con);
|
InternetCloseHandle(con);
|
||||||
InternetCloseHandle(ses);
|
InternetCloseHandle(ses);
|
||||||
}
|
}
|
||||||
|
@ -5798,27 +5453,6 @@ static void test_remove_dot_segments(int port)
|
||||||
close_request(&req);
|
close_request(&req);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_redirect_no_host(int port)
|
|
||||||
{
|
|
||||||
test_request_t req;
|
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
open_simple_request(&req, "localhost", port, NULL, "/test_redirect_no_host");
|
|
||||||
ret = HttpSendRequestA(req.request, NULL, 0, NULL, 0);
|
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
trace("Succeeded with status code 302\n");
|
|
||||||
test_status_code(req.request, 302);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
trace("Failed with error ERROR_INTERNET_INVALID_URL\n");
|
|
||||||
ok(GetLastError() == ERROR_INTERNET_INVALID_URL,
|
|
||||||
"Expected error ERROR_INTERNET_INVALID_URL, got %u\n", GetLastError());
|
|
||||||
}
|
|
||||||
close_request(&req);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_http_connection(void)
|
static void test_http_connection(void)
|
||||||
{
|
{
|
||||||
struct server_info si;
|
struct server_info si;
|
||||||
|
@ -5834,7 +5468,10 @@ static void test_http_connection(void)
|
||||||
r = WaitForSingleObject(si.hEvent, 10000);
|
r = WaitForSingleObject(si.hEvent, 10000);
|
||||||
ok (r == WAIT_OBJECT_0, "failed to start wininet test server\n");
|
ok (r == WAIT_OBJECT_0, "failed to start wininet test server\n");
|
||||||
if (r != WAIT_OBJECT_0)
|
if (r != WAIT_OBJECT_0)
|
||||||
|
{
|
||||||
|
CloseHandle(hThread);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
test_basic_request(si.port, "GET", "/test1");
|
test_basic_request(si.port, "GET", "/test1");
|
||||||
test_proxy_indirect(si.port);
|
test_proxy_indirect(si.port);
|
||||||
|
@ -5885,7 +5522,6 @@ else
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
test_remove_dot_segments(si.port);
|
test_remove_dot_segments(si.port);
|
||||||
test_redirect_no_host(si.port);
|
|
||||||
|
|
||||||
/* send the basic request again to shutdown the server thread */
|
/* send the basic request again to shutdown the server thread */
|
||||||
test_basic_request(si.port, "GET", "/quit");
|
test_basic_request(si.port, "GET", "/quit");
|
||||||
|
@ -5977,6 +5613,18 @@ static void _test_security_info(unsigned line, const char *urlc, DWORD error, DW
|
||||||
ok_(__FILE__,line)(chain != NULL, "chain = NULL\n");
|
ok_(__FILE__,line)(chain != NULL, "chain = NULL\n");
|
||||||
ok_(__FILE__,line)(flags == ex_flags, "flags = %x\n", flags);
|
ok_(__FILE__,line)(flags == ex_flags, "flags = %x\n", flags);
|
||||||
CertFreeCertificateChain(chain);
|
CertFreeCertificateChain(chain);
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = pInternetGetSecurityInfoByURLA(url, NULL, NULL);
|
||||||
|
ok_(__FILE__,line)(!res && GetLastError() == ERROR_INVALID_PARAMETER,
|
||||||
|
"InternetGetSecurityInfoByURLA returned: %x(%u)\n", res, GetLastError());
|
||||||
|
|
||||||
|
res = pInternetGetSecurityInfoByURLA(url, &chain, NULL);
|
||||||
|
ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
|
||||||
|
CertFreeCertificateChain(chain);
|
||||||
|
|
||||||
|
res = pInternetGetSecurityInfoByURLA(url, NULL, &flags);
|
||||||
|
ok_(__FILE__,line)(res, "InternetGetSecurityInfoByURLA failed: %u\n", GetLastError());
|
||||||
}else {
|
}else {
|
||||||
ok_(__FILE__,line)(!res && GetLastError() == error,
|
ok_(__FILE__,line)(!res && GetLastError() == error,
|
||||||
"InternetGetSecurityInfoByURLA returned: %x(%u), expected %u\n", res, GetLastError(), error);
|
"InternetGetSecurityInfoByURLA returned: %x(%u), expected %u\n", res, GetLastError(), error);
|
||||||
|
|
|
@ -566,7 +566,7 @@ static void test_cookie_attrs(void)
|
||||||
DWORD size, state;
|
DWORD size, state;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if(!GetProcAddress(GetModuleHandleA("wininet.dll"), "InternetGetSecurityInfoByURLA")) {
|
if(!GetProcAddress(GetModuleHandleA("wininet.dll"), "DeleteWpadCacheForNetworks")) {
|
||||||
win_skip("Skipping cookie attributes tests. Too old IE.\n");
|
win_skip("Skipping cookie attributes tests. Too old IE.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1166,20 +1166,6 @@ static void test_InternetSetOption(void)
|
||||||
ok(ret == FALSE, "InternetSetOption should've failed\n");
|
ok(ret == FALSE, "InternetSetOption should've failed\n");
|
||||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
|
||||||
|
|
||||||
ret = InternetSetOptionA(req, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
|
|
||||||
ok(ret == TRUE, "InternetSetOption should've succeeded\n");
|
|
||||||
|
|
||||||
ret = InternetSetOptionA(ses, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
|
|
||||||
ok(ret == TRUE, "InternetSetOption should've succeeded\n");
|
|
||||||
|
|
||||||
ret = InternetSetOptionA(ses, INTERNET_OPTION_REFRESH, NULL, 0);
|
|
||||||
ok(ret == TRUE, "InternetSetOption should've succeeded\n");
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
ret = InternetSetOptionA(req, INTERNET_OPTION_REFRESH, NULL, 0);
|
|
||||||
todo_wine ok(ret == FALSE, "InternetSetOption should've failed\n");
|
|
||||||
todo_wine ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
|
|
||||||
|
|
||||||
ret = InternetCloseHandle(req);
|
ret = InternetCloseHandle(req);
|
||||||
ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
|
ok(ret == TRUE, "InternetCloseHandle failed: 0x%08x\n", GetLastError());
|
||||||
ret = InternetCloseHandle(con);
|
ret = InternetCloseHandle(con);
|
||||||
|
|
|
@ -816,9 +816,9 @@ static void InternetCrackUrlW_test(void)
|
||||||
comp.lpszUrlPath = urlpart;
|
comp.lpszUrlPath = urlpart;
|
||||||
comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
|
comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
|
||||||
r = InternetCrackUrlW(url3, 0, ICU_DECODE, &comp);
|
r = InternetCrackUrlW(url3, 0, ICU_DECODE, &comp);
|
||||||
ok(r, "InternetCrackUrlW failed unexpectedly\n");
|
todo_wine ok(r, "InternetCrackUrlW failed unexpectedly\n");
|
||||||
ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host));
|
todo_wine ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host));
|
||||||
todo_wine ok(urlpart[0] == 0, "urlpart should be empty\n");
|
ok(urlpart[0] == 0, "urlpart should be empty\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fill_url_components(URL_COMPONENTSA *lpUrlComponents)
|
static void fill_url_components(URL_COMPONENTSA *lpUrlComponents)
|
||||||
|
|
Loading…
Reference in a new issue