diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c index e2bbb714fe9..435e262d18b 100644 --- a/dlls/winhttp/tests/notification.c +++ b/dlls/winhttp/tests/notification.c @@ -28,12 +28,6 @@ #include "wine/test.h" -static const WCHAR user_agent[] = {'w','i','n','e','t','e','s','t',0}; -static const WCHAR test_winehq[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR tests_hello_html[] = {'/','t','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0}; -static const WCHAR tests_redirect[] = {'/','t','e','s','t','s','/','r','e','d','i','r','e','c','t',0}; -static const WCHAR localhostW[] = {'l','o','c','a','l','h','o','s','t',0}; - enum api { winhttp_connect = 1, @@ -191,7 +185,7 @@ static void test_connection_cache( void ) info.index = 0; info.wait = CreateEventW( NULL, FALSE, FALSE, NULL ); - ses = WinHttpOpen( user_agent, 0, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", 0, NULL, NULL, 0 ); ok(ses != NULL, "failed to open session %u\n", GetLastError()); event = CreateEventW( NULL, FALSE, FALSE, NULL ); @@ -208,11 +202,11 @@ static void test_connection_cache( void ) ok(ret, "failed to set context value %u\n", GetLastError()); setup_test( &info, winhttp_connect, __LINE__ ); - con = WinHttpConnect( ses, test_winehq, 0, 0 ); + con = WinHttpConnect( ses, L"test.winehq.org", 0, 0 ); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); setup_test( &info, winhttp_open_request, __LINE__ ); - req = WinHttpOpenRequest( con, NULL, tests_hello_html, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/hello.html", NULL, NULL, NULL, 0 ); ok(req != NULL, "failed to open a request %u\n", GetLastError()); setup_test( &info, winhttp_send_request, __LINE__ ); @@ -240,7 +234,7 @@ static void test_connection_cache( void ) WaitForSingleObject( info.wait, INFINITE ); setup_test( &info, winhttp_open_request, __LINE__ ); - req = WinHttpOpenRequest( con, NULL, tests_hello_html, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/hello.html", NULL, NULL, NULL, 0 ); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSetOption( req, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) ); @@ -289,7 +283,7 @@ static void test_connection_cache( void ) } - ses = WinHttpOpen( user_agent, 0, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", 0, NULL, NULL, 0 ); ok(ses != NULL, "failed to open session %u\n", GetLastError()); if (unload) @@ -304,11 +298,11 @@ static void test_connection_cache( void ) ok(ret, "failed to set context value %u\n", GetLastError()); setup_test( &info, winhttp_connect, __LINE__ ); - con = WinHttpConnect( ses, test_winehq, 0, 0 ); + con = WinHttpConnect( ses, L"test.winehq.org", 0, 0 ); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); setup_test( &info, winhttp_open_request, __LINE__ ); - req = WinHttpOpenRequest( con, NULL, tests_hello_html, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/hello.html", NULL, NULL, NULL, 0 ); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSetOption( req, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) ); @@ -339,7 +333,7 @@ static void test_connection_cache( void ) WaitForSingleObject( info.wait, INFINITE ); setup_test( &info, winhttp_open_request, __LINE__ ); - req = WinHttpOpenRequest( con, NULL, tests_hello_html, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/hello.html", NULL, NULL, NULL, 0 ); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSetOption( req, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(struct info *) ); @@ -431,7 +425,7 @@ static void test_redirect( void ) info.index = 0; info.wait = CreateEventW( NULL, FALSE, FALSE, NULL ); - ses = WinHttpOpen( user_agent, 0, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", 0, NULL, NULL, 0 ); ok(ses != NULL, "failed to open session %u\n", GetLastError()); WinHttpSetStatusCallback( ses, check_notification, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0 ); @@ -440,11 +434,11 @@ static void test_redirect( void ) ok(ret, "failed to set context value %u\n", GetLastError()); setup_test( &info, winhttp_connect, __LINE__ ); - con = WinHttpConnect( ses, test_winehq, 0, 0 ); + con = WinHttpConnect( ses, L"test.winehq.org", 0, 0 ); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); setup_test( &info, winhttp_open_request, __LINE__ ); - req = WinHttpOpenRequest( con, NULL, tests_redirect, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/redirect", NULL, NULL, NULL, 0 ); ok(req != NULL, "failed to open a request %u\n", GetLastError()); setup_test( &info, winhttp_send_request, __LINE__ ); @@ -512,7 +506,7 @@ static void test_async( void ) info.index = 0; info.wait = CreateEventW( NULL, FALSE, FALSE, NULL ); - ses = WinHttpOpen( user_agent, 0, NULL, NULL, WINHTTP_FLAG_ASYNC ); + ses = WinHttpOpen( L"winetest", 0, NULL, NULL, WINHTTP_FLAG_ASYNC ); ok(ses != NULL, "failed to open session %u\n", GetLastError()); event = CreateEventW( NULL, FALSE, FALSE, NULL ); @@ -536,14 +530,14 @@ static void test_async( void ) setup_test( &info, winhttp_connect, __LINE__ ); SetLastError( 0xdeadbeef ); - con = WinHttpConnect( ses, test_winehq, 0, 0 ); + con = WinHttpConnect( ses, L"test.winehq.org", 0, 0 ); err = GetLastError(); ok(con != NULL, "failed to open a connection %u\n", err); ok(err == ERROR_SUCCESS || broken(err == WSAEINVAL) /* < win7 */, "got %u\n", err); setup_test( &info, winhttp_open_request, __LINE__ ); SetLastError( 0xdeadbeef ); - req = WinHttpOpenRequest( con, NULL, tests_hello_html, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/hello.html", NULL, NULL, NULL, 0 ); err = GetLastError(); ok(req != NULL, "failed to open a request %u\n", err); ok(err == ERROR_SUCCESS, "got %u\n", err); @@ -718,7 +712,7 @@ static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path) ses = WinHttpOpen(NULL, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); req = WinHttpOpenRequest(con, verb, path, NULL, NULL, NULL, 0); @@ -787,14 +781,14 @@ static void open_async_request(int port, struct test_request *req, struct info * info->count = ARRAY_SIZE( open_socket_request_test ); } - req->session = WinHttpOpen( user_agent, 0, NULL, NULL, WINHTTP_FLAG_ASYNC ); + req->session = WinHttpOpen( L"winetest", 0, NULL, NULL, WINHTTP_FLAG_ASYNC ); ok(req->session != NULL, "failed to open session %u\n", GetLastError()); WinHttpSetOption( req->session, WINHTTP_OPTION_CONTEXT_VALUE, &info, sizeof(struct info *) ); WinHttpSetStatusCallback( req->session, check_notification, WINHTTP_CALLBACK_FLAG_ALL_NOTIFICATIONS, 0 ); setup_test( info, winhttp_connect, __LINE__ ); - req->connection = WinHttpConnect( req->session, localhostW, port, 0 ); + req->connection = WinHttpConnect( req->session, L"localhost", port, 0 ); ok(req->connection != NULL, "failed to open a connection %u\n", GetLastError()); setup_test( info, winhttp_open_request, __LINE__ ); @@ -808,10 +802,8 @@ static void open_async_request(int port, struct test_request *req, struct info * static void open_socket_request(int port, struct test_request *req, struct info *info) { - static const WCHAR socketW[] = {'/','s','o','c','k','e','t',0}; - ResetEvent( server_socket_done ); - open_async_request( port, req, info, socketW, FALSE ); + open_async_request( port, req, info, L"/socket", FALSE ); WaitForSingleObject( server_socket_available, INFINITE ); } @@ -951,8 +943,6 @@ static void test_persistent_connection(int port) struct test_request req; struct info info; - static const WCHAR testW[] = {'/','t','e','s','t',0}; - trace("Testing persistent connection...\n"); info.wait = CreateEventW( NULL, FALSE, FALSE, NULL ); @@ -969,7 +959,7 @@ static void test_persistent_connection(int port) close_request( &req, &info, FALSE ); /* chunked connection test */ - open_async_request( port, &req, &info, testW, TRUE ); + open_async_request( port, &req, &info, L"/test", TRUE ); server_read_data( "GET /test HTTP/1.1\r\n" ); server_send_reply( &req, &info, "HTTP/1.1 200 OK\r\n" @@ -983,7 +973,7 @@ static void test_persistent_connection(int port) close_request( &req, &info, FALSE ); /* HTTP/1.1 connections are persistent by default, no additional header is needed */ - open_async_request( port, &req, &info, testW, TRUE ); + open_async_request( port, &req, &info, L"/test", TRUE ); server_read_data( "GET /test HTTP/1.1\r\n" ); server_send_reply( &req, &info, "HTTP/1.1 200 OK\r\n" @@ -994,7 +984,7 @@ static void test_persistent_connection(int port) read_request_data( &req, &info, "xx", FALSE ); close_request( &req, &info, FALSE ); - open_async_request( port, &req, &info, testW, TRUE ); + open_async_request( port, &req, &info, L"/test", TRUE ); server_read_data( "GET /test HTTP/1.1\r\n" ); server_send_reply( &req, &info, "HTTP/1.1 200 OK\r\n" @@ -1011,7 +1001,6 @@ static void test_persistent_connection(int port) START_TEST (notification) { - static const WCHAR quitW[] = {'/','q','u','i','t',0}; struct server_info si; HANDLE thread; DWORD ret; @@ -1040,7 +1029,7 @@ START_TEST (notification) test_persistent_connection( si.port ); /* send the basic request again to shutdown the server thread */ - test_basic_request( si.port, NULL, quitW ); + test_basic_request( si.port, NULL, L"/quit" ); WaitForSingleObject( thread, 3000 ); CloseHandle( thread ); diff --git a/dlls/winhttp/tests/url.c b/dlls/winhttp/tests/url.c index 37a6e4a10b4..35d23c5b083 100644 --- a/dlls/winhttp/tests/url.c +++ b/dlls/winhttp/tests/url.c @@ -33,80 +33,45 @@ static WCHAR username[] = {'u','s','e','r','n','a','m','e',0}; static WCHAR password[] = {'p','a','s','s','w','o','r','d',0}; static WCHAR about[] = {'/','s','i','t','e','/','a','b','o','u','t',0}; static WCHAR query[] = {'?','q','u','e','r','y',0}; -static WCHAR escape[] = {' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>','?','@','[','\\',']','^','_','`','{','|','}','~',0}; +static WCHAR escape[] = {' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',':',';','<','=','>', + '?','@','[','\\',']','^','_','`','{','|','}','~',0}; static WCHAR escape2[] = {'\r',0x1f,' ','\n',0x7f,'\r','\n',0}; static WCHAR escape3[] = {'?','t','e','x','t','=',0xfb00,0}; static WCHAR escape4[] = {'/','t','e','x','t','=',0xfb00,0}; -static const WCHAR url1[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url2[] = {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0}; -static const WCHAR url3[] = - {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url4[] = {'h','t','t','p',':','/','/',0}; -static const WCHAR url5[] = - {'f','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url6[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','2','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url7[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t', - '%','2','0','!','%','2','2','%','2','3','$','%','2','5','&','\'','(',')','*','+',',','-','.','/',':',';','%','3','C','=','%','3','E','?','@','%', - '5','B','%','5','C','%','5','D','%','5','E','_','%','6','0','%','7','B','%','7','C','%','7','D','%','7','E',0}; -static const WCHAR url8[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url9[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','8','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url10[] = - {'h','t','t','p','s',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g',':','4','4','3','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0}; -static const WCHAR url11[] = - {'h','t','t','p',':','/','/','e','x','a','m','p','l','e','.','n','e','t','/','p','a','t','h','?','v','a','r','1','=','e','x','a','m','p','l','e','@','e','x','a','m','p','l','e','.','c','o','m','&','v','a','r','2','=','x','&','v','a','r','3','=','y', 0}; -static const WCHAR url12[] = - {'h','t','t','p','s',':','/','/','t','o','o','l','s','.','g','o','o','g','l','e','.','c','o','m','/','s','e','r','v','i','c','e','/','u','p','d','a','t','e','2','?','w','=','3',':','B','x','D','H','o','W','y','8','e','z','M',0}; -static const WCHAR url13[] = - {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o',' ','g','/','p','a','t','h',' ','w','i','t','h',' ','s','p','a','c','e','s',0}; -static const WCHAR url14[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',0}; -static const WCHAR url15[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','6','5','5','3','6',0}; -static const WCHAR url16[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':','0',0}; -static const WCHAR url17[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',':',0}; -static const WCHAR url18[] = - {'h','t','t','p',':','/','/','%','0','D','%','1','F','%','2','0','%','0','A','%','7','F','%','0','D','%','0','A',0}; -static const WCHAR url19[] = - {'h','t','t','p',':','/','/','?','t','e','x','t','=',0xfb00,0}; -static const WCHAR url20[] = - {'h','t','t','p',':','/','/','/','t','e','x','t','=',0xfb00,0}; -static const WCHAR url21[] = - {'h','t','t','p','s',':','/','/','n','b','a','2','k','1','9','-','w','s','.','2','k','s','p','o','r','t','s','.','c','o','m',':','1','9','1','3','3', - '/','n','b','a','/','v','4','/','A','c','c','o','u','n','t','s','/','g','e','t','_','a','c','c','o','u','n','t','?','x','=','3','7','8','9','5','2', - '6','7','7','5','2','6','5','6','6','3','8','7','6',0}; +static const WCHAR url1[] = L"http://username:password@www.winehq.org/site/about?query"; +static const WCHAR url2[] = L"http://username:"; +static const WCHAR url3[] = L"http://www.winehq.org/site/about?query"; +static const WCHAR url4[] = L"http://"; +static const WCHAR url5[] = L"ftp://username:password@www.winehq.org:80/site/about?query"; +static const WCHAR url6[] = L"http://username:password@www.winehq.org:42/site/about?query"; +static const WCHAR url7[] = L"http://username:password@www.winehq.org/site/about%20!%22%23$%25&'()" + "*+,-./:;%3C=%3E?@%5B%5C%5D%5E_%60%7B%7C%7D%7E"; +static const WCHAR url8[] = L"http://username:password@www.winehq.org:0/site/about?query"; +static const WCHAR url9[] = L"http://username:password@www.winehq.org:80/site/about?query"; +static const WCHAR url10[] = L"https://username:password@www.winehq.org:443/site/about?query"; +static const WCHAR url11[] = L"http://example.net/path?var1=example@example.com&var2=x&var3=y"; +static const WCHAR url12[] = L"https://tools.google.com/service/update2?w=3:BxDHoWy8ezM"; +static const WCHAR url13[] = L"http://winehq.o g/path with spaces"; +static const WCHAR url14[] = L"http://www.winehq.org/test"; +static const WCHAR url15[] = L"http://winehq.org:65536"; +static const WCHAR url16[] = L"http://winehq.org:0"; +static const WCHAR url17[] = L"http://winehq.org:"; +static const WCHAR url18[] = L"http://%0D%1F%20%0A%7F%0D%0A"; +static const WCHAR url19[] = L"http://?text=\xfb00"; +static const WCHAR url20[] = L"http:///text=\xfb00"; +static const WCHAR url21[] = L"https://nba2k19-ws.2ksports.com:19133/nba/v4/Accounts/get_account?x=3789526775265663876"; -static const WCHAR url_k1[] = - {'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d', - '@','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','s','i','t','e','/','a','b','o','u','t',0}; -static const WCHAR url_k2[] = - {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR url_k3[] = - {'h','t','t','p','s',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','p','o','s','t','?',0}; -static const WCHAR url_k4[] = - {'H','T','T','P',':','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR url_k5[] = - {'h','t','t','p',':','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR url_k6[] = - {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR url_k7[] = - {'w','w','w',0}; -static const WCHAR url_k8[] = - {'h','t','t','p',0}; -static const WCHAR url_k9[] = - {'h','t','t','p',':','/','/','w','i','n','e','h','q','?',0}; -static const WCHAR url_k10[] = - {'h','t','t','p',':','/','/','w','i','n','e','h','q','/','p','o','s','t',';','a',0}; +static const WCHAR url_k1[] = L"http://username:password@www.winehq.org/site/about"; +static const WCHAR url_k2[] = L"http://www.winehq.org"; +static const WCHAR url_k3[] = L"https://www.winehq.org/post?"; +static const WCHAR url_k4[] = L"HTTP:www.winehq.org"; +static const WCHAR url_k5[] = L"http:/www.winehq.org"; +static const WCHAR url_k6[] = L"www.winehq.org"; +static const WCHAR url_k7[] = L"www"; +static const WCHAR url_k8[] = L"http"; +static const WCHAR url_k9[] = L"http://winehq?"; +static const WCHAR url_k10[] = L"http://winehq/post;a"; static void fill_url_components( URL_COMPONENTS *uc ) { @@ -427,10 +392,6 @@ static void reset_url_components( URL_COMPONENTS *uc ) static void WinHttpCrackUrl_test( void ) { - static const WCHAR hostnameW[] = - {'w','i','n','e','h','q','.','o',' ','g',0}; - static const WCHAR pathW[] = - {'/','p','a','t','h','%','2','0','w','i','t','h','%','2','0','s','p','a','c','e','s',0}; URL_COMPONENTSW uc; WCHAR scheme[20], user[20], pass[20], host[40], path[80], extra[40]; DWORD error; @@ -758,9 +719,9 @@ static void WinHttpCrackUrl_test( void ) uc.nPort = 0; ret = WinHttpCrackUrl( url13, 0, ICU_ESCAPE|ICU_DECODE, &uc ); ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() ); - ok( !lstrcmpW( uc.lpszHostName, hostnameW ), "unexpected host name\n" ); - ok( !lstrcmpW( uc.lpszUrlPath, pathW ), "unexpected path\n" ); - ok( uc.dwUrlPathLength == lstrlenW(pathW), "got %u\n", uc.dwUrlPathLength ); + ok( !lstrcmpW( uc.lpszHostName, L"winehq.o g" ), "unexpected host name\n" ); + ok( !lstrcmpW( uc.lpszUrlPath, L"/path%20with%20spaces" ), "unexpected path\n" ); + ok( uc.dwUrlPathLength == lstrlenW(L"/path%20with%20spaces"), "got %u\n", uc.dwUrlPathLength ); uc.dwStructSize = sizeof(uc); uc.lpszScheme = NULL; diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c index 83f7809a3c1..ab91940ebb8 100644 --- a/dlls/winhttp/tests/winhttp.c +++ b/dlls/winhttp/tests/winhttp.c @@ -37,12 +37,6 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); -static const WCHAR test_useragent[] = - {'W','i','n','e',' ','R','e','g','r','e','s','s','i','o','n',' ','T','e','s','t',0}; -static const WCHAR test_winehq[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0}; -static const WCHAR test_winehq_https[] = {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',':','4','4','3',0}; -static const WCHAR localhostW[] = {'l','o','c','a','l','h','o','s','t',0}; - static BOOL proxy_active(void) { WINHTTP_PROXY_INFO proxy_info; @@ -72,7 +66,7 @@ static void test_WinHttpQueryOption(void) DWORD feature, size; SetLastError(0xdeadbeef); - session = WinHttpOpen(test_useragent, 0, 0, 0, 0); + session = WinHttpOpen(L"winetest", 0, 0, 0, 0); ok(session != NULL, "WinHttpOpen failed to open session, error %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -150,7 +144,7 @@ static void test_WinHttpQueryOption(void) "expected ERROR_WINHTTP_INCORRECT_HANDLE_TYPE, got %u\n", GetLastError()); SetLastError(0xdeadbeef); - connection = WinHttpConnect(session, test_winehq, INTERNET_DEFAULT_HTTP_PORT, 0); + connection = WinHttpConnect(session, L"test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, 0); ok(connection != NULL, "WinHttpConnect failed to open a connection, error: %u\n", GetLastError()); feature = WINHTTP_DISABLE_COOKIES; @@ -258,7 +252,7 @@ static void test_WinHttpOpenRequest (void) DWORD err; SetLastError(0xdeadbeef); - session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + session = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); err = GetLastError(); ok(session != NULL, "WinHttpOpen failed to open session.\n"); @@ -273,7 +267,7 @@ static void test_WinHttpOpenRequest (void) /* Test with a valid server name */ SetLastError(0xdeadbeef); - connection = WinHttpConnect (session, test_winehq, INTERNET_DEFAULT_HTTP_PORT, 0); + connection = WinHttpConnect (session, L"test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, 0); err = GetLastError(); ok(connection != NULL, "WinHttpConnect failed to open a connection, error: %u.\n", err); ok(err == ERROR_SUCCESS || broken(err == WSAEINVAL) /* < win7 */, "got %u\n", err); @@ -317,21 +311,20 @@ static void test_WinHttpOpenRequest (void) static void test_empty_headers_param(void) { - static const WCHAR empty[] = {0}; HINTERNET ses, con, req; DWORD err; BOOL ret; - ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, test_winehq, 80, 0); + con = WinHttpConnect(ses, L"test.winehq.org", 80, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); - ret = WinHttpSendRequest(req, empty, 0, NULL, 0, 0, 0); + ret = WinHttpSendRequest(req, L"", 0, NULL, 0, 0, 0); err = GetLastError(); if (!ret && (err == ERROR_WINHTTP_CANNOT_CONNECT || err == ERROR_WINHTTP_TIMEOUT)) { @@ -348,12 +341,8 @@ static void test_empty_headers_param(void) static void test_WinHttpSendRequest (void) { - static const WCHAR content_type[] = - {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ','a','p','p','l','i','c','a','t','i','o','n', - '/','x','-','w','w','w','-','f','o','r','m','-','u','r','l','e','n','c','o','d','e','d',0}; - static const WCHAR test_file[] = {'t','e','s','t','s','/','p','o','s','t','.','p','h','p',0}; - static const WCHAR postW[] = {'P','O','S','T',0}; - static CHAR post_data[] = "mode=Test"; + static const WCHAR content_type[] = L"Content-Type: application/x-www-form-urlencoded"; + static char post_data[] = "mode=Test"; static const char test_post[] = "mode => Test\0\n"; HINTERNET session, request, connection; DWORD header_len, optional_len, total_len, bytes_rw, size, err, disable, len; @@ -367,14 +356,14 @@ static void test_WinHttpSendRequest (void) total_len = optional_len = sizeof(post_data); memset(buffer, 0xff, sizeof(buffer)); - session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + session = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); ok(session != NULL, "WinHttpOpen failed to open session.\n"); - connection = WinHttpConnect (session, test_winehq, INTERNET_DEFAULT_HTTP_PORT, 0); + connection = WinHttpConnect (session, L"test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, 0); ok(connection != NULL, "WinHttpConnect failed to open a connection, error: %u.\n", GetLastError()); - request = WinHttpOpenRequest(connection, postW, test_file, NULL, WINHTTP_NO_REFERER, + request = WinHttpOpenRequest(connection, L"POST", L"tests/post.php", NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_BYPASS_PROXY_CACHE); if (request == NULL && GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED) { @@ -388,8 +377,8 @@ static void test_WinHttpSendRequest (void) len = sizeof(method); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_REQUEST_METHOD, NULL, method, &len, NULL); ok(ret, "got %u\n", GetLastError()); - ok(len == lstrlenW(postW) * sizeof(WCHAR), "got %u\n", len); - ok(!lstrcmpW(method, postW), "got %s\n", wine_dbgstr_w(method)); + ok(len == lstrlenW(L"POST") * sizeof(WCHAR), "got %u\n", len); + ok(!lstrcmpW(method, L"POST"), "got %s\n", wine_dbgstr_w(method)); context = 0xdeadbeef; ret = WinHttpSetOption(request, WINHTTP_OPTION_CONTEXT_VALUE, &context, sizeof(context)); @@ -468,9 +457,6 @@ static void test_WinHttpTimeFromSystemTime(void) { BOOL ret; static const SYSTEMTIME time = {2008, 7, 1, 28, 10, 5, 52, 0}; - static const WCHAR expected_string[] = - {'M','o','n',',',' ','2','8',' ','J','u','l',' ','2','0','0','8',' ', - '1','0',':','0','5',':','5','2',' ','G','M','T',0}; WCHAR time_string[WINHTTP_TIME_FORMAT_BUFSIZE+1]; DWORD err; @@ -491,7 +477,7 @@ static void test_WinHttpTimeFromSystemTime(void) err = GetLastError(); ok(ret, "WinHttpTimeFromSystemTime failed: %u\n", err); ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err); - ok(memcmp(time_string, expected_string, sizeof(expected_string)) == 0, + ok(!memcmp(time_string, L"Mon, 28 Jul 2008 10:05:52 GMT", sizeof(L"Mon, 28 Jul 2008 10:05:52 GMT")), "Time string returned did not match expected time string.\n"); } @@ -500,16 +486,10 @@ static void test_WinHttpTimeToSystemTime(void) BOOL ret; SYSTEMTIME time; static const SYSTEMTIME expected_time = {2008, 7, 1, 28, 10, 5, 52, 0}; - static const WCHAR time_string1[] = - {'M','o','n',',',' ','2','8',' ','J','u','l',' ','2','0','0','8',' ', - + '1','0',':','0','5',':','5','2',' ','G','M','T','\n',0}; - static const WCHAR time_string2[] = - {' ','m','o','n',' ','2','8',' ','j','u','l',' ','2','0','0','8',' ', - '1','0',' ','0','5',' ','5','2','\n',0}; DWORD err; SetLastError(0xdeadbeef); - ret = WinHttpTimeToSystemTime(time_string1, NULL); + ret = WinHttpTimeToSystemTime(L"Mon, 28 Jul 2008 10:05:52 GMT\n", NULL); err = GetLastError(); ok(!ret, "WinHttpTimeToSystemTime succeeded\n"); ok(err == ERROR_INVALID_PARAMETER, "got %u\n", err); @@ -521,7 +501,7 @@ static void test_WinHttpTimeToSystemTime(void) ok(err == ERROR_INVALID_PARAMETER, "got %u\n", err); SetLastError(0xdeadbeef); - ret = WinHttpTimeToSystemTime(time_string1, &time); + ret = WinHttpTimeToSystemTime(L"Mon, 28 Jul 2008 10:05:52 GMT\n", &time); err = GetLastError(); ok(ret, "WinHttpTimeToSystemTime failed: %u\n", err); ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err); @@ -529,7 +509,7 @@ static void test_WinHttpTimeToSystemTime(void) "Returned SYSTEMTIME structure did not match expected SYSTEMTIME structure.\n"); SetLastError(0xdeadbeef); - ret = WinHttpTimeToSystemTime(time_string2, &time); + ret = WinHttpTimeToSystemTime(L" mon 28 jul 2008 10 05 52\n", &time); err = GetLastError(); ok(ret, "WinHttpTimeToSystemTime failed: %u\n", err); ok(err == ERROR_SUCCESS || broken(err == 0xdeadbeef) /* < win7 */, "got %u\n", err); @@ -539,78 +519,49 @@ static void test_WinHttpTimeToSystemTime(void) static void test_WinHttpAddHeaders(void) { + static const WCHAR test_header_begin[] = + {'P','O','S','T',' ','/','p','o','s','t','t','e','s','t','.','p','h','p',' ','H','T','T','P','/','1'}; HINTERNET session, request, connection; BOOL ret, reverse; WCHAR buffer[MAX_PATH]; WCHAR check_buffer[MAX_PATH]; DWORD err, index, len, oldlen; - static const WCHAR test_file[] = {'/','p','o','s','t','t','e','s','t','.','p','h','p',0}; - static const WCHAR test_verb[] = {'P','O','S','T',0}; - static const WCHAR test_header_begin[] = - {'P','O','S','T',' ','/','p','o','s','t','t','e','s','t','.','p','h','p',' ','H','T','T','P','/','1'}; - static const WCHAR full_path_test_header_begin[] = - {'P','O','S','T',' ','h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',':','8','0', - '/','p','o','s','t','t','e','s','t','.','p','h','p',' ','H','T','T','P','/','1'}; - static const WCHAR test_header_end[] = {'\r','\n','\r','\n',0}; - static const WCHAR test_header_name[] = {'W','a','r','n','i','n','g',0}; - static const WCHAR test_header_name2[] = {'n','a','m','e',0}; - static const WCHAR test_header_name3[] = {'a',0}; - static const WCHAR test_header_range[] = {'R','a','n','g','e',0}; - static const WCHAR test_header_range_bytes[] = {'R','a','n','g','e',':',' ','b','y','t','e','s','=','0','-','7','7','3','\r','\n',0}; - static const WCHAR test_header_bytes[] = {'b','y','t','e','s','=','0','-','7','7','3',0}; - - static const WCHAR test_flag_coalesce[] = {'t','e','s','t','2',',',' ','t','e','s','t','4',0}; - static const WCHAR test_flag_coalesce_reverse[] = {'t','e','s','t','3',',',' ','t','e','s','t','4',0}; - static const WCHAR test_flag_coalesce_comma[] = - {'t','e','s','t','2',',',' ','t','e','s','t','4',',',' ','t','e','s','t','5',0}; - static const WCHAR test_flag_coalesce_comma_reverse[] = - {'t','e','s','t','3',',',' ','t','e','s','t','4',',',' ','t','e','s','t','5',0}; - static const WCHAR test_flag_coalesce_semicolon[] = - {'t','e','s','t','2',',',' ','t','e','s','t','4',',',' ','t','e','s','t','5',';',' ','t','e','s','t','6',0}; - static const WCHAR test_flag_coalesce_semicolon_reverse[] = - {'t','e','s','t','3',',',' ','t','e','s','t','4',',',' ','t','e','s','t','5',';',' ','t','e','s','t','6',0}; - - static const WCHAR field[] = {'f','i','e','l','d',0}; - static const WCHAR value[] = {'v','a','l','u','e',' ',0}; - static const WCHAR value_nospace[] = {'v','a','l','u','e',0}; - static const WCHAR empty[] = {0}; - static const WCHAR test_headers[][14] = - { - {'W','a','r','n','i','n','g',':','t','e','s','t','1',0}, - {'W','a','r','n','i','n','g',':','t','e','s','t','2',0}, - {'W','a','r','n','i','n','g',':','t','e','s','t','3',0}, - {'W','a','r','n','i','n','g',':','t','e','s','t','4',0}, - {'W','a','r','n','i','n','g',':','t','e','s','t','5',0}, - {'W','a','r','n','i','n','g',':','t','e','s','t','6',0}, - {'W','a','r','n','i','n','g',':','t','e','s','t','7',0}, - {0}, - {':',0}, - {'a',':',0}, - {':','b',0}, - {'c','d',0}, - {' ','e',' ',':','f',0}, - {'f','i','e','l','d',':',' ','v','a','l','u','e',' ',0}, - {'n','a','m','e',':',' ','v','a','l','u','e',0}, - {'n','a','m','e',':',0} - }; + { + L"Warning:test1", + L"Warning:test2", + L"Warning:test3", + L"Warning:test4", + L"Warning:test5", + L"Warning:test6", + L"Warning:test7", + L"", + L":", + L"a:", + L":b", + L"cd", + L" e :f", + L"field: value ", + L"name: value", + L"name:", + }; static const WCHAR test_indices[][6] = - { - {'t','e','s','t','1',0}, - {'t','e','s','t','2',0}, - {'t','e','s','t','3',0}, - {'t','e','s','t','4',0} - }; + { + L"test1", + L"test2", + L"test3", + L"test4", + }; - session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, + session = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); ok(session != NULL, "WinHttpOpen failed to open session.\n"); - connection = WinHttpConnect (session, test_winehq, INTERNET_DEFAULT_HTTP_PORT, 0); + connection = WinHttpConnect (session, L"test.winehq.org", INTERNET_DEFAULT_HTTP_PORT, 0); ok(connection != NULL, "WinHttpConnect failed to open a connection, error: %u.\n", GetLastError()); - request = WinHttpOpenRequest(connection, test_verb, test_file, NULL, WINHTTP_NO_REFERER, + request = WinHttpOpenRequest(connection, L"POST", L"/posttest.php", NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); if (request == NULL && GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED) { @@ -622,7 +573,7 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded, found 'Warning' header.\n"); SetLastError(0xdeadbeef); ret = WinHttpAddRequestHeaders(request, test_headers[0], -1L, WINHTTP_ADDREQ_FLAG_ADD); @@ -633,14 +584,15 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed: header index not incremented\n"); - ok(memcmp(buffer, test_indices[0], sizeof(test_indices[0])) == 0, "WinHttpQueryHeaders failed: incorrect string returned\n"); + ok(!memcmp(buffer, test_indices[0], sizeof(test_indices[0])), + "WinHttpQueryHeaders failed: incorrect string returned\n"); ok(len == 5*sizeof(WCHAR), "WinHttpQueryHeaders failed: invalid length returned, expected 5, got %d\n", len); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded, second index should not exist.\n"); /* Try to fetch the header info with a buffer that's big enough to fit the @@ -651,7 +603,7 @@ static void test_WinHttpAddHeaders(void) memset(check_buffer, 0xab, sizeof(check_buffer)); memcpy(buffer, check_buffer, sizeof(buffer)); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded with a buffer that's too small.\n"); ok(memcmp(buffer, check_buffer, sizeof(buffer)) == 0, "WinHttpQueryHeaders failed, modified the buffer when it should not have.\n"); @@ -662,7 +614,7 @@ static void test_WinHttpAddHeaders(void) len = sizeof(buffer); SetLastError(0xdeadbeef); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, NULL, &len, &index); + L"Warning", NULL, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError()); ok(len > 40, "WinHttpQueryHeaders returned invalid length: expected greater than 40, got %d\n", len); @@ -673,7 +625,7 @@ static void test_WinHttpAddHeaders(void) len = 10; SetLastError(0xdeadbeef); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, NULL, &len, &index); + L"Warning", NULL, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError()); @@ -684,7 +636,7 @@ static void test_WinHttpAddHeaders(void) len = 0; SetLastError(0xdeadbeef); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, NULL, &len, &index); + L"Warning", NULL, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError()); @@ -697,15 +649,14 @@ static void test_WinHttpAddHeaders(void) len = sizeof(buffer); memset(buffer, 0xff, sizeof(buffer)); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS_CRLF | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: got %d\n", ret); ok(len + sizeof(WCHAR) <= oldlen, "WinHttpQueryHeaders resulting length longer than advertized.\n"); - ok((len < sizeof(buffer) - sizeof(WCHAR)) && buffer[len / sizeof(WCHAR)] == 0, "WinHttpQueryHeaders did not append NULL terminator\n"); + ok((len < sizeof(buffer) - sizeof(WCHAR)) && !buffer[len / sizeof(WCHAR)], + "WinHttpQueryHeaders did not append NULL terminator\n"); ok(len == lstrlenW(buffer) * sizeof(WCHAR), "WinHttpQueryHeaders returned incorrect length.\n"); - ok(memcmp(buffer, test_header_begin, sizeof(test_header_begin)) == 0 || - memcmp(buffer, full_path_test_header_begin, sizeof(full_path_test_header_begin)) == 0, - "WinHttpQueryHeaders returned invalid beginning of header string.\n"); - ok(memcmp(buffer + lstrlenW(buffer) - 4, test_header_end, sizeof(test_header_end)) == 0, + ok(!memcmp(buffer, test_header_begin, sizeof(test_header_begin)), "invalid beginning of header string.\n"); + ok(!memcmp(buffer + lstrlenW(buffer) - 4, L"\r\n\r\n", sizeof(L"\r\n\r\n")), "WinHttpQueryHeaders returned invalid end of header string.\n"); ok(index == 0, "WinHttpQueryHeaders incremented header index.\n"); @@ -713,7 +664,7 @@ static void test_WinHttpAddHeaders(void) len = 0; SetLastError(0xdeadbeef); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, NULL, &len, &index); + L"Warning", NULL, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders unexpectedly succeeded.\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "WinHttpQueryHeaders set incorrect error: expected ERROR_INSUFFICIENT_BUFFER, got %u\n", GetLastError()); @@ -725,14 +676,12 @@ static void test_WinHttpAddHeaders(void) len = sizeof(buffer); memset(buffer, 0xff, sizeof(buffer)); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_RAW_HEADERS | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed %u\n", GetLastError()); ok(len + sizeof(WCHAR) <= oldlen, "resulting length longer than advertized\n"); ok((len < sizeof(buffer) - sizeof(WCHAR)) && !buffer[len / sizeof(WCHAR)] && !buffer[len / sizeof(WCHAR) - 1], "no double NULL terminator\n"); - ok(memcmp(buffer, test_header_begin, sizeof(test_header_begin)) == 0 || - memcmp(buffer, full_path_test_header_begin, sizeof(full_path_test_header_begin)) == 0, - "invalid beginning of header string.\n"); + ok(!memcmp(buffer, test_header_begin, sizeof(test_header_begin)), "invalid beginning of header string.\n"); ok(index == 0, "header index was incremented\n"); /* tests for more indices */ @@ -742,14 +691,14 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); ok(memcmp(buffer, test_indices[0], sizeof(test_indices[0])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); ok(memcmp(buffer, test_indices[1], sizeof(test_indices[1])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); @@ -760,18 +709,20 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); reverse = (memcmp(buffer, test_indices[1], sizeof(test_indices[1])) != 0); /* Win7 returns values in reverse order of adding */ - ok(memcmp(buffer, test_indices[reverse ? 2 : 1], sizeof(test_indices[reverse ? 2 : 1])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 2 : 1], sizeof(test_indices[reverse ? 2 : 1])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])), + "WinHttpQueryHeaders returned incorrect string.\n"); /* add if new flag */ ret = WinHttpAddRequestHeaders(request, test_headers[3], -1L, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW); @@ -780,21 +731,23 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 2 : 1], sizeof(test_indices[reverse ? 2 : 1])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 2 : 1], sizeof(test_indices[reverse ? 2 : 1])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders succeeded unexpectedly, found third header.\n"); /* coalesce flag */ @@ -804,22 +757,24 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, reverse ? test_flag_coalesce_reverse : test_flag_coalesce, - reverse ? sizeof(test_flag_coalesce_reverse) : sizeof(test_flag_coalesce)) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, reverse ? L"test3, test4" : L"test2, test4", + reverse ? sizeof(L"test3, test4") : sizeof(L"test2, test4")), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders succeeded unexpectedly, found third header.\n"); /* coalesce with comma flag */ @@ -829,23 +784,25 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, reverse ? test_flag_coalesce_comma_reverse : test_flag_coalesce_comma, - reverse ? sizeof(test_flag_coalesce_comma_reverse) : sizeof(test_flag_coalesce_comma)) == 0, + + ok(!memcmp(buffer, reverse ? L"test3, test4, test5" : L"test2, test4, test5", + reverse ? sizeof(L"test3, test4, test5") : sizeof(L"test2, test4, test5")), "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders succeeded unexpectedly, found third header.\n"); @@ -856,23 +813,25 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, reverse ? test_flag_coalesce_semicolon_reverse : test_flag_coalesce_semicolon, - reverse ? sizeof(test_flag_coalesce_semicolon_reverse) : sizeof(test_flag_coalesce_semicolon)) == 0, - "WinHttpQueryHeaders returned incorrect string.\n"); + + ok(!memcmp(buffer, reverse ? L"test3, test4, test5; test6" : L"test2, test4, test5; test6", + reverse ? sizeof(L"test3, test4, test5; test6") : sizeof(L"test2, test4, test5; test6")), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 1 : 2], sizeof(test_indices[reverse ? 1 : 2])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders succeeded unexpectedly, found third header.\n"); /* add and replace flags */ @@ -882,21 +841,23 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 1, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 3 : 2], sizeof(test_indices[reverse ? 3 : 2])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 3 : 2], sizeof(test_indices[reverse ? 3 : 2])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == TRUE, "WinHttpQueryHeaders failed: %u\n", GetLastError()); ok(index == 2, "WinHttpQueryHeaders failed to increment index.\n"); - ok(memcmp(buffer, test_indices[reverse ? 1 : 3], sizeof(test_indices[reverse ? 1 : 3])) == 0, "WinHttpQueryHeaders returned incorrect string.\n"); + ok(!memcmp(buffer, test_indices[reverse ? 1 : 3], sizeof(test_indices[reverse ? 1 : 3])), + "WinHttpQueryHeaders returned incorrect string.\n"); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name, buffer, &len, &index); + L"Warning", buffer, &len, &index); ok(ret == FALSE, "WinHttpQueryHeaders succeeded unexpectedly, found third header.\n"); ret = WinHttpAddRequestHeaders(request, test_headers[8], ~0u, WINHTTP_ADDREQ_FLAG_ADD); @@ -909,9 +870,9 @@ static void test_WinHttpAddHeaders(void) memset(buffer, 0xff, sizeof(buffer)); len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name3, buffer, &len, &index); + L"a", buffer, &len, &index); ok(ret, "WinHttpQueryHeaders failed: %u\n", GetLastError()); - ok(!memcmp(buffer, empty, sizeof(empty)), "unexpected result\n"); + ok(!memcmp(buffer, L"", sizeof(L"")), "unexpected result\n"); ret = WinHttpAddRequestHeaders(request, test_headers[10], ~0u, WINHTTP_ADDREQ_FLAG_ADD); ok(!ret, "WinHttpAddRequestHeaders failed\n"); @@ -929,34 +890,34 @@ static void test_WinHttpAddHeaders(void) buffer[0] = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - field, buffer, &len, &index); + L"field", buffer, &len, &index); ok(ret, "WinHttpQueryHeaders failed: %u\n", GetLastError()); - ok(!memcmp(buffer, value, sizeof(value)) || ! memcmp(buffer, value_nospace, sizeof(value_nospace)), "unexpected result\n"); + ok(!memcmp(buffer, L"value ", sizeof(L"value ")) || !memcmp(buffer, L"value", sizeof(L"value")), + "unexpected result\n"); SetLastError(0xdeadbeef); - ret = WinHttpAddRequestHeaders(request, test_header_range_bytes, 0, + ret = WinHttpAddRequestHeaders(request, L"Range: bytes=0-773\r\n", 0, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE); err = GetLastError(); ok(!ret, "unexpected success\n"); ok(err == ERROR_INVALID_PARAMETER, "got %u\n", err); - ret = WinHttpAddRequestHeaders(request, test_header_range_bytes, ~0u, + ret = WinHttpAddRequestHeaders(request, L"Range: bytes=0-773\r\n", ~0u, WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE); ok(ret, "failed to add header: %u\n", GetLastError()); index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_range, buffer, &len, &index); + L"Range", buffer, &len, &index); ok(ret, "failed to get range header %u\n", GetLastError()); - ok(!memcmp(buffer, test_header_bytes, sizeof(test_header_bytes)), "incorrect string returned\n"); - ok(len == lstrlenW(test_header_bytes) * sizeof(WCHAR), "wrong length %u\n", len); + ok(!memcmp(buffer, L"bytes=0-773", sizeof(L"bytes=0-773")), "incorrect string returned\n"); + ok(len == lstrlenW(L"bytes=0-773") * sizeof(WCHAR), "wrong length %u\n", len); ok(index == 1, "wrong index %u\n", index); - index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name2, buffer, &len, &index); + L"name", buffer, &len, &index); ok(!ret, "unexpected success\n"); SetLastError(0xdeadbeef); @@ -971,10 +932,10 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name2, buffer, &len, &index); + L"name", buffer, &len, &index); ok(ret, "got %u\n", GetLastError()); ok(index == 1, "wrong index %u\n", index); - ok(!memcmp(buffer, value_nospace, sizeof(value_nospace)), "incorrect string\n"); + ok(!memcmp(buffer, L"value", sizeof(L"value")), "incorrect string\n"); ret = WinHttpAddRequestHeaders(request, test_headers[15], ~0u, WINHTTP_ADDREQ_FLAG_REPLACE); ok(ret, "got %u\n", GetLastError()); @@ -983,7 +944,7 @@ static void test_WinHttpAddHeaders(void) len = sizeof(buffer); SetLastError(0xdeadbeef); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name2, buffer, &len, &index); + L"name", buffer, &len, &index); err = GetLastError(); ok(!ret, "unexpected success\n"); ok(err == ERROR_WINHTTP_HEADER_NOT_FOUND, "got %u\n", err); @@ -994,10 +955,10 @@ static void test_WinHttpAddHeaders(void) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - test_header_name2, buffer, &len, &index); + L"name", buffer, &len, &index); ok(ret, "got %u\n", GetLastError()); ok(index == 1, "wrong index %u\n", index); - ok(!memcmp(buffer, value_nospace, sizeof(value_nospace)), "incorrect string\n"); + ok(!memcmp(buffer, L"value", sizeof(L"value")), "incorrect string\n"); ret = WinHttpCloseHandle(request); ok(ret == TRUE, "WinHttpCloseHandle failed on closing request, got %d.\n", ret); @@ -1039,7 +1000,7 @@ static void test_secure_connection(void) WINHTTP_CERTIFICATE_INFO info; char buffer[32]; - ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); policy = WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS; @@ -1051,7 +1012,7 @@ static void test_secure_connection(void) err = GetLastError(); ok(ret || err == ERROR_INVALID_PARAMETER /* < win7 */, "failed to set protocols %u\n", err); - con = WinHttpConnect(ses, test_winehq, 443, 0); + con = WinHttpConnect(ses, L"test.winehq.org", 443, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); SetLastError( 0xdeadbeef ); @@ -1212,16 +1173,15 @@ cleanup: static void test_request_parameter_defaults(void) { - static const WCHAR empty[] = {0}; HINTERNET ses, con, req; DWORD size, status, error; WCHAR *version; BOOL ret; - ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, test_winehq, 0, 0); + con = WinHttpConnect(ses, L"test.winehq.org", 0, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0); @@ -1247,7 +1207,7 @@ static void test_request_parameter_defaults(void) WinHttpCloseHandle(req); - req = WinHttpOpenRequest(con, empty, empty, empty, NULL, NULL, 0); + req = WinHttpOpenRequest(con, L"", L"", L"", NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -1440,7 +1400,7 @@ static void test_timeouts(void) DWORD value, size; HINTERNET ses, req, con; - ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -1601,7 +1561,7 @@ static void test_timeouts(void) ok(ret, "%u\n", GetLastError()); ok(value == 0xbeefdead, "Expected 0xbeefdead, got %u\n", value); - con = WinHttpConnect(ses, test_winehq, 0, 0); + con = WinHttpConnect(ses, L"test.winehq.org", 0, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); /* Timeout values should match the last one set for session */ @@ -2094,22 +2054,20 @@ static void test_timeouts(void) static void test_resolve_timeout(void) { - static const WCHAR nxdomain[] = - {'n','x','d','o','m','a','i','n','.','w','i','n','e','h','q','.','o','r','g',0}; HINTERNET ses, con, req; DWORD timeout; BOOL ret; if (! proxy_active()) { - ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); timeout = 10000; ret = WinHttpSetOption(ses, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeout, sizeof(timeout)); ok(ret, "failed to set resolve timeout %u\n", GetLastError()); - con = WinHttpConnect(ses, nxdomain, 0, 0); + con = WinHttpConnect(ses, L"nxdomain.winehq.org", 0, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0); @@ -2137,14 +2095,14 @@ static void test_resolve_timeout(void) else skip("Skipping host resolution tests, host resolution performed by proxy\n"); - ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", 0, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); timeout = 10000; ret = WinHttpSetOption(ses, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeout, sizeof(timeout)); ok(ret, "failed to set resolve timeout %u\n", GetLastError()); - con = WinHttpConnect(ses, test_winehq, 0, 0); + con = WinHttpConnect(ses, L"test.winehq.org", 0, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0); @@ -2448,15 +2406,13 @@ static DWORD CALLBACK server_thread(LPVOID param) static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path) { - static const WCHAR test_header_end_clrf[] = {'\r','\n','\r','\n',0}; - static const WCHAR test_header_end_raw[] = {0,0}; HINTERNET ses, con, req; char buffer[0x100]; WCHAR buffer2[0x100]; DWORD count, status, size, error, supported, first, target; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -2467,7 +2423,7 @@ static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path) ret = WinHttpQueryOption(ses, 0, buffer, &size); ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "got %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -2515,14 +2471,14 @@ static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path) memset(buffer2, 0, sizeof(buffer2)); ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_RAW_HEADERS_CRLF, NULL, buffer2, &size, NULL); ok(ret, "failed to query for raw headers: %u\n", GetLastError()); - ok(!memcmp(buffer2 + lstrlenW(buffer2) - 4, test_header_end_clrf, sizeof(test_header_end_clrf)), + ok(!memcmp(buffer2 + lstrlenW(buffer2) - 4, L"\r\n\r\n", sizeof(L"\r\n\r\n")), "WinHttpQueryHeaders returned invalid end of header string\n"); size = sizeof(buffer2); memset(buffer2, 0, sizeof(buffer2)); ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_RAW_HEADERS, NULL, buffer2, &size, NULL); ok(ret, "failed to query for raw headers: %u\n", GetLastError()); - ok(!memcmp(buffer2 + (size / sizeof(WCHAR)) - 1, test_header_end_raw, sizeof(test_header_end_raw)), + ok(!memcmp(buffer2 + (size / sizeof(WCHAR)) - 1, L"", sizeof(L"")), "WinHttpQueryHeaders returned invalid end of header string\n"); ok(buffer2[(size / sizeof(WCHAR)) - 2] != 0, "returned string has too many NULL characters\n"); @@ -2540,23 +2496,18 @@ static void test_basic_request(int port, const WCHAR *verb, const WCHAR *path) static void test_basic_authentication(int port) { - static const WCHAR authW[] = {'/','a','u','t','h',0}; - static const WCHAR auth_with_credsW[] = {'/','a','u','t','h','_','w','i','t','h','_','c','r','e','d','s',0}; - static WCHAR userW[] = {'u','s','e','r',0}; - static WCHAR passW[] = {'p','w','d',0}; - static WCHAR pass2W[] = {'p','w','d','2',0}; HINTERNET ses, con, req; DWORD status, size, error, supported, first, target; char buffer[32]; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, authW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"/auth", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); SetLastError(0xdeadbeef); @@ -2665,18 +2616,18 @@ static void test_basic_authentication(int port) ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error); SetLastError(0xdeadbeef); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, userW, NULL, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, L"user", NULL, NULL); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error); SetLastError(0xdeadbeef); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, NULL, passW, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, NULL, L"pwd", NULL); error = GetLastError(); ok(!ret, "expected failure\n"); ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, userW, passW, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, L"user", L"pwd", NULL); ok(ret, "failed to set credentials %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -2706,16 +2657,16 @@ static void test_basic_authentication(int port) WinHttpCloseHandle(ses); /* now set the credentials first to show that they get sent with the first request */ - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, auth_with_credsW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"/auth_with_creds", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, userW, passW, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, L"user", L"pwd", NULL); ok(ret, "failed to set credentials %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -2746,22 +2697,22 @@ static void test_basic_authentication(int port) /* credentials set with WinHttpSetCredentials take precedence over those set through options */ - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, authW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"/auth", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, userW, passW, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, L"user", L"pwd", NULL); ok(ret, "failed to set credentials %u\n", GetLastError()); - ret = WinHttpSetOption(req, WINHTTP_OPTION_USERNAME, userW, lstrlenW(userW)); + ret = WinHttpSetOption(req, WINHTTP_OPTION_USERNAME, (void *)L"user", lstrlenW(L"user")); ok(ret, "failed to set username %u\n", GetLastError()); - ret = WinHttpSetOption(req, WINHTTP_OPTION_PASSWORD, pass2W, lstrlenW(pass2W)); + ret = WinHttpSetOption(req, WINHTTP_OPTION_PASSWORD, (void *)L"pwd2", lstrlenW(L"pwd2")); ok(ret, "failed to set password %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -2780,22 +2731,22 @@ static void test_basic_authentication(int port) WinHttpCloseHandle(con); WinHttpCloseHandle(ses); - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, authW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"/auth", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); - ret = WinHttpSetOption(req, WINHTTP_OPTION_USERNAME, userW, lstrlenW(userW)); + ret = WinHttpSetOption(req, WINHTTP_OPTION_USERNAME, (void *)L"user", lstrlenW(L"user")); ok(ret, "failed to set username %u\n", GetLastError()); - ret = WinHttpSetOption(req, WINHTTP_OPTION_PASSWORD, passW, lstrlenW(passW)); + ret = WinHttpSetOption(req, WINHTTP_OPTION_PASSWORD, (void *)L"pwd", lstrlenW(L"pwd")); ok(ret, "failed to set password %u\n", GetLastError()); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, userW, pass2W, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC, L"user", L"pwd2", NULL); ok(ret, "failed to set credentials %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -2817,22 +2768,18 @@ static void test_basic_authentication(int port) static void test_multi_authentication(int port) { - static const WCHAR multiauthW[] = {'/','m','u','l','t','i','a','u','t','h',0}; - static const WCHAR www_authenticateW[] = - {'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',0}; - static const WCHAR getW[] = {'G','E','T',0}; HINTERNET ses, con, req; DWORD supported, first, target, size, index; WCHAR buf[512]; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, getW, multiauthW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, L"GET", L"/multiauth", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, WINHTTP_NO_ADDITIONAL_HEADERS, 0, @@ -2851,7 +2798,7 @@ static void test_multi_authentication(int port) index = 0; size = sizeof(buf); - ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_CUSTOM, www_authenticateW, buf, &size, &index); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_CUSTOM, L"WWW-Authenticate", buf, &size, &index); ok(ret, "expected success\n"); ok(!lstrcmpW(buf, L"Bearer"), "buf = %s\n", wine_dbgstr_w(buf)); ok(size == lstrlenW(buf) * sizeof(WCHAR), "size = %u\n", size); @@ -2859,7 +2806,7 @@ static void test_multi_authentication(int port) index = 0; size = 0xdeadbeef; - ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_CUSTOM, www_authenticateW, NULL, &size, &index); + ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_CUSTOM, L"WWW-Authenticate", NULL, &size, &index); ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "WinHttpQueryHeaders returned %x(%u)\n", ret, GetLastError()); ok(size == (lstrlenW(buf) + 1) * sizeof(WCHAR), "size = %u\n", size); @@ -2872,21 +2819,17 @@ static void test_multi_authentication(int port) static void test_large_data_authentication(int port) { - static const WCHAR largeauthW[] = {'/','l','a','r','g','e','a','u','t','h',0}; - static const WCHAR getW[] = {'G','E','T',0}; - static WCHAR userW[] = {'u','s','e','r',0}; - static WCHAR passW[] = {'p','w','d',0}; HINTERNET ses, con, req; DWORD status, size; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, getW, largeauthW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, L"GET", L"/largeauth", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0); @@ -2901,7 +2844,7 @@ static void test_large_data_authentication(int port) ok(ret, "expected success\n"); ok(status == HTTP_STATUS_DENIED, "got %d\n", status); - ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_NTLM, userW, passW, NULL); + ret = WinHttpSetCredentials(req, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_NTLM, L"user", L"pwd", NULL); ok(ret, "expected success\n"); ret = WinHttpSendRequest(req, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0); @@ -2923,18 +2866,17 @@ static void test_large_data_authentication(int port) static void test_no_headers(int port) { - static const WCHAR no_headersW[] = {'/','n','o','_','h','e','a','d','e','r','s',0}; HINTERNET ses, con, req; DWORD error; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, no_headersW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"/no_headers", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -2959,19 +2901,18 @@ static void test_no_headers(int port) static void test_no_content(int port) { - static const WCHAR no_contentW[] = {'/','n','o','_','c','o','n','t','e','n','t',0}; HINTERNET ses, con, req; char buf[128]; DWORD size, len = sizeof(buf), bytes_read, status; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, no_contentW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"/no_content", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); size = 12345; @@ -3043,20 +2984,18 @@ static void test_no_content(int port) static void test_head_request(int port) { - static const WCHAR verbW[] = {'H','E','A','D',0}; - static const WCHAR headW[] = {'/','h','e','a','d',0}; HINTERNET ses, con, req; char buf[128]; DWORD size, len, count, status; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, verbW, headW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, L"HEAD", L"/head", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -3102,27 +3041,24 @@ static void test_head_request(int port) static void test_not_modified(int port) { - static const WCHAR pathW[] = {'/','n','o','t','_','m','o','d','i','f','i','e','d',0}; - static const WCHAR ifmodifiedW[] = {'I','f','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',':',' '}; - static const WCHAR ifmodified2W[] = {'I','f','-','M','o','d','i','f','i','e','d','-','S','i','n','c','e',0}; BOOL ret; HINTERNET session, request, connection; DWORD index, len, status, size, start = GetTickCount(); SYSTEMTIME st; - WCHAR today[(sizeof(ifmodifiedW) + WINHTTP_TIME_FORMAT_BUFSIZE)/sizeof(WCHAR) + 3], buffer[32]; + WCHAR today[(sizeof(L"If-Modified-Since: ") + WINHTTP_TIME_FORMAT_BUFSIZE)/sizeof(WCHAR) + 3], buffer[32]; - memcpy(today, ifmodifiedW, sizeof(ifmodifiedW)); + memcpy(today, L"If-Modified-Since: ", sizeof(L"If-Modified-Since: ")); GetSystemTime(&st); - WinHttpTimeFromSystemTime(&st, &today[ARRAY_SIZE(ifmodifiedW)]); + WinHttpTimeFromSystemTime(&st, &today[ARRAY_SIZE(L"If-Modified-Since: ") - 1]); - session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, + session = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); ok(session != NULL, "WinHttpOpen failed: %u\n", GetLastError()); - connection = WinHttpConnect(session, localhostW, port, 0); + connection = WinHttpConnect(session, L"localhost", port, 0); ok(connection != NULL, "WinHttpConnect failed: %u\n", GetLastError()); - request = WinHttpOpenRequest(connection, NULL, pathW, NULL, WINHTTP_NO_REFERER, + request = WinHttpOpenRequest(connection, NULL, L"/not_modified", NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_BYPASS_PROXY_CACHE); ok(request != NULL, "WinHttpOpenrequest failed: %u\n", GetLastError()); @@ -3135,7 +3071,7 @@ static void test_not_modified(int port) index = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders(request, WINHTTP_QUERY_CUSTOM | WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - ifmodified2W, buffer, &len, &index); + L"If-Modified-Since", buffer, &len, &index); ok(ret, "failed to get header %u\n", GetLastError()); status = 0xdeadbeef; @@ -3159,35 +3095,30 @@ static void test_not_modified(int port) static void test_bad_header( int port ) { - static const WCHAR bad_headerW[] = - {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ', - 't','e','x','t','/','h','t','m','l','\n','\r',0}; - static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; - static const WCHAR content_typeW[] = {'C','o','n','t','e','n','t','-','T','y','p','e',0}; WCHAR buffer[32]; HINTERNET ses, con, req; DWORD index, len; BOOL ret; - ses = WinHttpOpen( test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); ok( ses != NULL, "failed to open session %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); req = WinHttpOpenRequest( con, NULL, NULL, NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); - ret = WinHttpAddRequestHeaders( req, bad_headerW, ~0u, WINHTTP_ADDREQ_FLAG_ADD ); + ret = WinHttpAddRequestHeaders( req, L"Content-Type: text/html\n\r", ~0u, WINHTTP_ADDREQ_FLAG_ADD ); ok( ret, "failed to add header %u\n", GetLastError() ); index = 0; buffer[0] = 0; len = sizeof(buffer); ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_CUSTOM|WINHTTP_QUERY_FLAG_REQUEST_HEADERS, - content_typeW, buffer, &len, &index ); + L"Content-Type", buffer, &len, &index ); ok( ret, "failed to query headers %u\n", GetLastError() ); - ok( !lstrcmpW( buffer, text_htmlW ), "got %s\n", wine_dbgstr_w(buffer) ); + ok( !lstrcmpW( buffer, L"text/html" ), "got %s\n", wine_dbgstr_w(buffer) ); ok( index == 1, "index = %u\n", index ); WinHttpCloseHandle( req ); @@ -3197,18 +3128,17 @@ static void test_bad_header( int port ) static void test_multiple_reads(int port) { - static const WCHAR bigW[] = {'b','i','g',0}; HINTERNET ses, con, req; DWORD total_len = 0; BOOL ret; - ses = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); + ses = WinHttpOpen(L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, port, 0); + con = WinHttpConnect(ses, L"localhost", port, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); - req = WinHttpOpenRequest(con, NULL, bigW, NULL, NULL, NULL, 0); + req = WinHttpOpenRequest(con, NULL, L"big", NULL, NULL, NULL, 0); ok(req != NULL, "failed to open a request %u\n", GetLastError()); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); @@ -3247,24 +3177,17 @@ static void test_multiple_reads(int port) static void test_cookies( int port ) { - static const WCHAR cookieW[] = {'/','c','o','o','k','i','e',0}; - static const WCHAR cookie2W[] = {'/','c','o','o','k','i','e','2',0}; - static const WCHAR cookie3W[] = {'/','c','o','o','k','i','e','3',0}; - static const WCHAR cookie4W[] = {'/','c','o','o','k','i','e','4',0}; - static const WCHAR cookie5W[] = {'/','c','o','o','k','i','e','5',0}; - static const WCHAR cookieheaderW[] = - {'C','o','o','k','i','e',':',' ','n','a','m','e','=','v','a','l','u','e','2','\r','\n',0}; HINTERNET ses, con, req; DWORD status, size; BOOL ret; - ses = WinHttpOpen( test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); ok( ses != NULL, "failed to open session %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); - req = WinHttpOpenRequest( con, NULL, cookieW, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3281,7 +3204,7 @@ static void test_cookies( int port ) WinHttpCloseHandle( req ); - req = WinHttpOpenRequest( con, NULL, cookie2W, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie2", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3299,10 +3222,10 @@ static void test_cookies( int port ) WinHttpCloseHandle( req ); WinHttpCloseHandle( con ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); - req = WinHttpOpenRequest( con, NULL, cookie2W, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie2", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3319,10 +3242,9 @@ static void test_cookies( int port ) WinHttpCloseHandle( req ); - req = WinHttpOpenRequest( con, NULL, cookie3W, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie3", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); - - ret = WinHttpSendRequest( req, cookieheaderW, ~0u, NULL, 0, 0, 0 ); + ret = WinHttpSendRequest( req, L"Cookie: name=value2\r\n", ~0u, NULL, 0, 0, 0 ); ok( ret, "failed to send request %u\n", GetLastError() ); ret = WinHttpReceiveResponse( req, NULL ); @@ -3338,13 +3260,13 @@ static void test_cookies( int port ) WinHttpCloseHandle( con ); WinHttpCloseHandle( ses ); - ses = WinHttpOpen( test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); ok( ses != NULL, "failed to open session %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); - req = WinHttpOpenRequest( con, NULL, cookie2W, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie2", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3363,13 +3285,13 @@ static void test_cookies( int port ) WinHttpCloseHandle( con ); WinHttpCloseHandle( ses ); - ses = WinHttpOpen( test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); ok( ses != NULL, "failed to open session %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); - req = WinHttpOpenRequest( con, NULL, cookie4W, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie4", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3385,7 +3307,7 @@ static void test_cookies( int port ) ok( status == HTTP_STATUS_OK, "request failed unexpectedly %u\n", status ); WinHttpCloseHandle( req ); - req = WinHttpOpenRequest( con, NULL, cookie5W, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/cookie5", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3456,10 +3378,10 @@ static void test_request_path_escapes( int port ) {'/','e','s','c','a','p','e','&','t','e','x','t','=',0x541b,0x306e,0x540d,0x306f,0}; HINTERNET ses, con; - ses = WinHttpOpen( test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); ok( ses != NULL, "failed to open session %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); do_request( con, objW, 0 ); @@ -3476,19 +3398,18 @@ static void test_request_path_escapes( int port ) static void test_connection_info( int port ) { - static const WCHAR basicW[] = {'/','b','a','s','i','c',0}; HINTERNET ses, con, req; WINHTTP_CONNECTION_INFO info; DWORD size, error; BOOL ret; - ses = WinHttpOpen( test_useragent, WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", WINHTTP_ACCESS_TYPE_NO_PROXY, NULL, NULL, 0 ); ok( ses != NULL, "failed to open session %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "failed to open a connection %u\n", GetLastError() ); - req = WinHttpOpenRequest( con, NULL, basicW, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/basic", NULL, NULL, NULL, 0 ); ok( req != NULL, "failed to open a request %u\n", GetLastError() ); size = sizeof(info); @@ -3535,34 +3456,24 @@ static void test_connection_info( int port ) static void test_passport_auth( int port ) { - static const WCHAR passportW[] = - {'/','p','a','s','s','p','o','r','t',0}; - static const WCHAR foundW[] = - {'F','o','u','n','d',0}; - static const WCHAR unauthorizedW[] = - {'U','n','a','u','t','h','o','r','i','z','e','d',0}; static const WCHAR headersW[] = - {'H','T','T','P','/','1','.','1',' ','4','0','1',' ','F','o','u','n','d','\r','\n', - 'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','0','\r','\n', - 'L','o','c','a','t','i','o','n',':',' ','/','\r','\n', - 'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',':',' ', - 'P','a','s','s','p','o','r','t','1','.','4','\r','\n','\r','\n',0}; + L"HTTP/1.1 401 Found\r\nContent-Length: 0\r\nLocation: /\r\nWWW-Authenticate: Passport1.4\r\n\r\n"; HINTERNET ses, con, req; DWORD status, size, option, err; WCHAR buf[128]; BOOL ret; - ses = WinHttpOpen( test_useragent, 0, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", 0, NULL, NULL, 0 ); ok( ses != NULL, "got %u\n", GetLastError() ); option = WINHTTP_ENABLE_PASSPORT_AUTH; ret = WinHttpSetOption( ses, WINHTTP_OPTION_CONFIGURE_PASSPORT_AUTH, &option, sizeof(option) ); ok( ret, "got %u\n", GetLastError() ); - con = WinHttpConnect( ses, localhostW, port, 0 ); + con = WinHttpConnect( ses, L"localhost", port, 0 ); ok( con != NULL, "got %u\n", GetLastError() ); - req = WinHttpOpenRequest( con, NULL, passportW, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/passport", NULL, NULL, NULL, 0 ); ok( req != NULL, "got %u\n", GetLastError() ); ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 ); @@ -3588,7 +3499,8 @@ static void test_passport_auth( int port ) size = sizeof(buf); ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_STATUS_TEXT, NULL, buf, &size, NULL ); ok( ret, "got %u\n", GetLastError() ); - ok( !lstrcmpW(foundW, buf) || broken(!lstrcmpW(unauthorizedW, buf)) /* < win7 */, "got %s\n", wine_dbgstr_w(buf) ); + ok( !lstrcmpW(L"Found", buf) || broken(!lstrcmpW(L"Unauthorized", buf)) /* < win7 */, "got %s\n", + wine_dbgstr_w(buf) ); buf[0] = 0; size = sizeof(buf); @@ -3617,10 +3529,10 @@ static void test_credentials(void) WCHAR buffer[32]; BOOL ret; - ses = WinHttpOpen(test_useragent, 0, proxy_userW, proxy_passW, 0); + ses = WinHttpOpen(L"winetest", 0, proxy_userW, proxy_passW, 0); ok(ses != NULL, "failed to open session %u\n", GetLastError()); - con = WinHttpConnect(ses, localhostW, 0, 0); + con = WinHttpConnect(ses, L"localhost", 0, 0); ok(con != NULL, "failed to open a connection %u\n", GetLastError()); req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0); @@ -3730,22 +3642,6 @@ static void test_credentials(void) static void test_IWinHttpRequest(int port) { static const WCHAR data_start[] = {'<','!','D','O','C','T','Y','P','E',' ','h','t','m','l',' ','P','U','B','L','I','C'}; - static const WCHAR usernameW[] = {'u','s','e','r','n','a','m','e',0}; - static const WCHAR passwordW[] = {'p','a','s','s','w','o','r','d',0}; - static const WCHAR url1W[] = {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0}; - static const WCHAR url2W[] = {'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0}; - static const WCHAR url3W[] = {'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.', - 'o','r','g','/','t','e','s','t','s','/','p','o','s','t','.','p','h','p',0}; - static const WCHAR method1W[] = {'G','E','T',0}; - static const WCHAR method2W[] = {'I','N','V','A','L','I','D',0}; - static const WCHAR method3W[] = {'P','O','S','T',0}; - static const WCHAR proxy_serverW[] = {'p','r','o','x','y','s','e','r','v','e','r',0}; - static const WCHAR bypas_listW[] = {'b','y','p','a','s','s','l','i','s','t',0}; - static const WCHAR connectionW[] = {'C','o','n','n','e','c','t','i','o','n',0}; - static const WCHAR dateW[] = {'D','a','t','e',0}; - static const WCHAR test_dataW[] = {'t','e','s','t','d','a','t','a',128,0}; - static const WCHAR utf8W[] = {'u','t','f','-','8',0}; - static const WCHAR unauthW[] = {'U','n','a','u','t','h','o','r','i','z','e','d',0}; HRESULT hr; IWinHttpRequest *req; BSTR method, url, username, password, response = NULL, status_text = NULL, headers = NULL; @@ -3774,15 +3670,15 @@ static void test_IWinHttpRequest(int port) V_VT( &async ) = VT_BOOL; V_BOOL( &async ) = VARIANT_FALSE; - method = SysAllocString( method3W ); - url = SysAllocString( url3W ); + method = SysAllocString( L"POST" ); + url = SysAllocString( L"http://test.winehq.org/tests/post.php" ); hr = IWinHttpRequest_Open( req, method, url, async ); ok( hr == S_OK, "got %08x\n", hr ); SysFreeString( method ); SysFreeString( url ); V_VT( &data ) = VT_BSTR; - V_BSTR( &data ) = SysAllocString( test_dataW ); + V_BSTR( &data ) = SysAllocString( L"testdata\x80" ); hr = IWinHttpRequest_Send( req, data ); ok( hr == S_OK || hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_INVALID_SERVER_RESPONSE ), "got %08x\n", hr ); SysFreeString( V_BSTR( &data ) ); @@ -3791,14 +3687,14 @@ static void test_IWinHttpRequest(int port) hr = IWinHttpRequest_Open( req, NULL, NULL, empty ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); - method = SysAllocString( method1W ); + method = SysAllocString( L"GET" ); hr = IWinHttpRequest_Open( req, method, NULL, empty ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); hr = IWinHttpRequest_Open( req, method, NULL, async ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); - url = SysAllocString( url1W ); + url = SysAllocString( L"http://test.winehq.org" ); hr = IWinHttpRequest_Open( req, NULL, url, empty ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); @@ -3817,19 +3713,19 @@ static void test_IWinHttpRequest(int port) ok( hr == S_OK, "got %08x\n", hr ); SysFreeString( url ); - url = SysAllocString( url2W ); + url = SysAllocString( L"test.winehq.org" ); hr = IWinHttpRequest_Open( req, method, url, async ); ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ), "got %08x\n", hr ); SysFreeString( method ); - method = SysAllocString( method2W ); + method = SysAllocString( L"INVALID" ); hr = IWinHttpRequest_Open( req, method, url, async ); ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_UNRECOGNIZED_SCHEME ), "got %08x\n", hr ); SysFreeString( method ); - method = SysAllocString( method1W ); + method = SysAllocString( L"GET" ); SysFreeString( url ); - url = SysAllocString( url1W ); + url = SysAllocString( L"http://test.winehq.org" ); V_VT( &async ) = VT_ERROR; V_ERROR( &async ) = DISP_E_PARAMNOTFOUND; hr = IWinHttpRequest_Open( req, method, url, async ); @@ -3854,7 +3750,7 @@ static void test_IWinHttpRequest(int port) ok( V_VT( &cp ) == VT_I4, "got %08x\n", V_VT( &cp ) ); ok( V_I4( &cp ) == CP_ACP, "got %u\n", V_I4( &cp ) ); - value = SysAllocString( utf8W ); + value = SysAllocString( L"utf-8" ); V_VT( &cp ) = VT_BSTR; V_BSTR( &cp ) = value; hr = IWinHttpRequest_put_Option( req, WinHttpRequestOption_URLCodePage, cp ); @@ -3931,7 +3827,7 @@ static void test_IWinHttpRequest(int port) hr = IWinHttpRequest_GetResponseHeader( req, NULL, NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND ), "got %08x\n", hr ); - connection = SysAllocString( connectionW ); + connection = SysAllocString( L"Connection" ); hr = IWinHttpRequest_GetResponseHeader( req, connection, NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND ), "got %08x\n", hr ); @@ -3941,7 +3837,7 @@ static void test_IWinHttpRequest(int port) hr = IWinHttpRequest_SetRequestHeader( req, NULL, NULL ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); - date = SysAllocString( dateW ); + date = SysAllocString( L"Date" ); hr = IWinHttpRequest_SetRequestHeader( req, date, NULL ); ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN ), "got %08x\n", hr ); @@ -3956,9 +3852,9 @@ static void test_IWinHttpRequest(int port) ok( hr == S_OK, "got %08x\n", hr ); SysFreeString( method ); - method = SysAllocString( method1W ); + method = SysAllocString( L"GET" ); SysFreeString( url ); - url = SysAllocString( url1W ); + url = SysAllocString( L"http://test.winehq.org" ); hr = IWinHttpRequest_Open( req, method, url, async ); ok( hr == S_OK, "got %08x\n", hr ); @@ -3983,11 +3879,11 @@ static void test_IWinHttpRequest(int port) hr = IWinHttpRequest_SetCredentials( req, NULL, NULL, 0xdeadbeef ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); - username = SysAllocString( usernameW ); + username = SysAllocString( L"username" ); hr = IWinHttpRequest_SetCredentials( req, username, NULL, 0xdeadbeef ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); - password = SysAllocString( passwordW ); + password = SysAllocString( L"password" ); hr = IWinHttpRequest_SetCredentials( req, NULL, password, 0xdeadbeef ); ok( hr == E_INVALIDARG, "got %08x\n", hr ); @@ -4001,9 +3897,9 @@ static void test_IWinHttpRequest(int port) ok( hr == S_OK, "got %08x\n", hr ); V_VT( &proxy_server ) = VT_BSTR; - V_BSTR( &proxy_server ) = SysAllocString( proxy_serverW ); + V_BSTR( &proxy_server ) = SysAllocString( L"proxyserver" ); V_VT( &bypass_list ) = VT_BSTR; - V_BSTR( &bypass_list ) = SysAllocString( bypas_listW ); + V_BSTR( &bypass_list ) = SysAllocString( L"bypasslist" ); hr = IWinHttpRequest_SetProxy( req, HTTPREQUEST_PROXYSETTING_PROXY, proxy_server, bypass_list ); ok( hr == S_OK, "got %08x\n", hr ); @@ -4244,8 +4140,8 @@ static void test_IWinHttpRequest(int port) hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER, &IID_IWinHttpRequest, (void **)&req ); ok( hr == S_OK, "got %08x\n", hr ); - url = SysAllocString( test_winehq_https ); - method = SysAllocString( method3W ); + url = SysAllocString( L"https://test.winehq.org:443" ); + method = SysAllocString( L"POST" ); V_VT( &async ) = VT_BOOL; V_BOOL( &async ) = VARIANT_FALSE; hr = IWinHttpRequest_Open( req, method, url, async ); @@ -4271,7 +4167,7 @@ static void test_IWinHttpRequest(int port) sprintf( buf, "http://localhost:%d/auth", port ); MultiByteToWideChar( CP_ACP, 0, buf, -1, bufW, ARRAY_SIZE( bufW )); url = SysAllocString( bufW ); - method = SysAllocString( method3W ); + method = SysAllocString( L"POST" ); V_VT( &async ) = VT_BOOL; V_BOOL( &async ) = VARIANT_FALSE; hr = IWinHttpRequest_Open( req, method, url, async ); @@ -4283,14 +4179,14 @@ static void test_IWinHttpRequest(int port) ok( hr == HRESULT_FROM_WIN32( ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND ), "got %08x\n", hr ); V_VT( &data ) = VT_BSTR; - V_BSTR( &data ) = SysAllocString( test_dataW ); + V_BSTR( &data ) = SysAllocString( L"testdata\x80" ); hr = IWinHttpRequest_Send( req, data ); ok( hr == S_OK, "got %08x\n", hr ); SysFreeString( V_BSTR( &data ) ); hr = IWinHttpRequest_get_ResponseText( req, &response ); ok( hr == S_OK, "got %08x\n", hr ); - ok( !memcmp( response, unauthW, sizeof(unauthW) ), "got %s\n", wine_dbgstr_w(response) ); + ok( !memcmp( response, L"Unauthorized", sizeof(L"Unauthorized") ), "got %s\n", wine_dbgstr_w(response) ); SysFreeString( response ); status = 0xdeadbeef; @@ -4325,8 +4221,6 @@ static void request_get_property(IWinHttpRequest *request, int property, VARIANT static void test_IWinHttpRequest_Invoke(void) { - static const WCHAR utf8W[] = {'U','T','F','-','8',0}; - static const WCHAR regid[] = {'W','i','n','H','t','t','p','.','W','i','n','H','t','t','p','R','e','q','u','e','s','t','.','5','.','1',0}; WCHAR openW[] = {'O','p','e','n',0}; WCHAR optionW[] = {'O','p','t','i','o','n',0}; OLECHAR *open = openW, *option = optionW; @@ -4343,7 +4237,7 @@ static void test_IWinHttpRequest_Invoke(void) CoInitialize(NULL); - hr = CLSIDFromProgID(regid, &clsid); + hr = CLSIDFromProgID(L"WinHttp.WinHttpRequest.5.1", &clsid); ok(hr == S_OK, "CLSIDFromProgID error %#x\n", hr); bret = IsEqualIID(&clsid, &CLSID_WinHttpRequest); ok(bret || broken(!bret) /* win2003 */, "not expected %s\n", wine_dbgstr_guid(&clsid)); @@ -4423,7 +4317,7 @@ static void test_IWinHttpRequest_Invoke(void) params.cNamedArgs = 0; params.rgvarg = arg; V_VT(&arg[0]) = VT_BSTR; - utf8 = SysAllocString(utf8W); + utf8 = SysAllocString(L"UTF-8"); V_BSTR(&arg[0]) = utf8; V_VT(&arg[1]) = VT_R8; V_R8(&arg[1]) = 2.0; /* WinHttpRequestOption_URLCodePage */ @@ -4626,9 +4520,6 @@ static void test_WinHttpGetIEProxyConfigForCurrentUser(void) static void test_WinHttpGetProxyForUrl(void) { - static const WCHAR urlW[] = {'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0}; - static const WCHAR wpadW[] = {'h','t','t','p',':','/','/','w','p','a','d','/','w','p','a','d','.','d','a','t',0}; - static const WCHAR emptyW[] = {0}; BOOL ret; DWORD error; HINTERNET session; @@ -4643,7 +4534,7 @@ static void test_WinHttpGetProxyForUrl(void) ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_HANDLE, "got %u\n", error ); - session = WinHttpOpen( test_useragent, 0, NULL, NULL, 0 ); + session = WinHttpOpen( L"winetest", 0, NULL, NULL, 0 ); ok( session != NULL, "failed to open session %u\n", GetLastError() ); SetLastError(0xdeadbeef); @@ -4653,19 +4544,19 @@ static void test_WinHttpGetProxyForUrl(void) ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, emptyW, NULL, NULL ); + ret = WinHttpGetProxyForUrl( session, L"", NULL, NULL ); error = GetLastError(); ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, urlW, NULL, NULL ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", NULL, NULL ); error = GetLastError(); ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", &options, &info ); error = GetLastError(); ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); @@ -4674,7 +4565,7 @@ static void test_WinHttpGetProxyForUrl(void) options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DNS_A; SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, urlW, &options, NULL ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", &options, NULL ); error = GetLastError(); ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); @@ -4683,7 +4574,7 @@ static void test_WinHttpGetProxyForUrl(void) options.dwAutoDetectFlags = 0; SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", &options, &info ); error = GetLastError(); ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); @@ -4692,7 +4583,7 @@ static void test_WinHttpGetProxyForUrl(void) options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DNS_A; SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", &options, &info ); error = GetLastError(); ok( !ret, "expected failure\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); @@ -4702,7 +4593,7 @@ static void test_WinHttpGetProxyForUrl(void) memset( &info, 0, sizeof(info) ); SetLastError(0xdeadbeef); - ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", &options, &info ); error = GetLastError(); if (ret) { @@ -4716,10 +4607,10 @@ static void test_WinHttpGetProxyForUrl(void) options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; options.dwAutoDetectFlags = 0; - options.lpszAutoConfigUrl = wpadW; + options.lpszAutoConfigUrl = L"http://wpad/wpad.dat"; memset( &info, 0, sizeof(info) ); - ret = WinHttpGetProxyForUrl( session, urlW, &options, &info ); + ret = WinHttpGetProxyForUrl( session, L"http://winehq.org", &options, &info ); if (ret) { trace("Proxy.AccessType=%u\n", info.dwAccessType); @@ -4733,8 +4624,6 @@ static void test_WinHttpGetProxyForUrl(void) static void test_chunked_read(void) { - static const WCHAR verb[] = {'/','t','e','s','t','s','/','c','h','u','n','k','e','d',0}; - static const WCHAR chunked[] = {'c','h','u','n','k','e','d',0}; WCHAR header[32]; DWORD len, err; HINTERNET ses, con = NULL, req = NULL; @@ -4742,15 +4631,15 @@ static void test_chunked_read(void) trace( "starting chunked read test\n" ); - ses = WinHttpOpen( test_useragent, 0, NULL, NULL, 0 ); + ses = WinHttpOpen( L"winetest", 0, NULL, NULL, 0 ); ok( ses != NULL, "WinHttpOpen failed with error %u\n", GetLastError() ); if (!ses) goto done; - con = WinHttpConnect( ses, test_winehq, 0, 0 ); + con = WinHttpConnect( ses, L"test.winehq.org", 0, 0 ); ok( con != NULL, "WinHttpConnect failed with error %u\n", GetLastError() ); if (!con) goto done; - req = WinHttpOpenRequest( con, NULL, verb, NULL, NULL, NULL, 0 ); + req = WinHttpOpenRequest( con, NULL, L"/tests/chunked", NULL, NULL, NULL, 0 ); ok( req != NULL, "WinHttpOpenRequest failed with error %u\n", GetLastError() ); if (!req) goto done; @@ -4772,7 +4661,7 @@ static void test_chunked_read(void) len = sizeof(header); ret = WinHttpQueryHeaders( req, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, header, &len, 0 ); ok( ret, "failed to get TRANSFER_ENCODING header (error %u)\n", GetLastError() ); - ok( !lstrcmpW( header, chunked ), "wrong transfer encoding %s\n", wine_dbgstr_w(header) ); + ok( !lstrcmpW( header, L"chunked" ), "wrong transfer encoding %s\n", wine_dbgstr_w(header) ); trace( "transfer encoding: %s\n", wine_dbgstr_w(header) ); header[0] = 0; @@ -4818,8 +4707,6 @@ done: START_TEST (winhttp) { - static const WCHAR basicW[] = {'/','b','a','s','i','c',0}; - static const WCHAR quitW[] = {'/','q','u','i','t',0}; struct server_info si; HANDLE thread; DWORD ret; @@ -4859,7 +4746,7 @@ START_TEST (winhttp) test_IWinHttpRequest(si.port); test_connection_info(si.port); - test_basic_request(si.port, NULL, basicW); + test_basic_request(si.port, NULL, L"/basic"); test_no_headers(si.port); test_no_content(si.port); test_head_request(si.port); @@ -4874,7 +4761,7 @@ START_TEST (winhttp) test_passport_auth(si.port); /* send the basic request again to shutdown the server thread */ - test_basic_request(si.port, NULL, quitW); + test_basic_request(si.port, NULL, L"/quit"); WaitForSingleObject(thread, 3000); CloseHandle(thread);