From 975564c566d4bba3093f68f929ac29bc9bb5879f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 16 May 2015 03:00:35 +0200 Subject: [PATCH] wininet-Cleanup: Added next couple of patches and merge with wininet-Memory_Leak. --- patches/patchinstall.sh | 42 ++++------ ...ry-leak-by-not-calling-get_cookie_he.patch | 2 +- ...et-tests-Add-more-tests-for-cookies.patch} | 2 +- ...dd-tests-for-overriding-host-header.patch} | 2 +- ...t-auth-credential-reusage-with-host.patch} | 2 +- ...ck-cookie-behaviour-when-overriding.patch} | 2 +- ...st-server-name-when-processing-cook.patch} | 4 +- ...-Delay-setting-the-http-host-header.patch} | 6 +- ...st-server-canon_host_port-in-authen.patch} | 6 +- ...st-server-canon_host_port-when-quer.patch} | 4 +- ...x-arguments-of-HttpAddRequestHeaders.patch | 34 ++++++++ ...x-arguments-of-HttpAddRequestHeaders.patch | 74 +++++++++++++++++ ...filename-if-no-path-is-set-in-cookie.patch | 83 +++++++++++++++++++ 13 files changed, 223 insertions(+), 40 deletions(-) rename patches/{wininet-Memory_Leak => wininet-Cleanup}/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch (91%) rename patches/wininet-Cleanup/{0001-wininet-tests-Add-more-tests-for-cookies.patch => 0002-wininet-tests-Add-more-tests-for-cookies.patch} (98%) rename patches/wininet-Cleanup/{0002-wininet-tests-Add-tests-for-overriding-host-header.patch => 0003-wininet-tests-Add-tests-for-overriding-host-header.patch} (98%) rename patches/wininet-Cleanup/{0003-wininet-tests-Test-auth-credential-reusage-with-host.patch => 0004-wininet-tests-Test-auth-credential-reusage-with-host.patch} (98%) rename patches/wininet-Cleanup/{0004-wininet-tests-Check-cookie-behaviour-when-overriding.patch => 0005-wininet-tests-Check-cookie-behaviour-when-overriding.patch} (98%) rename patches/wininet-Cleanup/{0005-wininet-Use-request-server-name-when-processing-cook.patch => 0006-wininet-Use-request-server-name-when-processing-cook.patch} (93%) rename patches/wininet-Cleanup/{0006-wininet-Delay-setting-the-http-host-header.patch => 0007-wininet-Delay-setting-the-http-host-header.patch} (97%) rename patches/wininet-Cleanup/{0007-wininet-Use-request-server-canon_host_port-in-authen.patch => 0008-wininet-Use-request-server-canon_host_port-in-authen.patch} (91%) rename patches/wininet-Cleanup/{0008-wininet-Use-request-server-canon_host_port-when-quer.patch => 0009-wininet-Use-request-server-canon_host_port-when-quer.patch} (95%) create mode 100644 patches/wininet-Cleanup/0010-rpcrt4-Fix-arguments-of-HttpAddRequestHeaders.patch create mode 100644 patches/wininet-Cleanup/0011-wininet-Fix-arguments-of-HttpAddRequestHeaders.patch create mode 100644 patches/wininet-Cleanup/0012-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index e5928c8f..7393ea7b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -277,7 +277,6 @@ patch_enable_all () enable_winex11_XEMBED="$1" enable_winex11_wglShareLists="$1" enable_wininet_Cleanup="$1" - enable_wininet_Memory_Leak="$1" enable_wininet_ParseX509EncodedCertificateForListBoxEntry="$1" enable_winmm_Delay_Import_Depends="$1" enable_winsta_WinStationEnumerateW="$1" @@ -900,9 +899,6 @@ patch_enable () wininet-Cleanup) enable_wininet_Cleanup="$2" ;; - wininet-Memory_Leak) - enable_wininet_Memory_Leak="$2" - ;; wininet-ParseX509EncodedCertificateForListBoxEntry) enable_wininet_ParseX509EncodedCertificateForListBoxEntry="$2" ;; @@ -5509,18 +5505,23 @@ fi # | * [#28911] Add HTTP Host header in HttpSendRequest instead of HttpOpenRequest # | # | Modified files: -# | * dlls/wininet/http.c, dlls/wininet/tests/http.c +# | * dlls/rpcrt4/rpc_transport.c, dlls/wininet/http.c, dlls/wininet/tests/http.c # | if test "$enable_wininet_Cleanup" -eq 1; then - patch_apply wininet-Cleanup/0001-wininet-tests-Add-more-tests-for-cookies.patch - patch_apply wininet-Cleanup/0002-wininet-tests-Add-tests-for-overriding-host-header.patch - patch_apply wininet-Cleanup/0003-wininet-tests-Test-auth-credential-reusage-with-host.patch - patch_apply wininet-Cleanup/0004-wininet-tests-Check-cookie-behaviour-when-overriding.patch - patch_apply wininet-Cleanup/0005-wininet-Use-request-server-name-when-processing-cook.patch - patch_apply wininet-Cleanup/0006-wininet-Delay-setting-the-http-host-header.patch - patch_apply wininet-Cleanup/0007-wininet-Use-request-server-canon_host_port-in-authen.patch - patch_apply wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-when-quer.patch + patch_apply wininet-Cleanup/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch + patch_apply wininet-Cleanup/0002-wininet-tests-Add-more-tests-for-cookies.patch + patch_apply wininet-Cleanup/0003-wininet-tests-Add-tests-for-overriding-host-header.patch + patch_apply wininet-Cleanup/0004-wininet-tests-Test-auth-credential-reusage-with-host.patch + patch_apply wininet-Cleanup/0005-wininet-tests-Check-cookie-behaviour-when-overriding.patch + patch_apply wininet-Cleanup/0006-wininet-Use-request-server-name-when-processing-cook.patch + patch_apply wininet-Cleanup/0007-wininet-Delay-setting-the-http-host-header.patch + patch_apply wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-in-authen.patch + patch_apply wininet-Cleanup/0009-wininet-Use-request-server-canon_host_port-when-quer.patch + patch_apply wininet-Cleanup/0010-rpcrt4-Fix-arguments-of-HttpAddRequestHeaders.patch + patch_apply wininet-Cleanup/0011-wininet-Fix-arguments-of-HttpAddRequestHeaders.patch + patch_apply wininet-Cleanup/0012-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch ( + echo '+ { "Michael Müller", "wininet: Fix memory leak by not calling get_cookie_header twice.", 1 },'; echo '+ { "Michael Müller", "wininet/tests: Add more tests for cookies.", 1 },'; echo '+ { "Michael Müller", "wininet/tests: Add tests for overriding host header.", 1 },'; echo '+ { "Michael Müller", "wininet/tests: Test auth credential reusage with host override.", 1 },'; @@ -5529,18 +5530,9 @@ if test "$enable_wininet_Cleanup" -eq 1; then echo '+ { "Michael Müller", "wininet: Delay setting the http host header.", 1 },'; echo '+ { "Michael Müller", "wininet: Use request->server->canon_host_port in authentication process.", 1 },'; echo '+ { "Michael Müller", "wininet: Use request->server->canon_host_port when querying for INTERNET_OPTION_URL.", 1 },'; - ) >> "$patchlist" -fi - -# Patchset wininet-Memory_Leak -# | -# | Modified files: -# | * dlls/wininet/http.c -# | -if test "$enable_wininet_Memory_Leak" -eq 1; then - patch_apply wininet-Memory_Leak/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch - ( - echo '+ { "Michael Müller", "wininet: Fix memory leak by not calling get_cookie_header twice.", 1 },'; + echo '+ { "Michael Müller", "rpcrt4: Fix arguments of HttpAddRequestHeaders.", 1 },'; + echo '+ { "Michael Müller", "wininet: Fix arguments of HttpAddRequestHeaders.", 1 },'; + echo '+ { "Michael Müller", "wininet: Strip filename if no path is set in cookie.", 1 },'; ) >> "$patchlist" fi diff --git a/patches/wininet-Memory_Leak/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch b/patches/wininet-Cleanup/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch similarity index 91% rename from patches/wininet-Memory_Leak/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch rename to patches/wininet-Cleanup/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch index 29299fd0..a3c0735f 100644 --- a/patches/wininet-Memory_Leak/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch +++ b/patches/wininet-Cleanup/0001-wininet-Fix-memory-leak-by-not-calling-get_cookie_he.patch @@ -1,4 +1,4 @@ -From ea90cf45cda5a343daa2b50332bb956a8db12388 Mon Sep 17 00:00:00 2001 +From a849696bf25a87a84a565d8818fa1d4f5b1ebde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 15 May 2015 19:55:13 +0200 Subject: wininet: Fix memory leak by not calling get_cookie_header twice. diff --git a/patches/wininet-Cleanup/0001-wininet-tests-Add-more-tests-for-cookies.patch b/patches/wininet-Cleanup/0002-wininet-tests-Add-more-tests-for-cookies.patch similarity index 98% rename from patches/wininet-Cleanup/0001-wininet-tests-Add-more-tests-for-cookies.patch rename to patches/wininet-Cleanup/0002-wininet-tests-Add-more-tests-for-cookies.patch index 72fcbe79..9bb8e692 100644 --- a/patches/wininet-Cleanup/0001-wininet-tests-Add-more-tests-for-cookies.patch +++ b/patches/wininet-Cleanup/0002-wininet-tests-Add-more-tests-for-cookies.patch @@ -1,4 +1,4 @@ -From eb300f805c1d7009d60b4ad382e6d9af2669c453 Mon Sep 17 00:00:00 2001 +From 258182e1105befbf3ee6b6a388c07d1a84632fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 15 May 2015 20:37:19 +0200 Subject: wininet/tests: Add more tests for cookies. diff --git a/patches/wininet-Cleanup/0002-wininet-tests-Add-tests-for-overriding-host-header.patch b/patches/wininet-Cleanup/0003-wininet-tests-Add-tests-for-overriding-host-header.patch similarity index 98% rename from patches/wininet-Cleanup/0002-wininet-tests-Add-tests-for-overriding-host-header.patch rename to patches/wininet-Cleanup/0003-wininet-tests-Add-tests-for-overriding-host-header.patch index 20da937f..f1f9dfa8 100644 --- a/patches/wininet-Cleanup/0002-wininet-tests-Add-tests-for-overriding-host-header.patch +++ b/patches/wininet-Cleanup/0003-wininet-tests-Add-tests-for-overriding-host-header.patch @@ -1,4 +1,4 @@ -From 72b7eaf33df2d8460e8ed6659fe82e4e2e7cee90 Mon Sep 17 00:00:00 2001 +From 0f294422ff9d63808689d47eddb20945d74d2349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 15 May 2015 21:07:19 +0200 Subject: wininet/tests: Add tests for overriding host header. diff --git a/patches/wininet-Cleanup/0003-wininet-tests-Test-auth-credential-reusage-with-host.patch b/patches/wininet-Cleanup/0004-wininet-tests-Test-auth-credential-reusage-with-host.patch similarity index 98% rename from patches/wininet-Cleanup/0003-wininet-tests-Test-auth-credential-reusage-with-host.patch rename to patches/wininet-Cleanup/0004-wininet-tests-Test-auth-credential-reusage-with-host.patch index ad6dd71e..7daf2efb 100644 --- a/patches/wininet-Cleanup/0003-wininet-tests-Test-auth-credential-reusage-with-host.patch +++ b/patches/wininet-Cleanup/0004-wininet-tests-Test-auth-credential-reusage-with-host.patch @@ -1,4 +1,4 @@ -From 92d5f7bb41006cbe61ef3226abdb36bbb13d26dd Mon Sep 17 00:00:00 2001 +From 7a7b4bf4644553b821deea0287289ffe54207768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 15 May 2015 21:18:37 +0200 Subject: wininet/tests: Test auth credential reusage with host override. diff --git a/patches/wininet-Cleanup/0004-wininet-tests-Check-cookie-behaviour-when-overriding.patch b/patches/wininet-Cleanup/0005-wininet-tests-Check-cookie-behaviour-when-overriding.patch similarity index 98% rename from patches/wininet-Cleanup/0004-wininet-tests-Check-cookie-behaviour-when-overriding.patch rename to patches/wininet-Cleanup/0005-wininet-tests-Check-cookie-behaviour-when-overriding.patch index bffc9264..fa1018f5 100644 --- a/patches/wininet-Cleanup/0004-wininet-tests-Check-cookie-behaviour-when-overriding.patch +++ b/patches/wininet-Cleanup/0005-wininet-tests-Check-cookie-behaviour-when-overriding.patch @@ -1,4 +1,4 @@ -From 2b5e76bf213aaf2530b451e7f02bc848a1e88e49 Mon Sep 17 00:00:00 2001 +From 9e879920a222f6c795b836fb687b6d3549c8c36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 15 May 2015 23:09:20 +0200 Subject: wininet/tests: Check cookie behaviour when overriding host. diff --git a/patches/wininet-Cleanup/0005-wininet-Use-request-server-name-when-processing-cook.patch b/patches/wininet-Cleanup/0006-wininet-Use-request-server-name-when-processing-cook.patch similarity index 93% rename from patches/wininet-Cleanup/0005-wininet-Use-request-server-name-when-processing-cook.patch rename to patches/wininet-Cleanup/0006-wininet-Use-request-server-name-when-processing-cook.patch index 2ce9e9f7..42a2bb32 100644 --- a/patches/wininet-Cleanup/0005-wininet-Use-request-server-name-when-processing-cook.patch +++ b/patches/wininet-Cleanup/0006-wininet-Use-request-server-name-when-processing-cook.patch @@ -1,4 +1,4 @@ -From 73deec220b498f3a3ac6bf0674b9e0550f0aebdc Mon Sep 17 00:00:00 2001 +From d3936900b7650ff24b116c48457861ea3b78eef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 16 May 2015 01:34:22 +0200 Subject: wininet: Use request->server->name when processing cookies instead of @@ -9,7 +9,7 @@ Subject: wininet: Use request->server->name when processing cookies instead of 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c -index cd2cdcf..51ca427 100644 +index 45183cf..3539dc8 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -765,7 +765,6 @@ static void HTTP_ProcessCookies( http_request_t *request ) diff --git a/patches/wininet-Cleanup/0006-wininet-Delay-setting-the-http-host-header.patch b/patches/wininet-Cleanup/0007-wininet-Delay-setting-the-http-host-header.patch similarity index 97% rename from patches/wininet-Cleanup/0006-wininet-Delay-setting-the-http-host-header.patch rename to patches/wininet-Cleanup/0007-wininet-Delay-setting-the-http-host-header.patch index d3f456ba..416c0ebe 100644 --- a/patches/wininet-Cleanup/0006-wininet-Delay-setting-the-http-host-header.patch +++ b/patches/wininet-Cleanup/0007-wininet-Delay-setting-the-http-host-header.patch @@ -1,4 +1,4 @@ -From c905bda4bbedf7cd8612d5f24ff9a6dd4c9ede90 Mon Sep 17 00:00:00 2001 +From 086a65eab198ca7d2ab4215660369b0e05dbfbbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 16 May 2015 01:39:33 +0200 Subject: wininet: Delay setting the http host header. @@ -11,7 +11,7 @@ working by pure accident before. 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c -index 51ca427..42e2c30 100644 +index 3539dc8..356ebb6 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -376,6 +376,7 @@ static WCHAR *get_host_header( http_request_t *req ) @@ -81,7 +81,7 @@ index 51ca427..42e2c30 100644 if (hIC->proxy && hIC->proxy[0] && !HTTP_ShouldBypassProxy(hIC, session->hostName)) HTTP_DealWithProxy( hIC, session, request ); -@@ -4900,6 +4905,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, +@@ -4899,6 +4904,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, if (!request->verb) request->verb = heap_strdupW(szGET); diff --git a/patches/wininet-Cleanup/0007-wininet-Use-request-server-canon_host_port-in-authen.patch b/patches/wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-in-authen.patch similarity index 91% rename from patches/wininet-Cleanup/0007-wininet-Use-request-server-canon_host_port-in-authen.patch rename to patches/wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-in-authen.patch index 3a47d26e..80b6a850 100644 --- a/patches/wininet-Cleanup/0007-wininet-Use-request-server-canon_host_port-in-authen.patch +++ b/patches/wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-in-authen.patch @@ -1,4 +1,4 @@ -From 873ba4c6d8656e3c7b4476a3187e377441a89db6 Mon Sep 17 00:00:00 2001 +From f0e05bd23a5a4377462586a0f8bd9c54117dcbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 16 May 2015 01:57:17 +0200 Subject: wininet: Use request->server->canon_host_port in authentication @@ -10,10 +10,10 @@ Subject: wininet: Use request->server->canon_host_port in authentication 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c -index 42e2c30..842734b 100644 +index 356ebb6..3232fad 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c -@@ -5117,7 +5117,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, +@@ -5116,7 +5116,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, dwBufferSize=2048; if (request->status_code == HTTP_STATUS_DENIED) { diff --git a/patches/wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-when-quer.patch b/patches/wininet-Cleanup/0009-wininet-Use-request-server-canon_host_port-when-quer.patch similarity index 95% rename from patches/wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-when-quer.patch rename to patches/wininet-Cleanup/0009-wininet-Use-request-server-canon_host_port-when-quer.patch index 155a8aa6..2e31008e 100644 --- a/patches/wininet-Cleanup/0008-wininet-Use-request-server-canon_host_port-when-quer.patch +++ b/patches/wininet-Cleanup/0009-wininet-Use-request-server-canon_host_port-when-quer.patch @@ -1,4 +1,4 @@ -From dba35655b6c941bddf018a9b914d46e47d387df4 Mon Sep 17 00:00:00 2001 +From 31baebdaabf58e3bf1f1bdcb92f85cd5e0857a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sat, 16 May 2015 02:00:57 +0200 Subject: wininet: Use request->server->canon_host_port when querying for @@ -10,7 +10,7 @@ Subject: wininet: Use request->server->canon_host_port when querying for 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c -index 842734b..d54392c 100644 +index 3232fad..cfeb7ac 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2134,21 +2134,12 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe diff --git a/patches/wininet-Cleanup/0010-rpcrt4-Fix-arguments-of-HttpAddRequestHeaders.patch b/patches/wininet-Cleanup/0010-rpcrt4-Fix-arguments-of-HttpAddRequestHeaders.patch new file mode 100644 index 00000000..60ae9439 --- /dev/null +++ b/patches/wininet-Cleanup/0010-rpcrt4-Fix-arguments-of-HttpAddRequestHeaders.patch @@ -0,0 +1,34 @@ +From 109b633fe845cab2b8abfe4a161ecb0e41ba4e86 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 16 May 2015 02:24:03 +0200 +Subject: rpcrt4: Fix arguments of HttpAddRequestHeaders. + +--- + dlls/rpcrt4/rpc_transport.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c +index 34f434d..0504d51 100644 +--- a/dlls/rpcrt4/rpc_transport.c ++++ b/dlls/rpcrt4/rpc_transport.c +@@ -2275,7 +2275,7 @@ static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len) + WCHAR header[sizeof(fmtW) / sizeof(fmtW[0]) + 10]; + + sprintfW(header, fmtW, len); +- if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE))) return RPC_S_OK; ++ if ((HttpAddRequestHeadersW(request, header, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD))) return RPC_S_OK; + return RPC_S_SERVER_UNAVAILABLE; + } + +@@ -2866,7 +2866,7 @@ static RPC_STATUS authorize_request(RpcConnection_http *httpc, HINTERNET request + } + + if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC) +- HttpAddRequestHeadersW(request, authW, -1, HTTP_ADDREQ_FLAG_REPLACE); ++ HttpAddRequestHeadersW(request, authW, -1, HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD); + + destroy_authinfo(info); + return status; +-- +2.4.0 + diff --git a/patches/wininet-Cleanup/0011-wininet-Fix-arguments-of-HttpAddRequestHeaders.patch b/patches/wininet-Cleanup/0011-wininet-Fix-arguments-of-HttpAddRequestHeaders.patch new file mode 100644 index 00000000..73ef5e41 --- /dev/null +++ b/patches/wininet-Cleanup/0011-wininet-Fix-arguments-of-HttpAddRequestHeaders.patch @@ -0,0 +1,74 @@ +From 60e158b648b47ce743f5ceabdad0354324ee7391 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 16 May 2015 02:29:42 +0200 +Subject: wininet: Fix arguments of HttpAddRequestHeaders. + +--- + dlls/wininet/http.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c +index cfeb7ac..6681100 100644 +--- a/dlls/wininet/http.c ++++ b/dlls/wininet/http.c +@@ -1661,7 +1661,8 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn + + TRACE("Inserting authorization: %s\n", debugstr_w(authorization)); + +- HTTP_ProcessHeader(request, header, authorization, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); ++ HTTP_ProcessHeader(request, header, authorization, ++ HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD); + heap_free(authorization); + } + else if (!strcmpW(header, szAuthorization) && (host = get_host_header(request))) +@@ -1682,7 +1683,8 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn + + TRACE("Inserting authorization: %s\n", debugstr_w(authorization)); + +- HTTP_ProcessHeader(request, header, authorization, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); ++ HTTP_ProcessHeader(request, header, authorization, ++ HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD); + heap_free(data); + heap_free(authorization); + } +@@ -3397,7 +3399,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, + HTTP_ProcessHeader(request, HTTP_ACCEPT, lpszAcceptTypes[i], + HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA | + HTTP_ADDHDR_FLAG_REQ | +- (i == 0 ? HTTP_ADDHDR_FLAG_REPLACE : 0)); ++ (i == 0 ? (HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD) : 0)); + } + } + +@@ -4235,7 +4237,8 @@ static void HTTP_InsertCookies(http_request_t *request) + if(res != ERROR_SUCCESS || !cookies) + return; + +- HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), HTTP_ADDREQ_FLAG_REPLACE); ++ HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), ++ HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD); + heap_free(cookies); + } + +@@ -4959,7 +4962,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, + HTTP_FixURL(request); + if (request->hdr.dwFlags & INTERNET_FLAG_KEEP_CONNECTION) + { +- HTTP_ProcessHeader(request, szConnection, szKeepAlive, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); ++ HTTP_ProcessHeader(request, szConnection, szKeepAlive, ++ HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD); + } + HTTP_InsertAuthorization(request, request->authInfo, szAuthorization); + HTTP_InsertAuthorization(request, request->proxyAuthInfo, szProxy_Authorization); +@@ -5976,7 +5980,7 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len) + + /* Add status code */ + HTTP_ProcessHeader(request, szStatus, status_code, +- HTTP_ADDHDR_FLAG_REPLACE); ++ HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD); + + heap_free(request->version); + heap_free(request->statusText); +-- +2.4.0 + diff --git a/patches/wininet-Cleanup/0012-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch b/patches/wininet-Cleanup/0012-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch new file mode 100644 index 00000000..da34d531 --- /dev/null +++ b/patches/wininet-Cleanup/0012-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch @@ -0,0 +1,83 @@ +From 95a38cefff721e71d6d543b8f28da2e4c77362ab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 16 May 2015 00:24:35 +0200 +Subject: wininet: Strip filename if no path is set in cookie. + +The order of the stored cookies doesn't match in /testC, so +be a bit less strict in the test. +--- + dlls/wininet/http.c | 11 ++++++++++- + dlls/wininet/tests/http.c | 6 +++--- + 2 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c +index 6681100..0b0f0b1 100644 +--- a/dlls/wininet/http.c ++++ b/dlls/wininet/http.c +@@ -758,10 +758,18 @@ static void HTTP_ProcessCookies( http_request_t *request ) + int HeaderIndex; + int numCookies = 0; + LPHTTPHEADERW setCookieHeader; ++ WCHAR *path, *tmp; + + if(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) + return; + ++ path = heap_strdupW(request->path); ++ if (!path) ++ return; ++ ++ tmp = strrchrW(path, '/'); ++ if (tmp && tmp[1]) tmp[1] = 0; ++ + EnterCriticalSection( &request->headers_section ); + + while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies++, FALSE)) != -1) +@@ -783,11 +791,12 @@ static void HTTP_ProcessCookies( http_request_t *request ) + continue; + + data++; +- set_cookie(request->server->name, request->path, name, data, INTERNET_COOKIE_HTTPONLY); ++ set_cookie(request->server->name, path, name, data, INTERNET_COOKIE_HTTPONLY); + heap_free(name); + } + + LeaveCriticalSection( &request->headers_section ); ++ heap_free(path); + } + + static void strip_spaces(LPWSTR start) +diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c +index 469995b..87f0668 100644 +--- a/dlls/wininet/tests/http.c ++++ b/dlls/wininet/tests/http.c +@@ -2201,7 +2201,7 @@ static DWORD CALLBACK server_thread(LPVOID param) + } + if (strstr(buffer, "/testC")) + { +- if (strstr(buffer, "Cookie: cookie=biscuit")) ++ if (strstr(buffer, "cookie=biscuit")) + send(c, okmsg, sizeof okmsg-1, 0); + else + send(c, notokmsg, sizeof notokmsg-1, 0); +@@ -3144,7 +3144,7 @@ static void test_header_override(int port) + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + +- test_status_code_todo(req, 200); ++ test_status_code(req, 200); + InternetCloseHandle(req); + + req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); +@@ -3153,7 +3153,7 @@ static void test_header_override(int port) + ret = HttpSendRequestA(req, NULL, 0, NULL, 0); + ok(ret, "HttpSendRequest failed\n"); + +- test_status_code_todo(req, 200); ++ test_status_code(req, 200); + InternetCloseHandle(req); + + InternetSetCookieA("http://test.local", "foo", "bar"); +-- +2.4.0 +