From: "Gabriel Ivăncescu" Subject: [PATCH v2 1/5] mshtml: Set the channel's content type when parsing the header. Message-Id: <3e051b5fb22a2a464a38a796858c645c9c95aca8.1654711042.git.gabrielopcode@gmail.com> Date: Wed, 8 Jun 2022 21:01:07 +0300 Signed-off-by: Gabriel Ivăncescu --- 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