https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4a3f32ff30864286a9c7480b617454bc77a56d3d
commit 4a3f32ff30864286a9c7480b617454bc77a56d3d Author: Jérôme Gardou <jerome.gar...@reactos.org> AuthorDate: Tue Dec 8 17:45:41 2020 +0100 Commit: Jérôme Gardou <zefk...@users.noreply.github.com> CommitDate: Tue Jan 5 11:03:13 2021 +0100 [WINESYNC]: revert wine-staging patchset for wininet --- dll/win32/wininet/http.c | 196 +++++++------- modules/rostests/winetests/wininet/http.c | 282 +-------------------- ...-wininet-tests-Add-more-tests-for-cookies.patch | 145 ----------- ...ts-Test-auth-credential-reusage-with-host.patch | 130 ---------- ...ts-Check-cookie-behaviour-when-overriding.patch | 132 ---------- ...trip-filename-if-no-path-is-set-in-cookie.patch | 82 ------ ...lacing-header-fields-should-fail-if-they-.patch | 241 ------------------ 7 files changed, 97 insertions(+), 1111 deletions(-) diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index 45036f2fe56..a4c793aaeac 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -766,18 +766,10 @@ 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) @@ -796,11 +788,10 @@ static void HTTP_ProcessCookies( http_request_t *request ) name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue); data++; - set_cookie(substrz(request->server->name), substrz(path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); + set_cookie(substrz(request->server->name), substrz(request->path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); } LeaveCriticalSection( &request->headers_section ); - heap_free(path); } static void strip_spaces(LPWSTR start) @@ -6152,128 +6143,127 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier) { - LPHTTPHEADERW lphttpHdr; + LPHTTPHEADERW lphttpHdr = NULL; INT index; BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ); - DWORD res = ERROR_SUCCESS; + DWORD res = ERROR_HTTP_INVALID_HEADER; TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), dwModifier); EnterCriticalSection( &request->headers_section ); - index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); + /* REPLACE wins out over ADD */ + if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) + dwModifier &= ~HTTP_ADDHDR_FLAG_ADD; + + if (dwModifier & HTTP_ADDHDR_FLAG_ADD) + index = -1; + else + index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); + if (index >= 0) { - lphttpHdr = &request->custHeaders[index]; - - /* replace existing header if FLAG_REPLACE is given */ - if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) + if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) { - HTTP_DeleteCustomHeader( request, index ); + LeaveCriticalSection( &request->headers_section ); + return ERROR_HTTP_INVALID_HEADER; + } + lphttpHdr = &request->custHeaders[index]; + } + else if (value) + { + HTTPHEADERW hdr; - if (value && value[0]) - { - HTTPHEADERW hdr; + hdr.lpszField = (LPWSTR)field; + hdr.lpszValue = (LPWSTR)value; + hdr.wFlags = hdr.wCount = 0; - hdr.lpszField = (LPWSTR)field; - hdr.lpszValue = (LPWSTR)value; - hdr.wFlags = hdr.wCount = 0; + if (dwModifier & HTTP_ADDHDR_FLAG_REQ) + hdr.wFlags |= HDR_ISREQUEST; - if (dwModifier & HTTP_ADDHDR_FLAG_REQ) - hdr.wFlags |= HDR_ISREQUEST; + res = HTTP_InsertCustomHeader(request, &hdr); + LeaveCriticalSection( &request->headers_section ); + return res; + } + /* no value to delete */ + else + { + LeaveCriticalSection( &request->headers_section ); + return ERROR_SUCCESS; + } - res = HTTP_InsertCustomHeader( request, &hdr ); - } + if (dwModifier & HTTP_ADDHDR_FLAG_REQ) + lphttpHdr->wFlags |= HDR_ISREQUEST; + else + lphttpHdr->wFlags &= ~HDR_ISREQUEST; - goto out; - } + if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) + { + HTTP_DeleteCustomHeader( request, index ); - /* do not add new header if FLAG_ADD_IF_NEW is set */ - if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) + if (value && value[0]) { - res = ERROR_HTTP_INVALID_HEADER; /* FIXME */ - goto out; - } + HTTPHEADERW hdr; - /* handle appending to existing header */ - if (dwModifier & COALESCEFLAGS) - { - LPWSTR lpsztmp; - WCHAR ch = 0; - INT len = 0; - INT origlen = strlenW(lphttpHdr->lpszValue); - INT valuelen = strlenW(value); + hdr.lpszField = (LPWSTR)field; + hdr.lpszValue = (LPWSTR)value; + hdr.wFlags = hdr.wCount = 0; - /* FIXME: Should it really clear HDR_ISREQUEST? */ if (dwModifier & HTTP_ADDHDR_FLAG_REQ) - lphttpHdr->wFlags |= HDR_ISREQUEST; - else - lphttpHdr->wFlags &= ~HDR_ISREQUEST; + hdr.wFlags |= HDR_ISREQUEST; - if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) - { - ch = ','; - lphttpHdr->wFlags |= HDR_COMMADELIMITED; - } - else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) - { - ch = ';'; - lphttpHdr->wFlags |= HDR_COMMADELIMITED; - } - - len = origlen + valuelen + ((ch > 0) ? 2 : 0); - - lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); - if (lpsztmp) - { - lphttpHdr->lpszValue = lpsztmp; - /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ - if (ch > 0) - { - lphttpHdr->lpszValue[origlen] = ch; - origlen++; - lphttpHdr->lpszValue[origlen] = ' '; - origlen++; - } - - memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); - lphttpHdr->lpszValue[len] = '\0'; - } - else - { - WARN("heap_realloc (%d bytes) failed\n",len+1); - res = ERROR_OUTOFMEMORY; - } - - goto out; + res = HTTP_InsertCustomHeader(request, &hdr); + LeaveCriticalSection( &request->headers_section ); + return res; } - } - /* FIXME: What about other combinations? */ - if ((dwModifier & ~HTTP_ADDHDR_FLAG_REQ) == HTTP_ADDHDR_FLAG_REPLACE) - { - res = ERROR_HTTP_HEADER_NOT_FOUND; - goto out; + LeaveCriticalSection( &request->headers_section ); + return ERROR_SUCCESS; } - - /* FIXME: What if value == ""? */ - if (value) + else if (dwModifier & COALESCEFLAGS) { - HTTPHEADERW hdr; + LPWSTR lpsztmp; + WCHAR ch = 0; + INT len = 0; + INT origlen = strlenW(lphttpHdr->lpszValue); + INT valuelen = strlenW(value); - hdr.lpszField = (LPWSTR)field; - hdr.lpszValue = (LPWSTR)value; - hdr.wFlags = hdr.wCount = 0; + if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) + { + ch = ','; + lphttpHdr->wFlags |= HDR_COMMADELIMITED; + } + else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) + { + ch = ';'; + lphttpHdr->wFlags |= HDR_COMMADELIMITED; + } - if (dwModifier & HTTP_ADDHDR_FLAG_REQ) - hdr.wFlags |= HDR_ISREQUEST; + len = origlen + valuelen + ((ch > 0) ? 2 : 0); - res = HTTP_InsertCustomHeader( request, &hdr ); - goto out; - } + lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); + if (lpsztmp) + { + lphttpHdr->lpszValue = lpsztmp; + /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ + if (ch > 0) + { + lphttpHdr->lpszValue[origlen] = ch; + origlen++; + lphttpHdr->lpszValue[origlen] = ' '; + origlen++; + } - /* FIXME: What if value == NULL? */ -out: + memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); + lphttpHdr->lpszValue[len] = '\0'; + res = ERROR_SUCCESS; + } + else + { + WARN("heap_realloc (%d bytes) failed\n",len+1); + res = ERROR_OUTOFMEMORY; + } + } TRACE("<-- %d\n", res); LeaveCriticalSection( &request->headers_section ); return res; diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c index 09646b18996..28ebd68bcf5 100644 --- a/modules/rostests/winetests/wininet/http.c +++ b/modules/rostests/winetests/wininet/http.c @@ -2074,22 +2074,6 @@ static const char largemsg[] = "Content-Length: %I64u\r\n" "\r\n"; -static const char okmsg_cookie_path[] = -"HTTP/1.1 200 OK\r\n" -"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" -"Server: winetest\r\n" -"Content-Length: 0\r\n" -"Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" -"\r\n"; - -static const char okmsg_cookie[] = -"HTTP/1.1 200 OK\r\n" -"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" -"Server: winetest\r\n" -"Content-Length: 0\r\n" -"Set-Cookie: testcookie=testvalue\r\n" -"\r\n"; - static const char notokmsg[] = "HTTP/1.1 400 Bad Request\r\n" "Server: winetest\r\n" @@ -2308,7 +2292,7 @@ static DWORD CALLBACK server_thread(LPVOID param) } if (strstr(buffer, "/testC")) { - if (strstr(buffer, "cookie=biscuit")) + if (strstr(buffer, "Cookie: cookie=biscuit")) send(c, okmsg, sizeof okmsg-1, 0); else send(c, notokmsg, sizeof notokmsg-1, 0); @@ -2469,51 +2453,6 @@ static DWORD CALLBACK server_thread(LPVOID param) else send(c, noauthmsg, sizeof noauthmsg-1, 0); } - if (strstr(buffer, "/test_cookie_path1")) - { - if (strstr(buffer, "subcookie=data")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } - if (strstr(buffer, "/test_cookie_path2")) - { - if (strstr(buffer, "subcookie2=data")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } - if (strstr(buffer, "/test_cookie_set_path")) - { - send(c, okmsg_cookie_path, sizeof okmsg_cookie_path-1, 0); - } - if (strstr(buffer, "/test_cookie_merge")) - { - if (strstr(buffer, "subcookie=data") && - !strstr(buffer, "manual_cookie=test")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } - if (strstr(buffer, "/test_cookie_set_host_override")) - { - send(c, okmsg_cookie, sizeof okmsg_cookie-1, 0); - } - if (strstr(buffer, "/test_cookie_check_host_override")) - { - if (strstr(buffer, "Cookie:") && strstr(buffer, "testcookie=testvalue")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } - if (strstr(buffer, "/test_cookie_check_different_host")) - { - if (!strstr(buffer, "foo") && - strstr(buffer, "cookie=biscuit")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } if (strstr(buffer, "/test_host_override")) { if (strstr(buffer, host_header_override)) @@ -2545,27 +2484,12 @@ static DWORD CALLBACK server_thread(LPVOID param) { send(c, okmsg, sizeof(okmsg)-1, 0); } - if (strstr(buffer, "HEAD /test_large_content")) { char msg[sizeof(largemsg) + 16]; sprintf(msg, largemsg, content_length); send(c, msg, strlen(msg), 0); } - if (strstr(buffer, "HEAD /test_auth_host1")) - { - if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzcw==")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, noauthmsg, sizeof noauthmsg-1, 0); - } - if (strstr(buffer, "HEAD /test_auth_host2")) - { - if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzczI=")) - send(c, okmsg, sizeof okmsg-1, 0); - else - send(c, noauthmsg, sizeof noauthmsg-1, 0); - } shutdown(c, 2); closesocket(c); c = -1; @@ -3261,152 +3185,6 @@ static void test_header_override(int port) test_status_code(req, 400); } - InternetCloseHandle(req); - InternetSetCookieA("http://localhost", "cookie", "biscuit"); - req = HttpOpenRequestA(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - - test_status_code(req, 200); - - InternetCloseHandle(req); - req = HttpOpenRequestA(con, NULL, "/test_cookie_set_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - - test_status_code(req, 200); - - InternetCloseHandle(req); - req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - - test_status_code(req, 200); - - InternetCloseHandle(req); - req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", 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\n"); - - test_status_code(req, 200); - - InternetCloseHandle(req); - InternetSetCookieA("http://test.local", "foo", "bar"); - req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", 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\n"); - - test_status_code(req, 200); - - InternetCloseHandle(req); - req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - - test_status_code(req, 200); - - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpenA failed\n"); - - con = InternetConnectA(ses, "localhost", port, "test1", "pass", INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); - - req = HttpOpenRequestA( con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); - ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); - - test_status_code(req, 200); - - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpenA failed\n"); - - con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); - - req = HttpOpenRequestA(con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); - ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); - - ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed\n"); - - ret = HttpSendRequestA( req, NULL, 0, NULL, 0 ); - ok( ret, "HttpSendRequestA failed %u\n", GetLastError() ); - - test_status_code(req, 200); - - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpenA failed\n"); - - con = InternetConnectA(ses, "localhost", port, "test1", "pass2", INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); - - req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); - ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); - - ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed\n"); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); - - test_status_code(req, 200); - - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpenA failed\n"); - - con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); - - req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); - ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); - - test_status_code(req, 200); - InternetCloseHandle(req); InternetCloseHandle(con); InternetCloseHandle(ses); @@ -4053,7 +3831,7 @@ static void test_cookie_header(int port) HINTERNET ses, con, req; DWORD size, error; BOOL ret; - char buffer[256]; + char buffer[64]; ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); ok(ses != NULL, "InternetOpen failed\n"); @@ -4081,7 +3859,7 @@ static void test_cookie_header(int port) size = sizeof(buffer); ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); - ok(!!strstr(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); + ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); ret = HttpSendRequestA(req, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); @@ -4092,61 +3870,9 @@ static void test_cookie_header(int port) size = sizeof(buffer); ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); - ok(!strstr(buffer, "cookie=not biscuit"), "'%s' should not contain \'cookie=not biscuit\'\n", buffer); - ok(!!strstr(buffer, "cookie=biscuit"), "'%s' should contain \'cookie=biscuit\'\n", buffer); - - InternetCloseHandle(req); - - InternetSetCookieA("http://localhost/testCCCC", "subcookie", "data"); - - req = HttpOpenRequestA(con, NULL, "/test_cookie_path1", 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\n"); + ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer); - test_status_code(req, 200); InternetCloseHandle(req); - - req = HttpOpenRequestA(con, NULL, "/test_cookie_path1/abc", 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\n"); - - test_status_code(req, 200); - InternetCloseHandle(req); - - req = HttpOpenRequestA(con, NULL, "/test_cookie_set_path", 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\n"); - - test_status_code(req, 200); - InternetCloseHandle(req); - - req = HttpOpenRequestA(con, NULL, "/test_cookie_path2", 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\n"); - - test_status_code(req, 400); - InternetCloseHandle(req); - - req = HttpOpenRequestA(con, NULL, "/test_cookie_merge", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); - ok(req != NULL, "HttpOpenRequest failed\n"); - - ret = HttpAddRequestHeadersA(req, "Cookie: manual_cookie=test\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD); - ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError()); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed\n"); - - test_status_code(req, 200); - InternetCloseHandle(req); - InternetCloseHandle(con); InternetCloseHandle(ses); } diff --git a/sdk/tools/winesync/wininet_staging/0001-wininet-tests-Add-more-tests-for-cookies.patch b/sdk/tools/winesync/wininet_staging/0001-wininet-tests-Add-more-tests-for-cookies.patch deleted file mode 100644 index 110d815705a..00000000000 --- a/sdk/tools/winesync/wininet_staging/0001-wininet-tests-Add-more-tests-for-cookies.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 915a805cabaec3cc265f4f8ad9f0005502f8fd24 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= <mich...@fds-team.de> -Date: Fri, 15 May 2015 20:37:19 +0200 -Subject: [PATCH] wininet/tests: Add more tests for cookies. - ---- - modules/rostests/winetests/wininet/http.c | 92 +++++++++++++++++++++++++++++++++++++-- - 1 file changed, 89 insertions(+), 3 deletions(-) - -diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c -index 90a38dc3a..55d51b299 100644 ---- a/modules/rostests/winetests/wininet/http.c -+++ b/modules/rostests/winetests/wininet/http.c -@@ -2068,6 +2068,14 @@ static const char largemsg[] = - "Content-Length: %I64u\r\n" - "\r\n"; - -+static const char okmsg_cookie_path[] = -+"HTTP/1.1 200 OK\r\n" -+"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" -+"Server: winetest\r\n" -+"Content-Length: 0\r\n" -+"Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" -+"\r\n"; -+ - static const char notokmsg[] = - "HTTP/1.1 400 Bad Request\r\n" - "Server: winetest\r\n" -@@ -2438,6 +2446,32 @@ static DWORD CALLBACK server_thread(LPVOID param) - else - send(c, noauthmsg, sizeof noauthmsg-1, 0); - } -+ if (strstr(buffer, "/test_cookie_path1")) -+ { -+ if (strstr(buffer, "subcookie=data")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, notokmsg, sizeof notokmsg-1, 0); -+ } -+ if (strstr(buffer, "/test_cookie_path2")) -+ { -+ if (strstr(buffer, "subcookie2=data")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, notokmsg, sizeof notokmsg-1, 0); -+ } -+ if (strstr(buffer, "/test_cookie_set_path")) -+ { -+ send(c, okmsg_cookie_path, sizeof okmsg_cookie_path-1, 0); -+ } -+ if (strstr(buffer, "/test_cookie_merge")) -+ { -+ if (strstr(buffer, "subcookie=data") && -+ !strstr(buffer, "manual_cookie=test")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, notokmsg, sizeof notokmsg-1, 0); -+ } - if (strstr(buffer, "/test_host_override")) - { - if (strstr(buffer, host_header_override)) -@@ -3816,7 +3850,7 @@ static void test_cookie_header(int port) - HINTERNET ses, con, req; - DWORD size, error; - BOOL ret; -- char buffer[64]; -+ char buffer[256]; - - ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(ses != NULL, "InternetOpen failed\n"); -@@ -3844,7 +3878,7 @@ static void test_cookie_header(int port) - size = sizeof(buffer); - ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); - ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); -- ok(!strcmp(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); -+ ok(!!strstr(buffer, "cookie=not biscuit"), "got '%s' expected \'cookie=not biscuit\'\n", buffer); - - ret = HttpSendRequestA(req, NULL, 0, NULL, 0); - ok(ret, "HttpSendRequest failed: %u\n", GetLastError()); -@@ -3855,9 +3889,61 @@ static void test_cookie_header(int port) - size = sizeof(buffer); - ret = HttpQueryInfoA(req, HTTP_QUERY_COOKIE | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &size, NULL); - ok(ret, "HttpQueryInfo failed: %u\n", GetLastError()); -- ok(!strcmp(buffer, "cookie=biscuit"), "got '%s' expected \'cookie=biscuit\'\n", buffer); -+ ok(!strstr(buffer, "cookie=not biscuit"), "'%s' should not contain \'cookie=not biscuit\'\n", buffer); -+ ok(!!strstr(buffer, "cookie=biscuit"), "'%s' should contain \'cookie=biscuit\'\n", buffer); -+ -+ InternetCloseHandle(req); -+ -+ InternetSetCookieA("http://localhost/testCCCC", "subcookie", "data"); -+ -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_path1", 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\n"); -+ -+ test_status_code(req, 200); -+ InternetCloseHandle(req); -+ -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_path1/abc", 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\n"); -+ -+ test_status_code(req, 200); -+ InternetCloseHandle(req); -+ -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_set_path", 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\n"); -+ -+ test_status_code(req, 200); -+ InternetCloseHandle(req); -+ -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_path2", 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\n"); -+ -+ test_status_code(req, 400); - InternetCloseHandle(req); -+ -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_merge", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); -+ ok(req != NULL, "HttpOpenRequest failed\n"); -+ -+ ret = HttpAddRequestHeadersA(req, "Cookie: manual_cookie=test\r\n", ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed: %u\n", GetLastError()); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequest failed\n"); -+ -+ test_status_code(req, 200); -+ InternetCloseHandle(req); -+ - InternetCloseHandle(con); - InternetCloseHandle(ses); - } --- -2.23.0 - diff --git a/sdk/tools/winesync/wininet_staging/0002-wininet-tests-Test-auth-credential-reusage-with-host.patch b/sdk/tools/winesync/wininet_staging/0002-wininet-tests-Test-auth-credential-reusage-with-host.patch deleted file mode 100644 index f24048f8b82..00000000000 --- a/sdk/tools/winesync/wininet_staging/0002-wininet-tests-Test-auth-credential-reusage-with-host.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 303a7d54eca11f350f200bf3747646349a84536f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= <mich...@fds-team.de> -Date: Fri, 15 May 2015 21:18:37 +0200 -Subject: [PATCH] wininet/tests: Test auth credential reusage with host - override. - ---- - modules/rostests/winetests/wininet/http.c | 93 +++++++++++++++++++++++++++++++++++++++ - 1 file changed, 93 insertions(+) - -diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c -index b06bd6c04d1..59689baf87e 100644 ---- a/modules/rostests/winetests/wininet/http.c -+++ b/modules/rostests/winetests/wininet/http.c -@@ -2496,12 +2496,27 @@ static DWORD CALLBACK server_thread(LPVOID param) - { - send(c, okmsg, sizeof(okmsg)-1, 0); - } -+ - if (strstr(buffer, "HEAD /test_large_content")) - { - char msg[sizeof(largemsg) + 16]; - sprintf(msg, largemsg, content_length); - send(c, msg, strlen(msg), 0); - } -+ if (strstr(buffer, "HEAD /test_auth_host1")) -+ { -+ if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzcw==")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, noauthmsg, sizeof noauthmsg-1, 0); -+ } -+ if (strstr(buffer, "HEAD /test_auth_host2")) -+ { -+ if (strstr(buffer, "Authorization: Basic dGVzdDE6cGFzczI=")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, noauthmsg, sizeof noauthmsg-1, 0); -+ } - shutdown(c, 2); - closesocket(c); - c = -1; -@@ -3200,6 +3215,84 @@ static void test_header_override(int port) - InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); -+ -+ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); -+ ok(ses != NULL, "InternetOpenA failed\n"); -+ -+ con = InternetConnectA(ses, "localhost", port, "test1", "pass", INTERNET_SERVICE_HTTP, 0, 0); -+ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); -+ -+ req = HttpOpenRequestA( con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); -+ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ InternetCloseHandle(con); -+ InternetCloseHandle(ses); -+ -+ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); -+ ok(ses != NULL, "InternetOpenA failed\n"); -+ -+ con = InternetConnectA( ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); -+ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); -+ -+ req = HttpOpenRequestA(con, "HEAD", "/test_auth_host1", NULL, NULL, NULL, 0, 0); -+ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); -+ -+ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed\n"); -+ -+ ret = HttpSendRequestA( req, NULL, 0, NULL, 0 ); -+ ok( ret, "HttpSendRequestA failed %u\n", GetLastError() ); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ InternetCloseHandle(con); -+ InternetCloseHandle(ses); -+ -+ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); -+ ok(ses != NULL, "InternetOpenA failed\n"); -+ -+ con = InternetConnectA(ses, "localhost", port, "test1", "pass2", INTERNET_SERVICE_HTTP, 0, 0); -+ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); -+ -+ req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); -+ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); -+ -+ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed\n"); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ InternetCloseHandle(con); -+ InternetCloseHandle(ses); -+ -+ ses = InternetOpenA("winetest", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); -+ ok(ses != NULL, "InternetOpenA failed\n"); -+ -+ con = InternetConnectA(ses, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); -+ ok(con != NULL, "InternetConnectA failed %u\n", GetLastError()); -+ -+ req = HttpOpenRequestA(con, "HEAD", "/test_auth_host2", NULL, NULL, NULL, 0, 0); -+ ok(req != NULL, "HttpOpenRequestA failed %u\n", GetLastError()); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequestA failed %u\n", GetLastError()); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ InternetCloseHandle(con); -+ InternetCloseHandle(ses); - } - - static void test_connection_closing(int port) --- -2.17.1 - diff --git a/sdk/tools/winesync/wininet_staging/0003-wininet-tests-Check-cookie-behaviour-when-overriding.patch b/sdk/tools/winesync/wininet_staging/0003-wininet-tests-Check-cookie-behaviour-when-overriding.patch deleted file mode 100644 index 4aa7802cb67..00000000000 --- a/sdk/tools/winesync/wininet_staging/0003-wininet-tests-Check-cookie-behaviour-when-overriding.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 21ca3efb2a8a1f505f9e3f3ed2126a766d4a127f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= <mich...@fds-team.de> -Date: Fri, 15 May 2015 23:09:20 +0200 -Subject: wininet/tests: Check cookie behaviour when overriding host. - ---- - modules/rostests/winetests/wininet/http.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 95 insertions(+) - -diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c -index 546e473..0121aa5 100644 ---- a/modules/rostests/winetests/wininet/http.c -+++ b/modules/rostests/winetests/wininet/http.c -@@ -2000,6 +2000,14 @@ static const char okmsg_cookie_path[] = - "Set-Cookie: subcookie2=data; path=/test_cookie_set_path\r\n" - "\r\n"; - -+static const char okmsg_cookie[] = -+"HTTP/1.1 200 OK\r\n" -+"Date: Mon, 01 Dec 2008 13:44:34 GMT\r\n" -+"Server: winetest\r\n" -+"Content-Length: 0\r\n" -+"Set-Cookie: testcookie=testvalue\r\n" -+"\r\n"; -+ - static const char notokmsg[] = - "HTTP/1.1 400 Bad Request\r\n" - "Server: winetest\r\n" -@@ -2391,6 +2399,25 @@ static DWORD CALLBACK server_thread(LPVOID param) - else - send(c, notokmsg, sizeof notokmsg-1, 0); - } -+ if (strstr(buffer, "/test_cookie_set_host_override")) -+ { -+ send(c, okmsg_cookie, sizeof okmsg_cookie-1, 0); -+ } -+ if (strstr(buffer, "/test_cookie_check_host_override")) -+ { -+ if (strstr(buffer, "Cookie:") && strstr(buffer, "testcookie=testvalue")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, notokmsg, sizeof notokmsg-1, 0); -+ } -+ if (strstr(buffer, "/test_cookie_check_different_host")) -+ { -+ if (!strstr(buffer, "foo") && -+ strstr(buffer, "cookie=biscuit")) -+ send(c, okmsg, sizeof okmsg-1, 0); -+ else -+ send(c, notokmsg, sizeof notokmsg-1, 0); -+ } - if (strstr(buffer, "/test_host_override")) - { - if (strstr(buffer, host_header_override)) -@@ -3130,6 +3157,74 @@ static void test_header_override(int port) - } - - InternetCloseHandle(req); -+ InternetSetCookieA("http://localhost", "cookie", "biscuit"); -+ req = HttpOpenRequestA(con, NULL, "/testC", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); -+ ok(req != NULL, "HttpOpenRequest failed\n"); -+ -+ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed\n"); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequest failed\n"); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_set_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); -+ ok(req != NULL, "HttpOpenRequest failed\n"); -+ -+ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed\n"); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequest failed\n"); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); -+ ok(req != NULL, "HttpOpenRequest failed\n"); -+ -+ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed\n"); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequest failed\n"); -+ -+ test_status_code_todo(req, 200); -+ -+ InternetCloseHandle(req); -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_host_override", 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\n"); -+ -+ test_status_code_todo(req, 200); -+ -+ InternetCloseHandle(req); -+ InternetSetCookieA("http://test.local", "foo", "bar"); -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", 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\n"); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); -+ req = HttpOpenRequestA(con, NULL, "/test_cookie_check_different_host", NULL, NULL, NULL, INTERNET_FLAG_KEEP_CONNECTION, 0); -+ ok(req != NULL, "HttpOpenRequest failed\n"); -+ -+ ret = HttpAddRequestHeadersA(req, host_header_override, ~0u, HTTP_ADDREQ_FLAG_ADD); -+ ok(ret, "HttpAddRequestHeaders failed\n"); -+ -+ ret = HttpSendRequestA(req, NULL, 0, NULL, 0); -+ ok(ret, "HttpSendRequest failed\n"); -+ -+ test_status_code(req, 200); -+ -+ InternetCloseHandle(req); - InternetCloseHandle(con); - InternetCloseHandle(ses); - --- -2.8.0 - diff --git a/sdk/tools/winesync/wininet_staging/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch b/sdk/tools/winesync/wininet_staging/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch deleted file mode 100644 index 7d4dbf3888d..00000000000 --- a/sdk/tools/winesync/wininet_staging/0004-wininet-Strip-filename-if-no-path-is-set-in-cookie.patch +++ /dev/null @@ -1,82 +0,0 @@ -From a283ad7a863862caf312843950b88bdfd9faeacc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= <mich...@fds-team.de> -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. ---- - dll/win32/wininet/http.c | 11 ++++++++++- - modules/rostests/winetests/wininet/http.c | 6 +++--- - 2 files changed, 13 insertions(+), 4 deletions(-) - -diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c -index c44156c..7281512 100644 ---- a/dll/win32/wininet/http.c -+++ b/dll/win32/wininet/http.c -@@ -764,10 +764,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) -@@ -786,10 +794,11 @@ static void HTTP_ProcessCookies( http_request_t *request ) - - name = substr(setCookieHeader->lpszValue, data - setCookieHeader->lpszValue); - data++; -- set_cookie(substrz(request->server->name), substrz(request->path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); -+ set_cookie(substrz(request->server->name), substrz(path), name, substrz(data), INTERNET_COOKIE_HTTPONLY); - } - - LeaveCriticalSection( &request->headers_section ); -+ heap_free(path); - } - - static void strip_spaces(LPWSTR start) -diff --git a/modules/rostests/winetests/wininet/http.c b/modules/rostests/winetests/wininet/http.c -index b3826bb..910a0b4 100644 ---- a/modules/rostests/winetests/wininet/http.c -+++ b/modules/rostests/winetests/wininet/http.c -@@ -2226,7 +2226,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); -@@ -3196,7 +3196,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); -@@ -3205,7 +3205,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.8.0 - diff --git a/sdk/tools/winesync/wininet_staging/0005-wininet-Replacing-header-fields-should-fail-if-they-.patch b/sdk/tools/winesync/wininet_staging/0005-wininet-Replacing-header-fields-should-fail-if-they-.patch deleted file mode 100644 index 74f59297d72..00000000000 --- a/sdk/tools/winesync/wininet_staging/0005-wininet-Replacing-header-fields-should-fail-if-they-.patch +++ /dev/null @@ -1,241 +0,0 @@ -From 0b022db2f23f61313004bdf0e2e42e9fd9b2f81d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= <mich...@fds-team.de> -Date: Sat, 16 May 2015 03:16:15 +0200 -Subject: wininet: Replacing header fields should fail if they do not exist - yet. - -A lot of details are not properly covered by tests yet and were -marked with FIXME comments. The implementation was written in such -a way that it behaves identical to the old code in such situations. ---- - dll/win32/wininet/http.c | 185 ++++++++++++++++++++++++++-------------------------- - 1 file changed, 93 insertions(+), 92 deletions(-) - -diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c -index 6f01244..5419786 100644 ---- a/dll/win32/wininet/http.c -+++ b/dll/win32/wininet/http.c -@@ -6166,127 +6166,128 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) - - static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier) - { -- LPHTTPHEADERW lphttpHdr = NULL; -+ LPHTTPHEADERW lphttpHdr; - INT index; - BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ); -- DWORD res = ERROR_HTTP_INVALID_HEADER; -+ DWORD res = ERROR_SUCCESS; - - TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), dwModifier); - - EnterCriticalSection( &request->headers_section ); - -- /* REPLACE wins out over ADD */ -- if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) -- dwModifier &= ~HTTP_ADDHDR_FLAG_ADD; -- -- if (dwModifier & HTTP_ADDHDR_FLAG_ADD) -- index = -1; -- else -- index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); -- -+ index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); - if (index >= 0) - { -- if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) -- { -- LeaveCriticalSection( &request->headers_section ); -- return ERROR_HTTP_INVALID_HEADER; -- } - lphttpHdr = &request->custHeaders[index]; -- } -- else if (value) -- { -- HTTPHEADERW hdr; - -- hdr.lpszField = (LPWSTR)field; -- hdr.lpszValue = (LPWSTR)value; -- hdr.wFlags = hdr.wCount = 0; -+ /* replace existing header if FLAG_REPLACE is given */ -+ if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) -+ { -+ HTTP_DeleteCustomHeader( request, index ); - -- if (dwModifier & HTTP_ADDHDR_FLAG_REQ) -- hdr.wFlags |= HDR_ISREQUEST; -+ if (value && value[0]) -+ { -+ HTTPHEADERW hdr; - -- res = HTTP_InsertCustomHeader(request, &hdr); -- LeaveCriticalSection( &request->headers_section ); -- return res; -- } -- /* no value to delete */ -- else -- { -- LeaveCriticalSection( &request->headers_section ); -- return ERROR_SUCCESS; -- } -+ hdr.lpszField = (LPWSTR)field; -+ hdr.lpszValue = (LPWSTR)value; -+ hdr.wFlags = hdr.wCount = 0; - -- if (dwModifier & HTTP_ADDHDR_FLAG_REQ) -- lphttpHdr->wFlags |= HDR_ISREQUEST; -- else -- lphttpHdr->wFlags &= ~HDR_ISREQUEST; -+ if (dwModifier & HTTP_ADDHDR_FLAG_REQ) -+ hdr.wFlags |= HDR_ISREQUEST; - -- if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) -- { -- HTTP_DeleteCustomHeader( request, index ); -+ res = HTTP_InsertCustomHeader( request, &hdr ); -+ } - -- if (value && value[0]) -+ goto out; -+ } -+ -+ /* do not add new header if FLAG_ADD_IF_NEW is set */ -+ if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) - { -- HTTPHEADERW hdr; -+ res = ERROR_HTTP_INVALID_HEADER; /* FIXME */ -+ goto out; -+ } - -- hdr.lpszField = (LPWSTR)field; -- hdr.lpszValue = (LPWSTR)value; -- hdr.wFlags = hdr.wCount = 0; -+ /* handle appending to existing header */ -+ if (dwModifier & COALESCEFLAGS) -+ { -+ LPWSTR lpsztmp; -+ WCHAR ch = 0; -+ INT len = 0; -+ INT origlen = strlenW(lphttpHdr->lpszValue); -+ INT valuelen = strlenW(value); - -+ /* FIXME: Should it really clear HDR_ISREQUEST? */ - if (dwModifier & HTTP_ADDHDR_FLAG_REQ) -- hdr.wFlags |= HDR_ISREQUEST; -- -- res = HTTP_InsertCustomHeader(request, &hdr); -- LeaveCriticalSection( &request->headers_section ); -- return res; -- } -+ lphttpHdr->wFlags |= HDR_ISREQUEST; -+ else -+ lphttpHdr->wFlags &= ~HDR_ISREQUEST; - -- LeaveCriticalSection( &request->headers_section ); -- return ERROR_SUCCESS; -- } -- else if (dwModifier & COALESCEFLAGS) -- { -- LPWSTR lpsztmp; -- WCHAR ch = 0; -- INT len = 0; -- INT origlen = strlenW(lphttpHdr->lpszValue); -- INT valuelen = strlenW(value); -+ if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) -+ { -+ ch = ','; -+ lphttpHdr->wFlags |= HDR_COMMADELIMITED; -+ } -+ else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) -+ { -+ ch = ';'; -+ lphttpHdr->wFlags |= HDR_COMMADELIMITED; -+ } - -- if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA) -- { -- ch = ','; -- lphttpHdr->wFlags |= HDR_COMMADELIMITED; -- } -- else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) -- { -- ch = ';'; -- lphttpHdr->wFlags |= HDR_COMMADELIMITED; -- } -+ len = origlen + valuelen + ((ch > 0) ? 2 : 0); - -- len = origlen + valuelen + ((ch > 0) ? 2 : 0); -+ lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); -+ if (lpsztmp) -+ { -+ lphttpHdr->lpszValue = lpsztmp; -+ /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ -+ if (ch > 0) -+ { -+ lphttpHdr->lpszValue[origlen] = ch; -+ origlen++; -+ lphttpHdr->lpszValue[origlen] = ' '; -+ origlen++; -+ } - -- lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); -- if (lpsztmp) -- { -- lphttpHdr->lpszValue = lpsztmp; -- /* FIXME: Increment lphttpHdr->wCount. Perhaps lpszValue should be an array */ -- if (ch > 0) -+ memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); -+ lphttpHdr->lpszValue[len] = '\0'; -+ } -+ else - { -- lphttpHdr->lpszValue[origlen] = ch; -- origlen++; -- lphttpHdr->lpszValue[origlen] = ' '; -- origlen++; -+ WARN("heap_realloc (%d bytes) failed\n",len+1); -+ res = ERROR_OUTOFMEMORY; - } - -- memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR)); -- lphttpHdr->lpszValue[len] = '\0'; -- res = ERROR_SUCCESS; -- } -- else -- { -- WARN("heap_realloc (%d bytes) failed\n",len+1); -- res = ERROR_OUTOFMEMORY; -+ goto out; - } - } -+ -+ /* FIXME: What about other combinations? */ -+ if ((dwModifier & ~HTTP_ADDHDR_FLAG_REQ) == HTTP_ADDHDR_FLAG_REPLACE) -+ { -+ res = ERROR_HTTP_HEADER_NOT_FOUND; -+ goto out; -+ } -+ -+ /* FIXME: What if value == ""? */ -+ if (value) -+ { -+ HTTPHEADERW hdr; -+ -+ hdr.lpszField = (LPWSTR)field; -+ hdr.lpszValue = (LPWSTR)value; -+ hdr.wFlags = hdr.wCount = 0; -+ -+ if (dwModifier & HTTP_ADDHDR_FLAG_REQ) -+ hdr.wFlags |= HDR_ISREQUEST; -+ -+ res = HTTP_InsertCustomHeader( request, &hdr ); -+ goto out; -+ } -+ -+ /* FIXME: What if value == NULL? */ -+out: - TRACE("<-- %d\n", res); - LeaveCriticalSection( &request->headers_section ); - return res; --- -2.8.0 -