[2/2] wininet/tests: Add HTTP 1.1 test
Alexander Morozov
amorozov at etersoft.ru
Wed Jul 2 03:22:08 CDT 2008
Changelog:
Add HTTP 1.1 test
If HTTP 1.1 is enabled
(HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\EnableHttp1_1 is 1) Windows does not reconnect each time when
HttpOpenRequest is calling.
-------------- next part --------------
From e557d1f397912551b697eb2340d67d33b5b53037 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov at builder.office.etersoft.ru>
Date: Wed, 2 Jul 2008 11:56:12 +0400
Subject: [PATCH] wininet/tests: Add HTTP 1.1 test
---
dlls/wininet/tests/http.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index cbea852..d6da2ca 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -1347,6 +1347,7 @@ static DWORD CALLBACK server_thread(LPVOID param)
WSADATA wsaData;
int last_request = 0;
char host_header[22];
+ static int test_b = 0;
WSAStartup(MAKEWORD(1,1), &wsaData);
@@ -1481,6 +1482,13 @@ static DWORD CALLBACK server_thread(LPVOID param)
else
send(c, notokmsg, sizeof notokmsg-1, 0);
}
+ if (!test_b && strstr(buffer, "/testB HTTP/1.1"))
+ {
+ test_b = 1;
+ send(c, okmsg, sizeof okmsg-1, 0);
+ recvfrom(c, buffer, sizeof buffer, 0, NULL, NULL);
+ send(c, okmsg, sizeof okmsg-1, 0);
+ }
if (strstr(buffer, "GET /quit"))
{
send(c, okmsg, sizeof okmsg-1, 0);
@@ -1779,6 +1787,38 @@ static void test_connection_header(int port)
InternetCloseHandle(ses);
}
+static void test_http1_1(int port)
+{
+ HINTERNET ses, con, req;
+ BOOL ret;
+
+ ses = InternetOpen("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
+ ok(ses != NULL, "InternetOpen failed\n");
+
+ con = InternetConnect(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
+ ok(con != NULL, "InternetConnect failed\n");
+
+ req = HttpOpenRequest(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+ ok(req != NULL, "HttpOpenRequest failed\n");
+
+ ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+ if (ret)
+ {
+ InternetCloseHandle(req);
+
+ req = HttpOpenRequest(con, NULL, "/testB", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0);
+ ok(req != NULL, "HttpOpenRequest failed\n");
+
+ ret = HttpSendRequest(req, NULL, 0, NULL, 0);
+ todo_wine
+ ok(ret, "HttpSendRequest failed\n");
+ }
+
+ InternetCloseHandle(req);
+ InternetCloseHandle(con);
+ InternetCloseHandle(ses);
+}
+
static void test_http_connection(void)
{
struct server_info si;
@@ -1803,6 +1843,7 @@ static void test_http_connection(void)
test_basic_request(si.port, "POST", "/test5");
test_basic_request(si.port, "GET", "/test6");
test_connection_header(si.port);
+ test_http1_1(si.port);
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, "GET", "/quit");
--
1.5.4.5.GIT
More information about the wine-patches
mailing list