RESOLVED INVALID158423
MHTML: Document not displayed due to incorrect folding whitespace handling
https://bugs.webkit.org/show_bug.cgi?id=158423
Summary MHTML: Document not displayed due to incorrect folding whitespace handling
Horst Reiterer
Reported 2016-06-06 09:35:26 PDT
Created attachment 280599 [details] Test Document Loading the attached MHTML document (test.mht) in WebKit results in an empty document. The underlying problem is that the MHTML parser does not parse folding whitespace correctly. The initial header is as follows: MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_NextPart_000_0000_01C12184.8FEC43F0"; type=text/html The second line of the folded Content-Type header starts with a space rather than a tabulator. In RFC2822, folding whitespace is defined as follows: FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space obs-FWS So, the second line may start with a space or a tabulator - the input is correct. However, the parser only handles the tabulator case: qt/qtwebkit/Source/WebCore/platform/network/MIMEHeader.cpp: if (line[0] == '\t') { ASSERT(!key.isEmpty()); With the attached patch (qt-everywhere-opensource-5.4.1-html-fws-sp.patch) against the WebKit version that comes with QT 5.4.1, the document is displayed as expected. As the issue occured in the context of QT, we also reported the issue there: https://bugreports.qt.io/browse/QTBUG-53869
Attachments
Proposed patch (1.34 KB, application/octet-stream)
2016-06-06 09:35 PDT, Horst Reiterer
no flags
Horst Reiterer
Comment 1 2016-06-06 09:35:53 PDT
Created attachment 280600 [details] Proposed patch
Alexey Proskuryakov
Comment 2 2016-06-06 23:23:39 PDT
Thank you for looking into this, and for the patch! Unfortunately, webkit.org is not the right place for this patch. MHTML support has been removed from WebKit mainline long ago, so now we don't even have this file any more. This seems to have been made for some old fork.
Note You need to log in before you can comment on or make changes to this bug.