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

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Jun 8 13:01:07 CDT 2022


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

Needed by 3rd patch.

 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 e6f2035..5d74cc1 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;
 
-- 
2.34.1




More information about the wine-devel mailing list