Added patch to allow Accept-Encoding for HTTP/1.0 in wininet.

This commit is contained in:
Michael Müller 2014-12-08 03:02:18 +01:00
parent ec9701cec2
commit 8369b0ce86
5 changed files with 151 additions and 1 deletions

View File

@ -37,13 +37,14 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [5]:**
**Bugfixes and features included in the next upcoming release [6]:**
* Add support for GetPropValue to PulseAudio backend
* Fix condition mask handling in RtlVerifyVersionInfo ([Wine Bug #36143](https://bugs.winehq.org/show_bug.cgi?id=36143))
* Fix possible segfault in pulse_rd_loop of PulseAudio backend
* Set last error when GetRawInputDeviceList fails ([Wine Bug #37667](https://bugs.winehq.org/show_bug.cgi?id=37667))
* Support for StrCatChainW
* wininet should allow Accept-Encoding header for HTTP/1.0 ([Wine Bug #37046](https://bugs.winehq.org/show_bug.cgi?id=37046))
**Bugs fixed in Wine Staging 1.7.32 [108]:**

1
debian/changelog vendored
View File

@ -5,6 +5,7 @@ wine-compholio (1.7.33) UNRELEASED; urgency=low
* Added patch to fix possible segfault in pulse_rd_loop of PulseAudio backend.
* Added patch to implement support for GetPropValue to PulseAudio backend.
* Added patch to implement shlwapi.StrCatChainW.
* Added patch to allow Accept-Encoding for HTTP/1.0 in wininet.
* Removed patch to fix copy and paste errors in ws2_32 tests (accepted upstream).
* Removed patch to fix ordering of IP addresses by metric if two addresses have the same metric (accepted upstream).
* Removed patch to reset data->pWintrustData->u.pFile->hFile after closing handle (accepted upstream).

View File

@ -122,6 +122,7 @@ PATCHLIST := \
winex11-Window_Groups.ok \
winex11-XEMBED.ok \
winex11-wglShareLists.ok \
wininet-encoding.ok \
wpcap-Dynamic_Linking.ok \
ws2_32-Connect_Time.ok \
ws2_32-TransmitFile.ok \
@ -1951,6 +1952,21 @@ winex11-wglShareLists.ok:
echo '+ { "Michael Müller", "winex11.drv: Only warn about used contexts in wglShareLists.", 1 },'; \
) > winex11-wglShareLists.ok
# Patchset wininet-encoding
# |
# | This patchset fixes the following Wine bugs:
# | * [#37046] wininet should allow Accept-Encoding header for HTTP/1.0
# |
# | Modified files:
# | * dlls/wininet/http.c, dlls/wininet/tests/http.c
# |
.INTERMEDIATE: wininet-encoding.ok
wininet-encoding.ok:
$(call APPLY_FILE,wininet-encoding/0001-wininet-Allow-Accept-Encoding-for-HTTP-1.0-requests.patch)
@( \
echo '+ { "Michael Müller", "wininet: Allow Accept-Encoding for HTTP/1.0 requests.", 1 },'; \
) > wininet-encoding.ok
# Patchset wpcap-Dynamic_Linking
# |
# | Modified files:

View File

@ -0,0 +1,131 @@
From b8cd3a50b3b381828b3bc604a8cd6d7d69e8a9cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Mon, 8 Dec 2014 02:51:30 +0100
Subject: wininet: Allow Accept-Encoding for HTTP/1.0 requests.
---
dlls/wininet/http.c | 22 ++--------------------
dlls/wininet/tests/http.c | 46 +++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 47 insertions(+), 21 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index cb30b26..3cda082 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -219,7 +219,6 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len );
static DWORD HTTP_HttpQueryInfoW(http_request_t*, DWORD, LPVOID, LPDWORD, LPDWORD);
static LPWSTR HTTP_GetRedirectURL(http_request_t *req, LPCWSTR lpszUrl);
static UINT HTTP_DecodeBase64(LPCWSTR base64, LPSTR bin);
-static BOOL HTTP_VerifyValidHeader(http_request_t *req, LPCWSTR field);
static BOOL drain_content(http_request_t*,BOOL);
static CRITICAL_SECTION connection_pool_cs;
@@ -1321,10 +1320,8 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request,
pFieldAndValue = HTTP_InterpretHttpHeader(lpszStart);
if (pFieldAndValue)
{
- res = HTTP_VerifyValidHeader(request, pFieldAndValue[0]);
- if (res == ERROR_SUCCESS)
- res = HTTP_ProcessHeader(request, pFieldAndValue[0],
- pFieldAndValue[1], dwModifier | HTTP_ADDHDR_FLAG_REQ);
+ res = HTTP_ProcessHeader(request, pFieldAndValue[0],
+ pFieldAndValue[1], dwModifier | HTTP_ADDHDR_FLAG_REQ);
HTTP_FreeTokens(pFieldAndValue);
}
@@ -6345,21 +6342,6 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
/***********************************************************************
- * HTTP_VerifyValidHeader (internal)
- *
- * Verify the given header is not invalid for the given http request
- *
- */
-static BOOL HTTP_VerifyValidHeader(http_request_t *request, LPCWSTR field)
-{
- /* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */
- if (!strcmpW(request->version, g_szHttp1_0) && !strcmpiW(field, szAccept_Encoding))
- return ERROR_HTTP_INVALID_HEADER;
-
- return ERROR_SUCCESS;
-}
-
-/***********************************************************************
* IsHostInProxyBypassList (@)
*
* Undocumented
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 98c8d62..ac1b0ba 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -2292,7 +2292,13 @@ static DWORD CALLBACK server_thread(LPVOID param)
}
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;
@@ -4111,6 +4117,43 @@ static void test_cache_control_verb(int port)
InternetCloseHandle(session);
}
+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;
@@ -4156,6 +4199,7 @@ static void test_http_connection(void)
test_cache_control_verb(si.port);
test_successive_HttpSendRequest(si.port);
test_head_request(si.port);
+ test_accept_encoding(si.port);
/* send the basic request again to shutdown the server thread */
test_basic_request(si.port, "GET", "/quit");
--
1.9.1

View File

@ -0,0 +1 @@
Fixes: [37046] wininet should allow Accept-Encoding header for HTTP/1.0