Gabriel Ivăncescu : mshtml: Set the channel's content type when parsing the header.

Alexandre Julliard julliard at winehq.org
Wed Jul 13 16:56:08 CDT 2022


Module: wine
Branch: master
Commit: 59f1fdaf7fe16a9102adc676851103099a8a2047
URL:    https://gitlab.winehq.org/wine/wine/-/commit/59f1fdaf7fe16a9102adc676851103099a8a2047

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Wed Jul 13 20:07:32 2022 +0300

mshtml: Set the channel's content type when parsing the header.

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

---

 dlls/mshtml/navigate.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c
index e6f203535b7..5f736dbf07c 100644
--- a/dlls/mshtml/navigate.c
+++ b/dlls/mshtml/navigate.c
@@ -708,12 +708,29 @@ 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, ';');
+
+    if(!This->nschannel->content_type || !(This->nschannel->load_flags & LOAD_CALL_CONTENT_SNIFFERS)) {
+        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;
 
@@ -721,7 +738,6 @@ static void parse_content_type(nsChannelBSC *This, const WCHAR *value)
     while(*ptr && iswspace(*ptr))
         ptr++;
 
-    len = lstrlenW(value);
     if(ptr + ARRAY_SIZE(charsetW) < value+len && !wcsnicmp(ptr, charsetW, ARRAY_SIZE(charsetW))) {
         size_t charset_len, lena;
         nsACString charset_str;




More information about the wine-cvs mailing list