You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-09-12 18:50:20 -07:00
Rebase against 18230d23c599f1f5f9dd419dccc11c49117cc3b8.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
From 8f500bf79ec01cee5683a3614428662ac29e8e4d Mon Sep 17 00:00:00 2001
|
||||
From 0703846f52cc70153aacee4ef699008da450bfe8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 16 May 2015 03:16:15 +0200
|
||||
Subject: [PATCH] wininet: Replacing header fields should fail if they do not
|
||||
@@ -8,31 +8,27 @@ 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.
|
||||
---
|
||||
dlls/wininet/http.c | 205 ++++++++++++++++++++++----------------------
|
||||
1 file changed, 103 insertions(+), 102 deletions(-)
|
||||
dlls/wininet/http.c | 197 ++++++++++++++++++++++----------------------
|
||||
1 file changed, 99 insertions(+), 98 deletions(-)
|
||||
|
||||
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
|
||||
index 1cc688b6b07..1219507bd3d 100644
|
||||
index 55698467cda..c618652cfaa 100644
|
||||
--- a/dlls/wininet/http.c
|
||||
+++ b/dlls/wininet/http.c
|
||||
@@ -6117,130 +6117,131 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
|
||||
@@ -6108,130 +6108,131 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
|
||||
|
||||
static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier)
|
||||
{
|
||||
- LPHTTPHEADERW lphttpHdr = NULL;
|
||||
- INT index;
|
||||
- BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ);
|
||||
- DWORD res = ERROR_HTTP_INVALID_HEADER;
|
||||
+ LPHTTPHEADERW lphttpHdr;
|
||||
+ INT index;
|
||||
+ BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ);
|
||||
INT index;
|
||||
BOOL request_only = !!(dwModifier & HTTP_ADDHDR_FLAG_REQ);
|
||||
- DWORD res = ERROR_HTTP_INVALID_HEADER;
|
||||
+ DWORD res = ERROR_SUCCESS;
|
||||
|
||||
- TRACE("--> %s: %s - 0x%08lx\n", debugstr_w(field), debugstr_w(value), dwModifier);
|
||||
+ TRACE("--> %s: %s - 0x%08x\n", debugstr_w(field), debugstr_w(value), dwModifier);
|
||||
TRACE("--> %s: %s - 0x%08lx\n", debugstr_w(field), debugstr_w(value), dwModifier);
|
||||
|
||||
- EnterCriticalSection( &request->headers_section );
|
||||
+ EnterCriticalSection( &request->headers_section );
|
||||
EnterCriticalSection( &request->headers_section );
|
||||
|
||||
- /* REPLACE wins out over ADD */
|
||||
- if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE)
|
||||
@@ -101,15 +97,15 @@ index 1cc688b6b07..1219507bd3d 100644
|
||||
- HTTP_DeleteCustomHeader( request, index );
|
||||
+ goto out;
|
||||
+ }
|
||||
|
||||
- if (value && value[0])
|
||||
+
|
||||
+ /* do not add new header if FLAG_ADD_IF_NEW is set */
|
||||
+ if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW)
|
||||
+ {
|
||||
+ res = ERROR_HTTP_INVALID_HEADER; /* FIXME */
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
|
||||
- if (value && value[0])
|
||||
+ /* handle appending to existing header */
|
||||
+ if (dwModifier & COALESCEFLAGS)
|
||||
{
|
||||
@@ -125,7 +121,10 @@ index 1cc688b6b07..1219507bd3d 100644
|
||||
+ lphttpHdr->wFlags |= HDR_ISREQUEST;
|
||||
+ else
|
||||
+ lphttpHdr->wFlags &= ~HDR_ISREQUEST;
|
||||
+
|
||||
|
||||
- hdr.lpszField = (LPWSTR)field;
|
||||
- hdr.lpszValue = (LPWSTR)value;
|
||||
- hdr.wFlags = hdr.wCount = 0;
|
||||
+ if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA)
|
||||
+ {
|
||||
+ ch = ',';
|
||||
@@ -137,13 +136,14 @@ index 1cc688b6b07..1219507bd3d 100644
|
||||
+ lphttpHdr->wFlags |= HDR_COMMADELIMITED;
|
||||
+ }
|
||||
|
||||
- hdr.lpszField = (LPWSTR)field;
|
||||
- hdr.lpszValue = (LPWSTR)value;
|
||||
- hdr.wFlags = hdr.wCount = 0;
|
||||
+ len = origlen + valuelen + ((ch > 0) ? 2 : 0);
|
||||
|
||||
- if (dwModifier & HTTP_ADDHDR_FLAG_REQ)
|
||||
- hdr.wFlags |= HDR_ISREQUEST;
|
||||
+ len = origlen + valuelen + ((ch > 0) ? 2 : 0);
|
||||
|
||||
- res = HTTP_InsertCustomHeader(request, &hdr);
|
||||
- LeaveCriticalSection( &request->headers_section );
|
||||
- return res;
|
||||
- }
|
||||
+ lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR));
|
||||
+ if (lpsztmp)
|
||||
+ {
|
||||
@@ -157,10 +157,10 @@ index 1cc688b6b07..1219507bd3d 100644
|
||||
+ origlen++;
|
||||
+ }
|
||||
|
||||
- res = HTTP_InsertCustomHeader(request, &hdr);
|
||||
- LeaveCriticalSection( &request->headers_section );
|
||||
- return res;
|
||||
- }
|
||||
- LeaveCriticalSection( &request->headers_section );
|
||||
- return ERROR_SUCCESS;
|
||||
- }
|
||||
- else if (dwModifier & COALESCEFLAGS)
|
||||
+ memcpy(&lphttpHdr->lpszValue[origlen], value, valuelen*sizeof(WCHAR));
|
||||
+ lphttpHdr->lpszValue[len] = '\0';
|
||||
+ }
|
||||
@@ -169,11 +169,7 @@ index 1cc688b6b07..1219507bd3d 100644
|
||||
+ WARN("heap_realloc (%d bytes) failed\n",len+1);
|
||||
+ res = ERROR_OUTOFMEMORY;
|
||||
+ }
|
||||
|
||||
- LeaveCriticalSection( &request->headers_section );
|
||||
- return ERROR_SUCCESS;
|
||||
- }
|
||||
- else if (dwModifier & COALESCEFLAGS)
|
||||
+
|
||||
+ goto out;
|
||||
+ }
|
||||
+ }
|
||||
|
Reference in New Issue
Block a user