Author: akhaldi
Date: Wed Apr 22 08:38:32 2015
New Revision: 67344
URL:
http://svn.reactos.org/svn/reactos?rev=67344&view=rev
Log:
[WININET_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
Modified:
trunk/rostests/winetests/wininet/ftp.c
trunk/rostests/winetests/wininet/http.c
trunk/rostests/winetests/wininet/internet.c
Modified: trunk/rostests/winetests/wininet/ftp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/ftp.c?r…
==============================================================================
--- trunk/rostests/winetests/wininet/ftp.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/wininet/ftp.c [iso-8859-1] Wed Apr 22 08:38:32 2015
@@ -754,6 +754,7 @@
HINTERNET hSearch2;
HINTERNET hOpenFile;
DWORD error;
+ BOOL success;
/* NULL as the search file ought to return the first file in the directory */
SetLastError(0xdeadbeef);
@@ -773,13 +774,13 @@
/* Try a valid filename in a subdirectory search */
SetLastError(0xdeadbeef);
hSearch = FtpFindFirstFileA(hFtp, "pub/wine", &findData, 0, 0);
- todo_wine ok ( hSearch != NULL, "Expected FtpFindFirstFileA to pass\n" );
+ ok( hSearch != NULL, "Expected FtpFindFirstFileA to pass\n" );
InternetCloseHandle(hSearch);
/* Try a valid filename in a subdirectory wildcard search */
SetLastError(0xdeadbeef);
hSearch = FtpFindFirstFileA(hFtp, "pub/w*", &findData, 0, 0);
- todo_wine ok ( hSearch != NULL, "Expected FtpFindFirstFileA to pass\n" );
+ ok( hSearch != NULL, "Expected FtpFindFirstFileA to pass\n" );
InternetCloseHandle(hSearch);
/* Try an invalid wildcard search */
@@ -787,6 +788,24 @@
hSearch = FtpFindFirstFileA(hFtp, "*/w*", &findData, 0, 0);
ok ( hSearch == NULL, "Expected FtpFindFirstFileA to fail\n" );
InternetCloseHandle(hSearch); /* Just in case */
+
+ /* change current directory, and repeat those tests - this shows
+ * that the search string is interpreted as relative directory. */
+ success = FtpSetCurrentDirectoryA(hFtp, "pub");
+ ok( success, "Expected FtpSetCurrentDirectory to succeed\n" );
+
+ SetLastError(0xdeadbeef);
+ hSearch = FtpFindFirstFileA(hFtp, "wine", &findData, 0, 0);
+ ok( hSearch != NULL, "Expected FtpFindFirstFileA to pass\n" );
+ InternetCloseHandle(hSearch);
+
+ SetLastError(0xdeadbeef);
+ hSearch = FtpFindFirstFileA(hFtp, "w*", &findData, 0, 0);
+ ok( hSearch != NULL, "Expected FtpFindFirstFileA to pass\n" );
+ InternetCloseHandle(hSearch);
+
+ success = FtpSetCurrentDirectoryA(hFtp, "..");
+ ok( success, "Expected FtpSetCurrentDirectory to succeed\n" );
/* Try FindFirstFile between FtpOpenFile and InternetCloseHandle */
SetLastError(0xdeadbeef);
Modified: trunk/rostests/winetests/wininet/http.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/http.c?…
==============================================================================
--- trunk/rostests/winetests/wininet/http.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/wininet/http.c [iso-8859-1] Wed Apr 22 08:38:32 2015
@@ -2295,9 +2295,37 @@
else if (strstr(buffer, "Cache-Control: no-cache\r\n")) send(c,
okmsg, sizeof(okmsg)-1, 0);
else send(c, notokmsg, sizeof(notokmsg)-1, 0);
}
+ if (strstr(buffer, "/test_request_content_length"))
+ {
+ static char msg[] = "HTTP/1.1 200 OK\r\nConnection:
Keep-Alive\r\n\r\n";
+ static int seen_content_length;
+
+ if (!seen_content_length)
+ {
+ if (strstr(buffer, "Content-Length: 0"))
+ {
+ seen_content_length = 1;
+ send(c, msg, sizeof msg-1, 0);
+ }
+ else send(c, notokmsg, sizeof notokmsg-1, 0);
+ WaitForSingleObject(hCompleteEvent, 5000);
+ }
+ else
+ {
+ if (strstr(buffer, "Content-Length: 0")) send(c, msg, sizeof
msg-1, 0);
+ else send(c, notokmsg, sizeof notokmsg-1, 0);
+ WaitForSingleObject(hCompleteEvent, 5000);
+ }
+ }
if (strstr(buffer, "GET /test_premature_disconnect"))
trace("closing connection\n");
-
+ if (strstr(buffer, "/test_accept_encoding_http10"))
+ {
+ if (strstr(buffer, "Accept-Encoding: gzip"))
+ send(c, okmsg, sizeof okmsg-1, 0);
+ else
+ send(c, notokmsg, sizeof notokmsg-1, 0);
+ }
shutdown(c, 2);
closesocket(c);
c = -1;
@@ -4120,6 +4148,79 @@
InternetCloseHandle(session);
}
+static void test_request_content_length(int port)
+{
+ char data[] = {'t','e','s','t'};
+ HINTERNET ses, con, req;
+ BOOL ret;
+
+ hCompleteEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
+
+ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+ ok(ses != NULL, "InternetOpen failed\n");
+
+ con = InternetConnectA(ses, "localhost", port, NULL, NULL,
INTERNET_SERVICE_HTTP, 0, 0);
+ ok(con != NULL, "InternetConnect failed\n");
+
+ req = HttpOpenRequestA(con, "POST",
"/test_request_content_length", NULL, NULL, NULL,
+ INTERNET_FLAG_KEEP_CONNECTION, 0);
+ ok(req != NULL, "HttpOpenRequest failed\n");
+
+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
+ ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+ test_status_code(req, 200);
+
+ SetEvent(hCompleteEvent);
+
+ ret = HttpSendRequestA(req, NULL, 0, data, sizeof(data));
+ ok(ret, "HttpSendRequest failed %u\n", GetLastError());
+ test_status_code(req, 200);
+
+ SetEvent(hCompleteEvent);
+
+ InternetCloseHandle(req);
+ InternetCloseHandle(con);
+ InternetCloseHandle(ses);
+ CloseHandle(hCompleteEvent);
+}
+
+static void test_accept_encoding(int port)
+{
+ HINTERNET ses, con, req;
+ BOOL ret;
+
+ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL,
0);
+ ok(ses != NULL, "InternetOpen failed\n");
+
+ con = InternetConnectA(ses, "localhost", port, NULL, NULL,
INTERNET_SERVICE_HTTP, 0, 0);
+ ok(con != NULL, "InternetConnect failed\n");
+
+ req = HttpOpenRequestA(con, "GET",
"/test_accept_encoding_http10", "HTTP/1.0", NULL, NULL, 0, 0);
+ ok(req != NULL, "HttpOpenRequest failed\n");
+
+ ret = HttpAddRequestHeadersA(req, "Accept-Encoding: gzip\r\n", ~0u,
HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
+ ok(ret, "HttpAddRequestHeaders failed\n");
+
+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0);
+ ok(ret, "HttpSendRequestA failed\n");
+
+ test_status_code(req, 200);
+
+ InternetCloseHandle(req);
+
+ req = HttpOpenRequestA(con, "GET",
"/test_accept_encoding_http10", "HTTP/1.0", NULL, NULL, 0, 0);
+ ok(req != NULL, "HttpOpenRequest failed\n");
+
+ ret = HttpSendRequestA(req, "Accept-Encoding: gzip", ~0u, NULL, 0);
+ ok(ret, "HttpSendRequestA failed\n");
+
+ test_status_code(req, 200);
+
+ InternetCloseHandle(req);
+ InternetCloseHandle(con);
+ InternetCloseHandle(ses);
+}
+
static void test_http_connection(void)
{
struct server_info si;
@@ -4165,6 +4266,8 @@
test_cache_control_verb(si.port);
test_successive_HttpSendRequest(si.port);
test_head_request(si.port);
+ test_request_content_length(si.port);
+ test_accept_encoding(si.port);
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, "GET", "/quit");
@@ -4232,7 +4335,7 @@
ok(!info.lpszSignatureAlgName, "lpszSignatureAlgName = %s\n",
info.lpszSignatureAlgName);
ok(!info.lpszEncryptionAlgName, "lpszEncryptionAlgName = %s\n",
info.lpszEncryptionAlgName);
ok(!info.lpszProtocolName, "lpszProtocolName = %s\n",
info.lpszProtocolName);
- ok(info.dwKeySize == 128 || info.dwKeySize == 256, "dwKeySize = %u\n",
info.dwKeySize);
+ ok(info.dwKeySize >= 128 && info.dwKeySize <= 256, "dwKeySize =
%u\n", info.dwKeySize);
release_cert_info(&info);
}
@@ -5484,6 +5587,55 @@
#undef STATUS_STRING
}
+static void WINAPI header_cb( HINTERNET handle, DWORD_PTR ctx, DWORD status, LPVOID info,
DWORD len )
+{
+ if (status == INTERNET_STATUS_REQUEST_COMPLETE) SetEvent( (HANDLE)ctx );
+}
+
+static void test_concurrent_header_access(void)
+{
+ HINTERNET ses, con, req;
+ DWORD index, len, err;
+ BOOL ret;
+ char buf[128];
+ HANDLE wait = CreateEventW( NULL, FALSE, FALSE, NULL );
+
+ ses = InternetOpenA( "winetest", 0, NULL, NULL, INTERNET_FLAG_ASYNC );
+ ok( ses != NULL, "InternetOpenA failed\n" );
+
+ con = InternetConnectA( ses, "test.winehq.org", INTERNET_DEFAULT_HTTP_PORT,
NULL, NULL,
+ INTERNET_SERVICE_HTTP, 0, 0 );
+ ok( con != NULL, "InternetConnectA failed %u\n", GetLastError() );
+
+ req = HttpOpenRequestA( con, NULL, "/", NULL, NULL, NULL, 0,
(DWORD_PTR)wait );
+ ok( req != NULL, "HttpOpenRequestA failed %u\n", GetLastError() );
+
+ pInternetSetStatusCallbackA( req, header_cb );
+
+ SetLastError( 0xdeadbeef );
+ ret = HttpSendRequestA( req, NULL, 0, NULL, 0 );
+ err = GetLastError();
+ ok( !ret, "HttpSendRequestA succeeded\n" );
+ ok( err == ERROR_IO_PENDING, "got %u\n", ERROR_IO_PENDING );
+
+ ret = HttpAddRequestHeadersA( req, "winetest: winetest", ~0u,
HTTP_ADDREQ_FLAG_ADD );
+ ok( ret, "HttpAddRequestHeadersA failed %u\n", GetLastError() );
+
+ index = 0;
+ len = sizeof(buf);
+ ret = HttpQueryInfoA( req,
HTTP_QUERY_RAW_HEADERS_CRLF|HTTP_QUERY_FLAG_REQUEST_HEADERS,
+ buf, &len, &index );
+ ok( ret, "HttpQueryInfoA failed %u\n", GetLastError() );
+ ok( strstr( buf, "winetest: winetest" ) != NULL, "header
missing\n" );
+
+ WaitForSingleObject( wait, 5000 );
+
+ InternetCloseHandle( req );
+ InternetCloseHandle( con );
+ InternetCloseHandle( ses );
+ CloseHandle( wait );
+}
+
START_TEST(http)
{
HMODULE hdll;
@@ -5526,4 +5678,5 @@
InternetReadFile_test(INTERNET_FLAG_ASYNC, &test_data[3]);
test_connection_failure();
test_default_service_port();
-}
+ test_concurrent_header_access();
+}
Modified: trunk/rostests/winetests/wininet/internet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/wininet/interne…
==============================================================================
--- trunk/rostests/winetests/wininet/internet.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/wininet/internet.c [iso-8859-1] Wed Apr 22 08:38:32 2015
@@ -1526,19 +1526,16 @@
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags,
buffer);
res = pInternetGetConnectedStateExA(NULL, NULL, 0, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
flags = 0;
res = pInternetGetConnectedStateExA(&flags, NULL, 0, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, 0, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
@@ -1557,6 +1554,11 @@
sz = strlen(buffer);
ok(sz > 0, "Expected a connection name\n");
+ flags = 0;
+ res = pInternetGetConnectedStateExA(&flags, NULL, sizeof(buffer), 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+
/* no space for complete string this time */
buffer[0] = 0;
flags = 0;
@@ -1567,11 +1569,31 @@
buffer[0] = 0;
flags = 0;
+ res = pInternetGetConnectedStateExA(&flags, buffer, sz / 2, 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+ ok(sz / 2 - 1 == strlen(buffer), "Expected %u bytes, got %u\n", sz / 2 - 1,
lstrlenA(buffer));
+
+ buffer[0] = 0;
+ flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
- ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer));
+ ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenA(buffer));
+
+ buffer[0] = 0;
+ flags = 0;
+ res = pInternetGetConnectedStateExA(&flags, buffer, 2, 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+ ok(strlen(buffer) == 1, "Expected 1 byte, got %u\n", lstrlenA(buffer));
+
+ flags = 0;
+ buffer[0] = 0xDE;
+ res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+ ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenA(buffer));
}
static void test_InternetGetConnectedStateExW(void)
@@ -1593,12 +1615,10 @@
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags,
wine_dbgstr_w(buffer));
res = pInternetGetConnectedStateExW(NULL, NULL, 0, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
flags = 0;
res = pInternetGetConnectedStateExW(&flags, NULL, 0, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
@@ -1607,7 +1627,6 @@
res = pInternetGetConnectedStateExW(&flags, buffer, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
-todo_wine
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
buffer[0] = 0;
@@ -1624,6 +1643,11 @@
sz = lstrlenW(buffer);
ok(sz > 0, "Expected a connection name\n");
+ flags = 0;
+ res = pInternetGetConnectedStateExW(&flags, NULL, sizeof(buffer) /
sizeof(buffer[0]), 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+
/* no space for complete string this time */
buffer[0] = 0;
flags = 0;
@@ -1634,11 +1658,31 @@
buffer[0] = 0;
flags = 0;
+ res = pInternetGetConnectedStateExW(&flags, buffer, sz / 2, 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+ ok(sz / 2 - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz / 2 -
1, lstrlenW(buffer));
+
+ buffer[0] = 0;
+ flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0);
-todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
- ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer));
+ ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
+
+ buffer[0] = 0;
+ flags = 0;
+ res = pInternetGetConnectedStateExW(&flags, buffer, 2, 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+ ok(lstrlenW(buffer) == 1, "Expected 1 byte, got %u\n", lstrlenW(buffer));
+
+ buffer[0] = 0xDEAD;
+ flags = 0;
+ res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0);
+ ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ ok(flags, "Expected at least one flag set\n");
+ ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer));
}
/* ############################### */