Author: akhaldi
Date: Sat Apr 26 17:36:17 2014
New Revision: 62991
URL:
http://svn.reactos.org/svn/reactos?rev=62991&view=rev
Log:
[WINHTTP_WINETEST]
* Sync with Wine 1.7.17.
CORE-8080
Modified:
trunk/rostests/winetests/winhttp/notification.c
trunk/rostests/winetests/winhttp/url.c
trunk/rostests/winetests/winhttp/winhttp.c
Modified: trunk/rostests/winetests/winhttp/notification.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/notific…
==============================================================================
--- trunk/rostests/winetests/winhttp/notification.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/winhttp/notification.c [iso-8859-1] Sat Apr 26 17:36:17 2014
@@ -27,6 +27,7 @@
#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};
enum api
{
@@ -44,9 +45,9 @@
{
enum api function; /* api responsible for notification */
unsigned int status; /* status received */
- int todo;
- int ignore;
- int skipped_for_proxy;
+ BOOL todo;
+ BOOL ignore;
+ BOOL skipped_for_proxy;
};
struct info
@@ -89,7 +90,7 @@
DWORD size = sizeof(struct info *);
WinHttpQueryOption( handle, WINHTTP_OPTION_CONTEXT_VALUE, &info, &size
);
}
- ok(i < info->count, "unexpected notification 0x%08x\n", status);
+ ok(i < info->count, "%u: unexpected notification 0x%08x\n",
info->line, status);
if (i >= info->count) return;
status_ok = (info->test[i].status == status);
@@ -107,7 +108,7 @@
todo_wine ok(function_ok, "%u: expected function %u got %u\n",
info->line, info->test[i].function, info->function);
}
}
- if (status_ok) info->index++;
+ if (status_ok && function_ok) info->index++;
if (proxy_active())
{
while (info->test[info->index].skipped_for_proxy)
@@ -122,31 +123,31 @@
static const struct notification cache_test[] =
{
- { winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
- { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 }
+ { winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
+ { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE }
};
static void setup_test( struct info *info, enum api function, unsigned int line )
@@ -157,8 +158,6 @@
static void test_connection_cache( void )
{
- static const WCHAR codeweavers[] =
{'w','w','w','.','c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
-
HANDLE ses, con, req;
DWORD size, status;
BOOL ret;
@@ -178,7 +177,7 @@
ok(ret, "failed to set context value %u\n", GetLastError());
setup_test( &info, winhttp_connect, __LINE__ );
- con = WinHttpConnect( ses, codeweavers, 0, 0 );
+ con = WinHttpConnect( ses, test_winehq, 0, 0 );
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
setup_test( &info, winhttp_open_request, __LINE__ );
@@ -242,7 +241,7 @@
ok(ret, "failed to set context value %u\n", GetLastError());
setup_test( &info, winhttp_connect, __LINE__ );
- con = WinHttpConnect( ses, codeweavers, 0, 0 );
+ con = WinHttpConnect( ses, test_winehq, 0, 0 );
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
setup_test( &info, winhttp_open_request, __LINE__ );
@@ -298,36 +297,34 @@
static const struct notification redirect_test[] =
{
- { winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 }
+ { winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE, TRUE
},
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE, TRUE
},
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, FALSE,
FALSE, TRUE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, FALSE,
FALSE, TRUE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE }
};
static void test_redirect( void )
{
- static const WCHAR codeweavers[] =
{'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
-
HANDLE ses, con, req;
DWORD size, status;
BOOL ret;
@@ -347,7 +344,7 @@
ok(ret, "failed to set context value %u\n", GetLastError());
setup_test( &info, winhttp_connect, __LINE__ );
- con = WinHttpConnect( ses, codeweavers, 0, 0 );
+ con = WinHttpConnect( ses, test_winehq, 0, 0 );
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
setup_test( &info, winhttp_open_request, __LINE__ );
@@ -375,42 +372,40 @@
static const struct notification async_test[] =
{
- { winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
- { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, 0, 0, 1 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0 },
- { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE, 0 },
- { winhttp_query_data, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE, 0 },
- { winhttp_read_data, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, 0, 1 },
- { winhttp_read_data, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, 0, 1 },
- { winhttp_read_data, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 0, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 },
- { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, 1, 1 }
+ { winhttp_connect, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_open_request, WINHTTP_CALLBACK_STATUS_HANDLE_CREATED },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_send_request, WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REDIRECT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, FALSE, TRUE, TRUE
},
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, FALSE, TRUE, TRUE
},
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTING_TO_SERVER, FALSE,
FALSE, TRUE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, FALSE,
FALSE, TRUE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_SENDING_REQUEST },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_REQUEST_SENT },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED },
+ { winhttp_receive_response, WINHTTP_CALLBACK_STATUS_HEADERS_AVAILABLE },
+ { winhttp_query_data, WINHTTP_CALLBACK_STATUS_DATA_AVAILABLE },
+ { winhttp_read_data, WINHTTP_CALLBACK_STATUS_RECEIVING_RESPONSE, FALSE, TRUE
},
+ { winhttp_read_data, WINHTTP_CALLBACK_STATUS_RESPONSE_RECEIVED, FALSE, TRUE
},
+ { winhttp_read_data, WINHTTP_CALLBACK_STATUS_READ_COMPLETE, FALSE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CLOSING_CONNECTION, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_CONNECTION_CLOSED, FALSE, TRUE
},
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, FALSE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE },
+ { winhttp_close_handle, WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING, TRUE, TRUE }
};
static void test_async( void )
{
- static const WCHAR codeweavers[] =
{'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
-
HANDLE ses, con, req;
DWORD size, status;
BOOL ret;
@@ -420,7 +415,7 @@
info.test = async_test;
info.count = sizeof(async_test) / sizeof(async_test[0]);
info.index = 0;
- info.wait = CreateEvent( NULL, FALSE, FALSE, NULL );
+ info.wait = CreateEventW( NULL, FALSE, FALSE, NULL );
ses = WinHttpOpen( user_agent, 0, NULL, NULL, WINHTTP_FLAG_ASYNC );
ok(ses != NULL, "failed to open session %u\n", GetLastError());
@@ -431,7 +426,7 @@
ok(ret, "failed to set context value %u\n", GetLastError());
setup_test( &info, winhttp_connect, __LINE__ );
- con = WinHttpConnect( ses, codeweavers, 0, 0 );
+ con = WinHttpConnect( ses, test_winehq, 0, 0 );
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
setup_test( &info, winhttp_open_request, __LINE__ );
Modified: trunk/rostests/winetests/winhttp/url.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/url.c?r…
==============================================================================
--- trunk/rostests/winetests/winhttp/url.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/winhttp/url.c [iso-8859-1] Sat Apr 26 17:36:17 2014
@@ -353,21 +353,21 @@
uc.dwExtraInfoLength = 20;
ret = WinHttpCrackUrl( url1, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
- ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
- ok( !memcmp( uc.lpszScheme, http, sizeof(http) ), "unexpected scheme\n" );
- ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
- ok( !memcmp( uc.lpszUserName, username, sizeof(username) ), "unexpected
username\n" );
- ok( uc.dwUserNameLength == 8, "unexpected username length\n" );
- ok( !memcmp( uc.lpszPassword, password, sizeof(password) ), "unexpected
password\n" );
- ok( uc.dwPasswordLength == 8, "unexpected password length\n" );
- ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected
hostname\n" );
- ok( uc.dwHostNameLength == 14, "unexpected hostname length\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
+ ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme: %u\n",
uc.nScheme );
+ ok( !memcmp( uc.lpszScheme, http, sizeof(http) ), "unexpected scheme:
%s\n", wine_dbgstr_w(uc.lpszScheme) );
+ ok( uc.dwSchemeLength == 4, "unexpected scheme length: %u\n",
uc.dwSchemeLength );
+ ok( !memcmp( uc.lpszUserName, username, sizeof(username) ), "unexpected
username: %s\n", wine_dbgstr_w(uc.lpszUserName) );
+ ok( uc.dwUserNameLength == 8, "unexpected username length: %u\n",
uc.dwUserNameLength );
+ ok( !memcmp( uc.lpszPassword, password, sizeof(password) ), "unexpected
password: %s\n", wine_dbgstr_w(uc.lpszPassword) );
+ ok( uc.dwPasswordLength == 8, "unexpected password length: %u\n",
uc.dwPasswordLength );
+ ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected hostname:
%s\n", wine_dbgstr_w(uc.lpszHostName) );
+ ok( uc.dwHostNameLength == 14, "unexpected hostname length: %u\n",
uc.dwHostNameLength );
ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
- ok( !memcmp( uc.lpszUrlPath, about, sizeof(about) ), "unexpected path\n"
);
- ok( uc.dwUrlPathLength == 11, "unexpected path length\n" );
- ok( !memcmp( uc.lpszExtraInfo, query, sizeof(query) ), "unexpected extra
info\n" );
- ok( uc.dwExtraInfoLength == 6, "unexpected extra info length\n" );
+ ok( !memcmp( uc.lpszUrlPath, about, sizeof(about) ), "unexpected path:
%s\n", wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( uc.dwUrlPathLength == 11, "unexpected path length: %u\n",
uc.dwUrlPathLength );
+ ok( !memcmp( uc.lpszExtraInfo, query, sizeof(query) ), "unexpected extra info:
%s\n", wine_dbgstr_w(uc.lpszExtraInfo) );
+ ok( uc.dwExtraInfoLength == 6, "unexpected extra info length: %u\n",
uc.dwExtraInfoLength );
/* buffer of insufficient length */
scheme[0] = 0;
@@ -376,15 +376,15 @@
SetLastError( 0xdeadbeef );
ret = WinHttpCrackUrl( url1, 0, 0, &uc );
error = GetLastError();
- ok( !ret, "WinHttpCrackUrl failed\n" );
- ok( error == ERROR_INSUFFICIENT_BUFFER, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_INSUFFICIENT_BUFFER, "got %u, expected
ERROR_INSUFFICIENT_BUFFER\n", error );
ok( uc.dwSchemeLength == 5, "unexpected scheme length: %u\n",
uc.dwSchemeLength );
/* no buffers */
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k1, 0, 0,&uc);
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
ok( uc.lpszScheme == url_k1,"unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
@@ -403,7 +403,7 @@
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k2, 0, 0,&uc);
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
ok( uc.lpszScheme == url_k2, "unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
@@ -422,7 +422,7 @@
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k3, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTPS, "unexpected scheme\n" );
ok( uc.lpszScheme == url_k3, "unexpected scheme\n" );
ok( uc.dwSchemeLength == 5, "unexpected scheme length\n" );
@@ -441,61 +441,61 @@
/* bad parameters */
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k4, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k5, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k6, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k7, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k8, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k9, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
- ok( uc.lpszUrlPath == url_k9 + 14, "unexpected path\n" );
- ok( uc.dwUrlPathLength == 0, "unexpected path length\n" );
- ok( uc.lpszExtraInfo == url_k9 + 14, "unexpected extra info\n" );
- ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
+ ok( uc.lpszUrlPath == url_k9 + 14, "unexpected path: %s\n",
wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( uc.dwUrlPathLength == 0, "unexpected path length: %u\n",
uc.dwUrlPathLength );
+ ok( uc.lpszExtraInfo == url_k9 + 14, "unexpected extra info: %s\n",
wine_dbgstr_w(uc.lpszExtraInfo) );
+ ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n",
uc.dwExtraInfoLength );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url_k10, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
- ok( uc.lpszUrlPath == url_k10 + 13, "unexpected path\n" );
- ok( uc.dwUrlPathLength == 7, "unexpected path length\n" );
- ok( uc.lpszExtraInfo == url_k10 + 20, "unexpected extra info\n" );
- ok( uc.dwExtraInfoLength == 0, "unexpected extra info length\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
+ ok( uc.lpszUrlPath == url_k10 + 13, "unexpected path: %s\n",
wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( uc.dwUrlPathLength == 7, "unexpected path length: %u\n",
uc.dwUrlPathLength );
+ ok( uc.lpszExtraInfo == url_k10 + 20, "unexpected extra info: %s\n",
wine_dbgstr_w(uc.lpszExtraInfo) );
+ ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n",
uc.dwExtraInfoLength );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url5, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
ret = WinHttpCrackUrl( empty, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
ret = WinHttpCrackUrl( url1, 0, 0, NULL );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
ret = WinHttpCrackUrl( NULL, 0, 0, &uc );
- ok( !ret, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
/* decoding without buffers */
reset_url_components( &uc );
SetLastError(0xdeadbeef);
ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc );
error = GetLastError();
- ok( !ret, "WinHttpCrackUrl failed\n" );
- ok( error == ERROR_INVALID_PARAMETER, "WinHttpCrackUrl failed\n" );
+ ok( !ret, "WinHttpCrackUrl succeeded\n" );
+ ok( error == ERROR_INVALID_PARAMETER, "got %u, expected
ERROR_INVALID_PARAMETER\n", error );
/* decoding with buffers */
uc.lpszScheme = scheme;
@@ -538,7 +538,7 @@
path[0] = 0;
ret = WinHttpCrackUrl( url7, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( !memcmp( uc.lpszHostName, winehq, sizeof(winehq) ), "unexpected host name:
%s\n", wine_dbgstr_w(uc.lpszHostName) );
ok( uc.dwHostNameLength == 14, "unexpected host name length: %d\n",
uc.dwHostNameLength );
ok( uc.nPort == 42, "unexpected port: %u\n", uc.nPort );
@@ -546,17 +546,17 @@
/* decoding without buffers */
reset_url_components( &uc );
ret = WinHttpCrackUrl( url9, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url10, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url11, 0, 0, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
reset_url_components( &uc );
@@ -575,7 +575,7 @@
reset_url_components( &uc );
ret = WinHttpCrackUrl( url12, 0, 0, &uc);
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme\n" );
ok( uc.lpszScheme == url12,"unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
@@ -603,7 +603,7 @@
uc.dwExtraInfoLength = 0;
uc.nPort = 0;
ret = WinHttpCrackUrl( url13, 0, ICU_DECODE, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
uc.lpszScheme = scheme;
uc.dwSchemeLength = 20;
@@ -619,7 +619,7 @@
uc.dwExtraInfoLength = 0;
uc.nPort = 0;
ret = WinHttpCrackUrl( url14, 0, ICU_ESCAPE|ICU_DECODE, &uc );
- ok( ret, "WinHttpCrackUrl failed\n" );
+ 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" );
}
Modified: trunk/rostests/winetests/winhttp/winhttp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/winhttp/winhttp…
==============================================================================
--- trunk/rostests/winetests/winhttp/winhttp.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/winhttp/winhttp.c [iso-8859-1] Sat Apr 26 17:36:17 2014
@@ -41,7 +41,7 @@
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_server[] =
{'w','i','n','e','h','q','.','o','r','g',0};
+static const WCHAR test_winehq[] =
{'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0};
static const WCHAR localhostW[] =
{'l','o','c','a','l','h','o','s','t',0};
static BOOL proxy_active(void)
@@ -146,7 +146,7 @@
"expected ERROR_WINHTTP_INCORRECT_HANDLE_TYPE, got %u\n",
GetLastError());
SetLastError(0xdeadbeef);
- connection = WinHttpConnect(session, test_server, INTERNET_DEFAULT_HTTP_PORT, 0);
+ connection = WinHttpConnect(session, test_winehq, INTERNET_DEFAULT_HTTP_PORT, 0);
ok(connection != NULL, "WinHttpConnect failed to open a connection, error:
%u\n", GetLastError());
feature = WINHTTP_DISABLE_COOKIES;
@@ -227,7 +227,7 @@
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER,
got %u.\n", GetLastError());
/* Test with a valid server name */
- connection = WinHttpConnect (session, test_server, INTERNET_DEFAULT_HTTP_PORT, 0);
+ connection = WinHttpConnect (session, test_winehq, INTERNET_DEFAULT_HTTP_PORT, 0);
ok(connection != NULL, "WinHttpConnect failed to open a connection, error:
%u.\n", GetLastError());
request = WinHttpOpenRequest(connection, NULL, NULL, NULL, WINHTTP_NO_REFERER,
@@ -259,7 +259,6 @@
static void test_empty_headers_param(void)
{
- static const WCHAR winehq[] =
{'w','i','n','e','h','q','.','o','r','g',0};
static const WCHAR empty[] = {0};
HINTERNET ses, con, req;
BOOL ret;
@@ -267,7 +266,7 @@
ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
ok(ses != NULL, "failed to open session %u\n", GetLastError());
- con = WinHttpConnect(ses, winehq, 80, 0);
+ con = WinHttpConnect(ses, test_winehq, 80, 0);
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
@@ -283,6 +282,13 @@
static void test_SendRequest (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 test_verb[] =
{'P','O','S','T',0};
+ 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;
DWORD_PTR context;
@@ -290,16 +296,6 @@
CHAR buffer[256];
int i;
- static const WCHAR test_site[] =
{'c','r','o','s','s','o','v','e','r','.',
-
'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
- 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[] =
{'/','p','o','s','t','t','e','s','t','.','p','h','p',0};
- static const WCHAR test_verb[] =
{'P','O','S','T',0};
- static CHAR post_data[] = "mode=Test";
- static CHAR test_post[] = "mode => Test\\0\n";
-
header_len = -1L;
total_len = optional_len = sizeof(post_data);
memset(buffer, 0xff, sizeof(buffer));
@@ -308,7 +304,7 @@
WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
ok(session != NULL, "WinHttpOpen failed to open session.\n");
- connection = WinHttpConnect (session, test_site, INTERNET_DEFAULT_HTTP_PORT, 0);
+ connection = WinHttpConnect (session, test_winehq, 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,
@@ -355,8 +351,8 @@
ret = WinHttpReadData(request, buffer, sizeof(buffer) - 1, &bytes_rw);
ok(ret == TRUE, "WinHttpReadData failed: %u.\n", GetLastError());
- ok(bytes_rw == strlen(test_post), "Read %u bytes instead of %d.\n",
bytes_rw, lstrlen(test_post));
- ok(strncmp(buffer, test_post, bytes_rw) == 0, "Data read did not match, got
'%s'.\n", buffer);
+ ok(bytes_rw == sizeof(test_post) - 1, "Read %u bytes\n", bytes_rw);
+ ok(!memcmp(buffer, test_post, sizeof(test_post) - 1), "Data read did not
match.\n");
ret = WinHttpCloseHandle(request);
ok(ret == TRUE, "WinHttpCloseHandle failed on closing request, got %d.\n",
ret);
@@ -413,15 +409,12 @@
WCHAR check_buffer[MAX_PATH];
DWORD index, len, oldlen;
- static const WCHAR test_site[] =
{'c','r','o','s','s','o','v','e','r','.',
-
'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
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',':','/','/','c','r','o','s','s','o','v','e','r','.','c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',':','8','0','/','p','o','s','t','t','e','s','t','.','p','h','p','
','H','T','T','P','/','1'};
+ {'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','.','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};
@@ -469,7 +462,7 @@
WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
ok(session != NULL, "WinHttpOpen failed to open session.\n");
- connection = WinHttpConnect (session, test_site, INTERNET_DEFAULT_HTTP_PORT, 0);
+ connection = WinHttpConnect (session, test_winehq, 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,
@@ -816,8 +809,6 @@
static void test_secure_connection(void)
{
- static const WCHAR google[] =
{'w','w','w','.','g','o','o','g','l','e','.','c','o','m',0};
-
HINTERNET ses, con, req;
DWORD size, status, policy, bitness, read_size;
BOOL ret;
@@ -832,7 +823,7 @@
ret = WinHttpSetOption(ses, WINHTTP_OPTION_REDIRECT_POLICY, &policy,
sizeof(policy));
ok(ret, "failed to set redirect policy %u\n", GetLastError());
- con = WinHttpConnect(ses, google, 443, 0);
+ con = WinHttpConnect(ses, test_winehq, 443, 0);
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
/* try without setting WINHTTP_FLAG_SECURE */
@@ -922,8 +913,6 @@
static void test_request_parameter_defaults(void)
{
static const WCHAR empty[] = {0};
- static const WCHAR codeweavers[] =
{'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
-
HINTERNET ses, con, req;
DWORD size, status, error;
WCHAR *version;
@@ -932,7 +921,7 @@
ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
ok(ses != NULL, "failed to open session %u\n", GetLastError());
- con = WinHttpConnect(ses, codeweavers, 0, 0);
+ con = WinHttpConnect(ses, test_winehq, 0, 0);
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
@@ -1126,8 +1115,6 @@
BOOL ret;
DWORD value, size;
HINTERNET ses, req, con;
- static const WCHAR codeweavers[] =
{'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
-
ses = WinHttpOpen(test_useragent, 0, NULL, NULL, 0);
ok(ses != NULL, "failed to open session %u\n", GetLastError());
@@ -1288,7 +1275,7 @@
ok(ret, "%u\n", GetLastError());
ok(value == 0xbeefdead, "Expected 0xbeefdead, got %u\n", value);
- con = WinHttpConnect(ses, codeweavers, 0, 0);
+ con = WinHttpConnect(ses, test_winehq, 0, 0);
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
/* Timeout values should match the last one set for session */
@@ -1717,11 +1704,8 @@
static void test_resolve_timeout(void)
{
- static const WCHAR codeweavers[] =
-
{'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
static const WCHAR nxdomain[] =
-
{'n','x','d','o','m','a','i','n','.','c','o','d','e','w','e','a','v','e','r','s','.','c','o','m',0};
-
+
{'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;
@@ -1743,6 +1727,11 @@
SetLastError(0xdeadbeef);
ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
+ if(ret == 1)
+ {
+ skip("nxdomain returned success. Broken ISP redirects?\n");
+ return;
+ }
ok(!ret, "sent request\n");
ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED,
"expected ERROR_WINHTTP_NAME_NOT_RESOLVED got %u\n",
GetLastError());
@@ -1761,7 +1750,7 @@
ret = WinHttpSetOption(ses, WINHTTP_OPTION_RESOLVE_TIMEOUT, &timeout,
sizeof(timeout));
ok(ret, "failed to set resolve timeout %u\n", GetLastError());
- con = WinHttpConnect(ses, codeweavers, 0, 0);
+ con = WinHttpConnect(ses, test_winehq, 0, 0);
ok(con != NULL, "failed to open a connection %u\n", GetLastError());
req = WinHttpOpenRequest(con, NULL, NULL, NULL, NULL, NULL, 0);
@@ -1805,6 +1794,8 @@
HANDLE event;
int port;
};
+
+#define BIG_BUFFER_LEN 0x2250
static DWORD CALLBACK server_thread(LPVOID param)
{
@@ -1863,6 +1854,13 @@
else
send(c, noauthmsg, sizeof noauthmsg - 1, 0);
}
+ if (strstr(buffer, "/big"))
+ {
+ char msg[BIG_BUFFER_LEN];
+ memset(msg, 'm', sizeof(msg));
+ send(c, okmsg, sizeof(okmsg) - 1, 0);
+ send(c, msg, sizeof(msg), 0);
+ }
if (strstr(buffer, "/no_headers"))
{
send(c, page1, sizeof page1 - 1, 0);
@@ -2085,13 +2083,19 @@
ok(req != NULL, "failed to open a request %u\n", GetLastError());
ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
- ok(ret, "failed to send request %u\n", GetLastError());
-
- SetLastError(0xdeadbeef);
- ret = WinHttpReceiveResponse(req, NULL);
- error = GetLastError();
- ok(!ret, "expected failure\n");
- ok(error == ERROR_WINHTTP_INVALID_SERVER_RESPONSE, "got %u\n", error);
+ if (!ret)
+ {
+ error = GetLastError();
+ ok(error == ERROR_WINHTTP_INVALID_SERVER_RESPONSE, "got %u\n", error);
+ }
+ else
+ {
+ SetLastError(0xdeadbeef);
+ ret = WinHttpReceiveResponse(req, NULL);
+ error = GetLastError();
+ ok(!ret, "expected failure\n");
+ ok(error == ERROR_WINHTTP_INVALID_SERVER_RESPONSE, "got %u\n", error);
+ }
WinHttpCloseHandle(req);
WinHttpCloseHandle(con);
@@ -2133,6 +2137,55 @@
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
+}
+
+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, 0, NULL, NULL, 0);
+ ok(ses != NULL, "failed to open session %u\n", GetLastError());
+
+ con = WinHttpConnect(ses, localhostW, port, 0);
+ ok(con != NULL, "failed to open a connection %u\n", GetLastError());
+
+ req = WinHttpOpenRequest(con, NULL, bigW, NULL, NULL, NULL, 0);
+ ok(req != NULL, "failed to open a request %u\n", GetLastError());
+
+ ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
+ ok(ret, "failed to send request %u\n", GetLastError());
+
+ ret = WinHttpReceiveResponse(req, NULL);
+ ok(ret == TRUE, "expected success\n");
+
+ for (;;)
+ {
+ DWORD len = 0xdeadbeef;
+ ret = WinHttpQueryDataAvailable( req, &len );
+ ok( ret, "WinHttpQueryDataAvailable failed with error %u\n",
GetLastError() );
+ if (ret) ok( len != 0xdeadbeef, "WinHttpQueryDataAvailable return wrong
length\n" );
+ if (len)
+ {
+ DWORD bytes_read;
+ char *buf = HeapAlloc( GetProcessHeap(), 0, len + 1 );
+
+ ret = WinHttpReadData( req, buf, len, &bytes_read );
+ ok( len == bytes_read, "only got %u of %u available\n", bytes_read,
len );
+
+ HeapFree( GetProcessHeap(), 0, buf );
+ if (!bytes_read) break;
+ total_len += bytes_read;
+ }
+ if (!len) break;
+ }
+ ok(total_len == BIG_BUFFER_LEN, "got wrong length: 0x%x\n", total_len);
+
+ WinHttpCloseHandle(req);
+ WinHttpCloseHandle(con);
+ WinHttpCloseHandle(ses);
}
static void test_connection_info( int port )
@@ -2319,11 +2372,10 @@
{
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',':','/','/','w','i','n','e','h','q','.','o','r','g',0};
- static const WCHAR url2W[] =
{'w','i','n','e','h','q','.','o','r','g',0};
- static const WCHAR url3W[] =
{'h','t','t','p',':','/','/','c','r','o','s','s','o','v','e','r','.',
-
'c','o','d','e','w','e','a','v','e','r','s','.','c','o','m','/',
-
'p','o','s','t','t','e','s','t','.','p','h','p',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};
@@ -2764,7 +2816,7 @@
if (!ret)
{
ok( error == ERROR_WINHTTP_AUTODETECTION_FAILED, "got %u\n", error );
- ok( url == (WCHAR *)0xdeadbeef, "got %p\n", url );
+ ok( !url || broken(url == (WCHAR *)0xdeadbeef), "got %p\n", url );
}
else
{
@@ -2779,7 +2831,7 @@
if (!ret)
{
ok( error == ERROR_WINHTTP_AUTODETECTION_FAILED, "got %u\n", error );
- ok( url == (WCHAR *)0xdeadbeef, "got %p\n", url );
+ ok( !url || broken(url == (WCHAR *)0xdeadbeef), "got %p\n", url );
}
else
{
@@ -2926,7 +2978,6 @@
static void test_chunked_read(void)
{
- static const WCHAR host[] =
{'t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',0};
static const WCHAR verb[] =
{'/','t','e','s','t','c','h','u','n','k','e','d',0};
static const WCHAR chunked[] =
{'c','h','u','n','k','e','d',0};
WCHAR header[32];
@@ -2940,7 +2991,7 @@
ok( ses != NULL, "WinHttpOpen failed with error %u\n", GetLastError() );
if (!ses) goto done;
- con = WinHttpConnect( ses, host, 0, 0 );
+ con = WinHttpConnect( ses, test_winehq, 0, 0 );
ok( con != NULL, "WinHttpConnect failed with error %u\n", GetLastError()
);
if (!con) goto done;
@@ -3028,7 +3079,7 @@
test_WinHttpGetProxyForUrl();
test_chunked_read();
- si.event = CreateEvent(NULL, 0, 0, NULL);
+ si.event = CreateEventW(NULL, 0, 0, NULL);
si.port = 7532;
thread = CreateThread(NULL, 0, server_thread, (LPVOID)&si, 0, NULL);
@@ -3044,6 +3095,7 @@
test_no_headers(si.port);
test_basic_authentication(si.port);
test_bad_header(si.port);
+ test_multiple_reads(si.port);
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, NULL, quitW);