[PATCH 1/5] mshtml: Set the channel's content type when parsing the header.

Gabriel Ivăncescu wine at gitlab.winehq.org
Thu Jul 7 09:18:16 CDT 2022


From: Gabriel Ivăncescu <gabrielopcode at gmail.com>

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/mshtml/navigate.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index e6f203535b7..5d74cc15e5d 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -708,12 +708,26 @@ HRESULT read_stream(BSCallback *This, IStream *stream, void *buf, DWORD size, DW
 
 static void parse_content_type(nsChannelBSC *This, const WCHAR *value)
 {
-    const WCHAR *ptr;
-    size_t len;
+    const WCHAR *ptr, *beg, *end;
+    size_t len = wcslen(value);
+    char *content_type;
 
     static const WCHAR charsetW[] = {'c','h','a','r','s','e','t','='};
 
     ptr = wcschr(value, ';');
+    for(end = ptr ? ptr : value + len; end > value; end--)
+        if(!iswspace(end[-1]))
+            break;
+    for(beg = value; beg < end; beg++)
+        if(!iswspace(*beg))
+            break;
+
+    if((content_type = heap_strndupWtoU(beg, end - beg))) {
+        heap_free(This->nschannel->content_type);
+        This->nschannel->content_type = content_type;
+        strlwr(content_type);
+    }
+
     if(!ptr)
         return;
 
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/399



More information about the wine-devel mailing list