mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[WININET_WINETEST] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
bc01cef03a
commit
a5fc445e71
6 changed files with 398 additions and 62 deletions
|
@ -30,18 +30,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
//#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define WIN32_NO_STATUS
|
#include "windef.h"
|
||||||
#define _INC_WINDOWS
|
#include "winbase.h"
|
||||||
|
#include "wininet.h"
|
||||||
|
#include "winsock2.h"
|
||||||
|
|
||||||
#include <windef.h>
|
#include "wine/test.h"
|
||||||
#include <winbase.h>
|
|
||||||
#include <wininet.h>
|
|
||||||
//#include "winsock.h"
|
|
||||||
|
|
||||||
#include <wine/test.h>
|
|
||||||
|
|
||||||
|
|
||||||
static BOOL (WINAPI *pFtpCommandA)(HINTERNET,BOOL,DWORD,LPCSTR,DWORD_PTR,HINTERNET*);
|
static BOOL (WINAPI *pFtpCommandA)(HINTERNET,BOOL,DWORD,LPCSTR,DWORD_PTR,HINTERNET*);
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
#define WINE_NOWINSOCK
|
#define WINE_NOWINSOCK
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <windef.h>
|
#include "windef.h"
|
||||||
#include <winbase.h>
|
#include "winbase.h"
|
||||||
#include <wininet.h>
|
#include "wininet.h"
|
||||||
#include "wininet_test.h"
|
#include "wininet_test.h"
|
||||||
|
|
||||||
#include <wine/test.h>
|
#include "wine/test.h"
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* Compatibility macros
|
* Compatibility macros
|
||||||
|
|
|
@ -22,20 +22,15 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define WIN32_NO_STATUS
|
#include "windef.h"
|
||||||
#define _INC_WINDOWS
|
#include "winbase.h"
|
||||||
|
#include "wininet.h"
|
||||||
|
#include "winineti.h"
|
||||||
|
#include "winsock2.h"
|
||||||
|
|
||||||
#include <windef.h>
|
#include "wine/test.h"
|
||||||
#include <winbase.h>
|
|
||||||
#include <winreg.h>
|
|
||||||
#include <winnls.h>
|
|
||||||
#include <wincrypt.h>
|
|
||||||
#include <wininet.h>
|
|
||||||
#include <winsock.h>
|
|
||||||
|
|
||||||
#include <wine/test.h>
|
|
||||||
|
|
||||||
/* Undocumented security flags */
|
/* Undocumented security flags */
|
||||||
#define _SECURITY_FLAG_CERT_REV_FAILED 0x00800000
|
#define _SECURITY_FLAG_CERT_REV_FAILED 0x00800000
|
||||||
|
@ -2057,6 +2052,22 @@ 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"
|
||||||
|
@ -2275,7 +2286,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
|
||||||
}
|
}
|
||||||
if (strstr(buffer, "/testC"))
|
if (strstr(buffer, "/testC"))
|
||||||
{
|
{
|
||||||
if (strstr(buffer, "Cookie: cookie=biscuit"))
|
if (strstr(buffer, "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);
|
||||||
|
@ -2420,6 +2431,51 @@ 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))
|
||||||
|
@ -2451,6 +2507,20 @@ 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);
|
||||||
|
}
|
||||||
shutdown(c, 2);
|
shutdown(c, 2);
|
||||||
closesocket(c);
|
closesocket(c);
|
||||||
c = -1;
|
c = -1;
|
||||||
|
@ -3146,6 +3216,152 @@ 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);
|
||||||
|
@ -3696,6 +3912,68 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3734,7 +4012,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[64];
|
char buffer[256];
|
||||||
|
|
||||||
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");
|
||||||
|
@ -3762,7 +4040,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(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer);
|
ok(!!strstr(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());
|
||||||
|
@ -3773,9 +4051,61 @@ 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(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer);
|
ok(!strstr(buffer, "cookie=not biscuit"), "'%s' should not contain \'cookie=not 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,16 +20,15 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include <string.h>
|
#include <string.h>
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "wininet.h"
|
||||||
|
#include "winerror.h"
|
||||||
|
#include "winreg.h"
|
||||||
|
|
||||||
#include <windef.h>
|
#include "wine/test.h"
|
||||||
#include <winbase.h>
|
|
||||||
#include <winuser.h>
|
|
||||||
#include <wininet.h>
|
|
||||||
//#include "winerror.h"
|
|
||||||
#include <winreg.h>
|
|
||||||
|
|
||||||
#include <wine/test.h>
|
|
||||||
|
|
||||||
static BOOL (WINAPI *pCreateUrlCacheContainerA)(DWORD, DWORD, DWORD, DWORD,
|
static BOOL (WINAPI *pCreateUrlCacheContainerA)(DWORD, DWORD, DWORD, DWORD,
|
||||||
DWORD, DWORD, DWORD, DWORD);
|
DWORD, DWORD, DWORD, DWORD);
|
||||||
|
@ -1166,6 +1165,20 @@ 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);
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
//#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
//#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <windef.h>
|
#include "windef.h"
|
||||||
#include <winbase.h>
|
#include "winbase.h"
|
||||||
#include <winnls.h>
|
#include "winnls.h"
|
||||||
#include <wininet.h>
|
#include "wininet.h"
|
||||||
|
|
||||||
#include <wine/test.h>
|
#include "wine/test.h"
|
||||||
|
|
||||||
#define TEST_URL "http://www.winehq.org/site/about#hi"
|
#define TEST_URL "http://www.winehq.org/site/about#hi"
|
||||||
#define TEST_URL3 "file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml"
|
#define TEST_URL3 "file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml"
|
||||||
|
@ -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);
|
||||||
todo_wine ok(r, "InternetCrackUrlW failed unexpectedly\n");
|
ok(r, "InternetCrackUrlW failed unexpectedly\n");
|
||||||
todo_wine ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host));
|
ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host));
|
||||||
ok(urlpart[0] == 0, "urlpart should be empty\n");
|
todo_wine 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)
|
||||||
|
|
|
@ -19,20 +19,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
//#include <stdio.h>
|
#include <stdio.h>
|
||||||
//#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define WIN32_NO_STATUS
|
#include "windef.h"
|
||||||
#define _INC_WINDOWS
|
#include "winbase.h"
|
||||||
#define COM_NO_WINDOWS_H
|
#include "winnls.h"
|
||||||
|
#include "wininet.h"
|
||||||
|
#include "winineti.h"
|
||||||
|
|
||||||
#include <windef.h>
|
#include "wine/test.h"
|
||||||
#include <winbase.h>
|
|
||||||
#include <winnls.h>
|
|
||||||
#include <wininet.h>
|
|
||||||
#include <winineti.h>
|
|
||||||
|
|
||||||
#include <wine/test.h>
|
|
||||||
|
|
||||||
static const char test_url[] = "http://urlcachetest.winehq.org/index.html";
|
static const char test_url[] = "http://urlcachetest.winehq.org/index.html";
|
||||||
static const WCHAR test_urlW[] = {'h','t','t','p',':','/','/','u','r','l','c','a','c','h','e','t','e','s','t','.',
|
static const WCHAR test_urlW[] = {'h','t','t','p',':','/','/','u','r','l','c','a','c','h','e','t','e','s','t','.',
|
||||||
|
|
Loading…
Reference in a new issue