Author: akhaldi
Date: Thu Apr 9 13:31:23 2015
New Revision: 67117
URL:
http://svn.reactos.org/svn/reactos?rev=67117&view=rev
Log:
[WINHTTP_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
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] Thu Apr 9 13:31:23 2015
@@ -186,6 +186,11 @@
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+ if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ {
+ skip("connection failed, skipping\n");
+ goto done;
+ }
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
@@ -209,6 +214,11 @@
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+ if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ {
+ skip("connection failed, skipping\n");
+ goto done;
+ }
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
@@ -253,6 +263,11 @@
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+ if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ {
+ skip("connection failed, skipping\n");
+ goto done;
+ }
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
@@ -276,6 +291,11 @@
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+ if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ {
+ skip("connection failed, skipping\n");
+ goto done;
+ }
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
@@ -288,6 +308,7 @@
ok(status == 200, "request failed unexpectedly %u\n", status);
setup_test( &info, winhttp_close_handle, __LINE__ );
+done:
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
@@ -353,6 +374,11 @@
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+ if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ {
+ skip("connection failed, skipping\n");
+ goto done;
+ }
ok(ret, "failed to send request %u\n", GetLastError());
setup_test( &info, winhttp_receive_response, __LINE__ );
@@ -365,6 +391,7 @@
ok(status == 200, "request failed unexpectedly %u\n", status);
setup_test( &info, winhttp_close_handle, __LINE__ );
+done:
WinHttpCloseHandle( req );
WinHttpCloseHandle( con );
WinHttpCloseHandle( ses );
@@ -435,6 +462,15 @@
setup_test( &info, winhttp_send_request, __LINE__ );
ret = WinHttpSendRequest( req, NULL, 0, NULL, 0, 0, 0 );
+ if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ {
+ skip("connection failed, skipping\n");
+ WinHttpCloseHandle( req );
+ WinHttpCloseHandle( con );
+ WinHttpCloseHandle( ses );
+ CloseHandle( info.wait );
+ return;
+ }
ok(ret, "failed to send request %u\n", GetLastError());
WaitForSingleObject( info.wait, INFINITE );
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] Thu Apr 9 13:31:23 2015
@@ -38,40 +38,37 @@
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',
-
'@','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 url3[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':',0};
-static const WCHAR url4[] =
+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 url5[] =
{'h','t','t','p',':','/','/',0};
-static const WCHAR url6[] =
+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 url7[] =
+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 url8[] =
+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',':','0','/','s','i','t','e','/','a','b','o','u','t','?','q','u','e','r','y',0};
+
'@','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',':','/','/','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 url11[] =
{'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',':','/','/','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};
+
{'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','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 url14[] =
{'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 url15[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','t','e','s','t',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 url_k1[] =
{'h','t','t','p',':','/','/','u','s','e','r','n','a','m','e',':','p','a','s','s','w','o','r','d',
@@ -214,7 +211,7 @@
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 56, "expected len 56 got %u\n", len );
- ok( !lstrcmpW( url, url3 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url2 ), "url doesn't match\n" );
/* valid password, NULL username */
fill_url_components( &uc );
@@ -243,7 +240,7 @@
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 38, "expected len 38 got %u\n", len );
- ok( !lstrcmpW( url, url4 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url3 ), "url doesn't match\n" );
/* empty username, empty password */
fill_url_components( &uc );
@@ -254,7 +251,7 @@
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 56, "expected len 56 got %u\n", len );
- ok( !lstrcmpW( url, url5 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url4 ), "url doesn't match\n" );
/* nScheme has lower precedence than lpszScheme */
fill_url_components( &uc );
@@ -264,8 +261,8 @@
len = 256;
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
- ok( len == lstrlenW( url6 ), "expected len %d got %u\n", lstrlenW( url6 ) +
1, len );
- ok( !lstrcmpW( url, url6 ), "url doesn't match\n" );
+ ok( len == lstrlenW( url5 ), "expected len %d got %u\n", lstrlenW( url5 ) +
1, len );
+ ok( !lstrcmpW( url, url5 ), "url doesn't match\n" );
/* non-standard port */
uc.lpszScheme = http;
@@ -276,7 +273,7 @@
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 59, "expected len 59 got %u\n", len );
- ok( !lstrcmpW( url, url7 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url6 ), "url doesn't match\n" );
/* escape extra info */
fill_url_components( &uc );
@@ -287,7 +284,7 @@
ret = WinHttpCreateUrl( &uc, ICU_ESCAPE, url, &len );
ok( ret, "expected success\n" );
ok( len == 113, "expected len 113 got %u\n", len );
- ok( !lstrcmpW( url, url8 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url7 ), "url doesn't match\n" );
/* NULL lpszScheme, 0 nScheme and nPort */
fill_url_components( &uc );
@@ -300,7 +297,7 @@
ret = WinHttpCreateUrl( &uc, 0, url, &len );
ok( ret, "expected success\n" );
ok( len == 58, "expected len 58 got %u\n", len );
- ok( !lstrcmpW( url, url9 ), "url doesn't match\n" );
+ ok( !lstrcmpW( url, url8 ), "url doesn't match\n" );
HeapFree( GetProcessHeap(), 0, url );
}
@@ -480,7 +477,7 @@
ok( uc.dwExtraInfoLength == 0, "unexpected extra info length: %u\n",
uc.dwExtraInfoLength );
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url5, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url4, 0, 0, &uc );
ok( !ret, "WinHttpCrackUrl succeeded\n" );
reset_url_components( &uc );
@@ -496,7 +493,7 @@
/* decoding without buffers */
reset_url_components( &uc );
SetLastError(0xdeadbeef);
- ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u, expected
ERROR_INVALID_PARAMETER\n", error );
@@ -517,7 +514,7 @@
uc.dwExtraInfoLength = 40;
path[0] = 0;
- ret = WinHttpCrackUrl( url8, 0, ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url7, 0, ICU_DECODE, &uc );
ok( ret, "WinHttpCrackUrl failed %u\n", GetLastError() );
ok( !memcmp( uc.lpszUrlPath + 11, escape, 21 * sizeof(WCHAR) ), "unexpected
path\n" );
ok( uc.dwUrlPathLength == 32, "unexpected path length %u\n",
uc.dwUrlPathLength );
@@ -541,7 +538,7 @@
uc.dwExtraInfoLength = 20;
path[0] = 0;
- ret = WinHttpCrackUrl( url7, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url6, 0, 0, &uc );
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 );
@@ -549,17 +546,17 @@
/* decoding without buffers */
reset_url_components( &uc );
+ ret = WinHttpCrackUrl( url8, 0, 0, &uc );
+ ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
+ ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
+
+ reset_url_components( &uc );
ret = WinHttpCrackUrl( url9, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
- ok( uc.nPort == 0, "unexpected port: %u\n", uc.nPort );
+ ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
reset_url_components( &uc );
ret = WinHttpCrackUrl( url10, 0, 0, &uc );
- 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 le=%u\n", GetLastError() );
ok( uc.nPort == 443, "unexpected port: %u\n", uc.nPort );
@@ -578,19 +575,19 @@
ok( error == ERROR_WINHTTP_UNRECOGNIZED_SCHEME, "got %u, expected
ERROR_WINHTTP_UNRECOGNIZED_SCHEME\n", error );
reset_url_components( &uc );
- ret = WinHttpCrackUrl( url12, 0, 0, &uc);
+ ret = WinHttpCrackUrl( url11, 0, 0, &uc);
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.lpszScheme == url11,"unexpected scheme\n" );
ok( uc.dwSchemeLength == 4, "unexpected scheme length\n" );
ok( uc.lpszUserName == NULL, "unexpected username\n" );
ok( uc.lpszPassword == NULL, "unexpected password\n" );
- ok( uc.lpszHostName == url12 + 7, "unexpected hostname\n" );
+ ok( uc.lpszHostName == url11 + 7, "unexpected hostname\n" );
ok( uc.dwHostNameLength == 11, "unexpected hostname length\n" );
ok( uc.nPort == 80, "unexpected port: %u\n", uc.nPort );
- ok( uc.lpszUrlPath == url12 + 18, "unexpected path\n" );
+ ok( uc.lpszUrlPath == url11 + 18, "unexpected path\n" );
ok( uc.dwUrlPathLength == 5, "unexpected path length\n" );
- ok( uc.lpszExtraInfo == url12 + 23, "unexpected extra info\n" );
+ ok( uc.lpszExtraInfo == url11 + 23, "unexpected extra info\n" );
ok( uc.dwExtraInfoLength == 39, "unexpected extra info length\n" );
uc.lpszScheme = scheme;
@@ -606,7 +603,7 @@
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = 0;
uc.nPort = 0;
- ret = WinHttpCrackUrl( url13, 0, ICU_DECODE, &uc );
+ ret = WinHttpCrackUrl( url12, 0, ICU_DECODE, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
uc.lpszScheme = scheme;
@@ -622,7 +619,7 @@
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = 0;
uc.nPort = 0;
- ret = WinHttpCrackUrl( url14, 0, ICU_ESCAPE|ICU_DECODE, &uc );
+ 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" );
@@ -642,19 +639,19 @@
uc.dwUrlPathLength = ~0u;
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = ~0u;
- ret = WinHttpCrackUrl( url15, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url14, 0, 0, &uc );
ok( ret, "WinHttpCrackUrl failed le=%u\n", GetLastError() );
ok( !uc.lpszScheme, "unexpected scheme %s\n", wine_dbgstr_w(uc.lpszScheme)
);
ok( !uc.dwSchemeLength, "unexpected length %u\n", uc.dwSchemeLength );
ok( uc.nScheme == INTERNET_SCHEME_HTTP, "unexpected scheme %u\n",
uc.nScheme );
- ok( !lstrcmpW( uc.lpszHostName, url15 + 7 ), "unexpected hostname %s\n",
wine_dbgstr_w(uc.lpszHostName) );
+ ok( !lstrcmpW( uc.lpszHostName, url14 + 7 ), "unexpected hostname %s\n",
wine_dbgstr_w(uc.lpszHostName) );
ok( uc.dwHostNameLength == 14, "unexpected length %u\n",
uc.dwHostNameLength );
ok( uc.nPort == 80, "unexpected port %u\n", uc.nPort );
ok( !uc.lpszUserName, "unexpected username\n" );
ok( !uc.dwUserNameLength, "unexpected length %u\n", uc.dwUserNameLength );
ok( !uc.lpszPassword, "unexpected password\n" );
ok( !uc.dwPasswordLength, "unexpected length %u\n", uc.dwPasswordLength );
- ok( !lstrcmpW( uc.lpszUrlPath, url15 + 21 ), "unexpected path %s\n",
wine_dbgstr_w(uc.lpszUrlPath) );
+ ok( !lstrcmpW( uc.lpszUrlPath, url14 + 21 ), "unexpected path %s\n",
wine_dbgstr_w(uc.lpszUrlPath) );
ok( uc.dwUrlPathLength == 5, "unexpected length %u\n", uc.dwUrlPathLength
);
ok( !uc.lpszExtraInfo[0], "unexpected extra info %s\n",
wine_dbgstr_w(uc.lpszExtraInfo) );
ok( uc.dwExtraInfoLength == 0, "unexpected length %u\n",
uc.dwExtraInfoLength );
@@ -675,7 +672,7 @@
uc.lpszExtraInfo = NULL;
uc.dwExtraInfoLength = 0;
SetLastError( 0xdeadbeef );
- ret = WinHttpCrackUrl( url15, 0, 0, &uc );
+ ret = WinHttpCrackUrl( url14, 0, 0, &uc );
error = GetLastError();
ok( !ret, "WinHttpCrackUrl succeeded\n" );
ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error );
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] Thu Apr 9 13:31:23 2015
@@ -882,12 +882,15 @@
ret = WinHttpQueryOption(req, WINHTTP_OPTION_SECURITY_CERTIFICATE_STRUCT, &info,
&size );
ok(ret, "failed to retrieve certificate info %u\n", GetLastError());
- trace("lpszSubjectInfo %s\n", wine_dbgstr_w(info.lpszSubjectInfo));
- trace("lpszIssuerInfo %s\n", wine_dbgstr_w(info.lpszIssuerInfo));
- trace("lpszProtocolName %s\n", wine_dbgstr_w(info.lpszProtocolName));
- trace("lpszSignatureAlgName %s\n",
wine_dbgstr_w(info.lpszSignatureAlgName));
- trace("lpszEncryptionAlgName %s\n",
wine_dbgstr_w(info.lpszEncryptionAlgName));
- trace("dwKeySize %u\n", info.dwKeySize);
+ if (ret)
+ {
+ trace("lpszSubjectInfo %s\n", wine_dbgstr_w(info.lpszSubjectInfo));
+ trace("lpszIssuerInfo %s\n", wine_dbgstr_w(info.lpszIssuerInfo));
+ trace("lpszProtocolName %s\n", wine_dbgstr_w(info.lpszProtocolName));
+ trace("lpszSignatureAlgName %s\n",
wine_dbgstr_w(info.lpszSignatureAlgName));
+ trace("lpszEncryptionAlgName %s\n",
wine_dbgstr_w(info.lpszEncryptionAlgName));
+ trace("dwKeySize %u\n", info.dwKeySize);
+ }
ret = WinHttpReceiveResponse(req, NULL);
ok(ret, "failed to receive response %u\n", GetLastError());
@@ -957,7 +960,7 @@
ok(req != NULL, "failed to open a request %u\n", GetLastError());
ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0);
- if (!ret && GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT)
+ if (!ret && (GetLastError() == ERROR_WINHTTP_CANNOT_CONNECT || GetLastError()
== ERROR_WINHTTP_TIMEOUT))
{
skip("connection failed, skipping\n");
goto done;
@@ -1804,6 +1807,10 @@
"Server: winetest\r\n"
"\r\n";
+static const char notmodified[] =
+"HTTP/1.1 304 Not Modified\r\n"
+"\r\n";
+
static const char noauthmsg[] =
"HTTP/1.1 401 Unauthorized\r\n"
"Server: winetest\r\n"
@@ -1811,6 +1818,17 @@
"WWW-Authenticate: Basic realm=\"placebo\"\r\n"
"\r\n";
+static const char okauthmsg[] =
+"HTTP/1.1 200 OK\r\n"
+"Server: winetest\r\n"
+"Connection: close\r\n"
+"\r\n";
+
+static const char headmsg[] =
+"HTTP/1.1 200 OK\r\n"
+"Content-Length: 100\r\n"
+"\r\n";
+
struct server_info
{
HANDLE event;
@@ -1822,7 +1840,7 @@
static DWORD CALLBACK server_thread(LPVOID param)
{
struct server_info *si = param;
- int r, c, i, on;
+ int r, c = -1, i, on;
SOCKET s;
struct sockaddr_in sa;
char buffer[0x100];
@@ -1851,7 +1869,7 @@
SetEvent(si->event);
do
{
- c = accept(s, NULL, NULL);
+ if (c == -1) c = accept(s, NULL, NULL);
memset(buffer, 0, sizeof buffer);
for(i = 0; i < sizeof buffer - 1; i++)
@@ -1872,7 +1890,7 @@
if (strstr(buffer, "/auth"))
{
if (strstr(buffer, "Authorization: Basic dXNlcjpwd2Q="))
- send(c, okmsg, sizeof okmsg - 1, 0);
+ send(c, okauthmsg, sizeof okauthmsg - 1, 0);
else
send(c, noauthmsg, sizeof noauthmsg - 1, 0);
}
@@ -1890,6 +1908,17 @@
if (strstr(buffer, "GET /no_content"))
{
send(c, nocontentmsg, sizeof nocontentmsg - 1, 0);
+ continue;
+ }
+ if (strstr(buffer, "GET /not_modified"))
+ {
+ send(c, notmodified, sizeof notmodified - 1, 0);
+ continue;
+ }
+ if (strstr(buffer, "HEAD /head"))
+ {
+ send(c, headmsg, sizeof headmsg - 1, 0);
+ continue;
}
if (strstr(buffer, "GET /quit"))
{
@@ -1899,6 +1928,7 @@
}
shutdown(c, 2);
closesocket(c);
+ c = -1;
} while (!last_request);
@@ -2132,7 +2162,7 @@
{
static const WCHAR no_contentW[] =
{'/','n','o','_','c','o','n','t','e','n','t',0};
HINTERNET ses, con, req;
- WCHAR buf[128];
+ char buf[128];
DWORD size, len = sizeof(buf), bytes_read, status;
BOOL ret;
@@ -2184,6 +2214,7 @@
ok(size == 0, "expected 0, got %d\n", size);
ret = WinHttpReadData(req, buf, len, &bytes_read);
+ ok(ret, "expected success\n");
ok( bytes_read == 0, "expected 0, got %u available\n", bytes_read );
size = 12345;
@@ -2203,6 +2234,114 @@
WinHttpCloseHandle(con);
WinHttpCloseHandle(ses);
+}
+
+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, 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, verbW, headW, 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, "failed to receive response %u\n", GetLastError());
+
+ status = 0xdeadbeef;
+ size = sizeof(status);
+ ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_STATUS_CODE |
WINHTTP_QUERY_FLAG_NUMBER,
+ NULL, &status, &size, NULL);
+ ok(ret, "failed to get status code %u\n", GetLastError());
+ ok(status == 200, "got %u\n", status);
+
+ len = 0xdeadbeef;
+ size = sizeof(len);
+ ret = WinHttpQueryHeaders(req, WINHTTP_QUERY_CONTENT_LENGTH |
WINHTTP_QUERY_FLAG_NUMBER,
+ NULL, &len, &size, 0);
+ ok(ret, "failed to get content-length header %u\n", GetLastError());
+ ok(len == 100, "got %u\n", len);
+
+ count = 0xdeadbeef;
+ ret = WinHttpQueryDataAvailable(req, &count);
+ ok(ret, "failed to query data available %u\n", GetLastError());
+ ok(!count, "got %u\n", count);
+
+ len = sizeof(buf);
+ count = 0xdeadbeef;
+ ret = WinHttpReadData(req, buf, len, &count);
+ ok(ret, "failed to read data %u\n", GetLastError());
+ ok(!count, "got %u\n", count);
+
+ count = 0xdeadbeef;
+ ret = WinHttpQueryDataAvailable(req, &count);
+ ok(ret, "failed to query data available %u\n", GetLastError());
+ ok(!count, "got %u\n", count);
+
+ WinHttpCloseHandle(req);
+ WinHttpCloseHandle(con);
+ WinHttpCloseHandle(ses);
+}
+
+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',':','
'};
+ BOOL ret;
+ HINTERNET session, request, connection;
+ DWORD status, size, start = GetTickCount();
+ SYSTEMTIME st;
+ WCHAR today[(sizeof(ifmodifiedW) + WINHTTP_TIME_FORMAT_BUFSIZE)/sizeof(WCHAR) + 3];
+
+ memcpy(today, ifmodifiedW, sizeof(ifmodifiedW));
+ GetSystemTime(&st);
+ WinHttpTimeFromSystemTime(&st, &today[sizeof(ifmodifiedW)/sizeof(WCHAR)]);
+
+ session = WinHttpOpen(test_useragent, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
+ WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
+ ok(session != NULL, "WinHttpOpen failed: %u\n", GetLastError());
+
+ connection = WinHttpConnect(session, localhostW, port, 0);
+ ok(connection != NULL, "WinHttpConnect failed: %u\n", GetLastError());
+
+ request = WinHttpOpenRequest(connection, NULL, pathW, NULL, WINHTTP_NO_REFERER,
+ WINHTTP_DEFAULT_ACCEPT_TYPES, WINHTTP_FLAG_BYPASS_PROXY_CACHE);
+ ok(request != NULL, "WinHttpOpenrequest failed: %u\n", GetLastError());
+
+ ret = WinHttpSendRequest(request, today, ~0u, NULL, 0, 0, 0);
+ ok(ret, "WinHttpSendRequest failed: %u\n", GetLastError());
+
+ ret = WinHttpReceiveResponse(request, NULL);
+ ok(ret, "WinHttpReceiveResponse failed: %u\n", GetLastError());
+
+ size = sizeof(status);
+ ret = WinHttpQueryHeaders(request,
WINHTTP_QUERY_STATUS_CODE|WINHTTP_QUERY_FLAG_NUMBER,
+ NULL, &status, &size, NULL);
+ ok(ret, "WinHttpQueryHeaders failed: %u\n", GetLastError());
+ ok(status == HTTP_STATUS_NOT_MODIFIED, "got %u\n", status);
+
+ size = 0xdeadbeef;
+ ret = WinHttpQueryDataAvailable(request, &size);
+ ok(ret, "WinHttpQueryDataAvailable failed: %u\n", GetLastError());
+ ok(!size, "got %u\n", size);
+
+ WinHttpCloseHandle(request);
+ WinHttpCloseHandle(connection);
+ WinHttpCloseHandle(session);
+ start = GetTickCount() - start;
+ ok(start <= 2000, "Expected less than 2 seconds for the test, got %u
ms\n", start);
}
static void test_bad_header( int port )
@@ -2491,11 +2630,15 @@
IWinHttpRequest *req;
BSTR method, url, username, password, response = NULL, status_text = NULL, headers =
NULL;
BSTR date, today, connection, value = NULL;
- VARIANT async, empty, timeout, body, proxy_server, bypass_list, data;
+ VARIANT async, empty, timeout, body, body2, proxy_server, bypass_list, data;
VARIANT_BOOL succeeded;
LONG status;
WCHAR todayW[WINHTTP_TIME_FORMAT_BUFSIZE];
SYSTEMTIME st;
+ IStream *stream, *stream2;
+ LARGE_INTEGER pos;
+ char buf[128];
+ DWORD count;
GetSystemTime( &st );
WinHttpTimeFromSystemTime( &st, todayW );
@@ -2547,8 +2690,7 @@
hr = IWinHttpRequest_Abort( req );
ok( hr == S_OK, "got %08x\n", hr );
- hr = IWinHttpRequest_Release( req );
- ok( hr == S_OK, "got %08x\n", hr );
+ IWinHttpRequest_Release( req );
hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER,
&IID_IWinHttpRequest, (void **)&req );
ok( hr == S_OK, "got %08x\n", hr );
@@ -2581,8 +2723,7 @@
hr = IWinHttpRequest_Abort( req );
ok( hr == S_OK, "got %08x\n", hr );
- hr = IWinHttpRequest_Release( req );
- ok( hr == S_OK, "got %08x\n", hr );
+ IWinHttpRequest_Release( req );
hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER,
&IID_IWinHttpRequest, (void **)&req );
ok( hr == S_OK, "got %08x\n", hr );
@@ -2841,6 +2982,41 @@
hr = VariantClear( &body );
ok( hr == S_OK, "got %08x\n", hr );
+ VariantInit( &body );
+ V_VT( &body ) = VT_ERROR;
+ hr = IWinHttpRequest_get_ResponseStream( req, &body );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( V_VT( &body ) == VT_UNKNOWN, "got %08x\n", V_VT( &body ) );
+
+ hr = IUnknown_QueryInterface( V_UNKNOWN( &body ), &IID_IStream, (void
**)&stream );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( V_UNKNOWN( &body ) == (IUnknown *)stream, "got different interface
pointer\n" );
+
+ buf[0] = 0;
+ count = 0xdeadbeef;
+ hr = IStream_Read( stream, buf, 128, &count );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( count != 0xdeadbeef, "count not set\n" );
+ ok( buf[0], "no data\n" );
+
+ VariantInit( &body2 );
+ V_VT( &body2 ) = VT_ERROR;
+ hr = IWinHttpRequest_get_ResponseStream( req, &body2 );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( V_VT( &body2 ) == VT_UNKNOWN, "got %08x\n", V_VT( &body2 ) );
+ ok( V_UNKNOWN( &body ) != V_UNKNOWN( &body2 ), "got same interface
pointer\n" );
+
+ hr = IUnknown_QueryInterface( V_UNKNOWN( &body2 ), &IID_IStream, (void
**)&stream2 );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( V_UNKNOWN( &body2 ) == (IUnknown *)stream2, "got different interface
pointer\n" );
+ IStream_Release( stream2 );
+
+ hr = VariantClear( &body );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = VariantClear( &body2 );
+ ok( hr == S_OK, "got %08x\n", hr );
+
hr = IWinHttpRequest_SetProxy( req, HTTPREQUEST_PROXYSETTING_PROXY, proxy_server,
bypass_list );
ok( hr == S_OK, "got %08x\n", hr );
@@ -2870,8 +3046,35 @@
hr = IWinHttpRequest_Abort( req );
ok( hr == S_OK, "got %08x\n", hr );
- hr = IWinHttpRequest_Release( req );
- ok( hr == S_OK, "got %08x\n", hr );
+ IWinHttpRequest_Release( req );
+
+ pos.QuadPart = 0;
+ IStream_Seek( stream, pos, STREAM_SEEK_SET, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ buf[0] = 0;
+ count = 0xdeadbeef;
+ hr = IStream_Read( stream, buf, 128, &count );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( count != 0xdeadbeef, "count not set\n" );
+ ok( buf[0], "no data\n" );
+ IStream_Release( stream );
+
+ hr = CoCreateInstance( &CLSID_WinHttpRequest, NULL, CLSCTX_INPROC_SERVER,
&IID_IWinHttpRequest, (void **)&req );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ V_VT( &async ) = VT_I4;
+ V_I4( &async ) = 1;
+ hr = IWinHttpRequest_Open( req, method, url, async );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = IWinHttpRequest_Send( req, empty );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ hr = IWinHttpRequest_WaitForResponse( req, timeout, &succeeded );
+ ok( hr == S_OK, "got %08x\n", hr );
+
+ IWinHttpRequest_Release( req );
SysFreeString( method );
SysFreeString( url );
@@ -3047,12 +3250,8 @@
options.dwAutoDetectFlags = WINHTTP_AUTO_DETECT_TYPE_DNS_A;
memset( &info, 0, sizeof(info) );
- SetLastError(0xdeadbeef);
ret = WinHttpGetProxyForUrl( session, urlW, &options, &info );
- error = GetLastError();
- if (!ret) ok( error == ERROR_WINHTTP_AUTODETECTION_FAILED ||
- error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n",
error );
- else
+ if (ret)
{
trace("Proxy.AccessType=%u\n", info.dwAccessType);
trace("Proxy.Proxy=%s\n", wine_dbgstr_w(info.lpszProxy));
@@ -3066,11 +3265,8 @@
options.lpszAutoConfigUrl = wpadW;
memset( &info, 0, sizeof(info) );
- SetLastError(0xdeadbeef);
ret = WinHttpGetProxyForUrl( session, urlW, &options, &info );
- error = GetLastError();
- if (!ret) ok( error == ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT, "got %u\n",
error );
- else
+ if (ret)
{
trace("Proxy.AccessType=%u\n", info.dwAccessType);
trace("Proxy.Proxy=%s\n", wine_dbgstr_w(info.lpszProxy));
@@ -3204,6 +3400,8 @@
test_basic_request(si.port, NULL, basicW);
test_no_headers(si.port);
test_no_content(si.port);
+ test_head_request(si.port);
+ test_not_modified(si.port);
test_basic_authentication(si.port);
test_bad_header(si.port);
test_multiple_reads(si.port);