Bug 5954

Summary: Cleanup Content-Type parsing
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: bugs-webkit, ian
Priority: P4    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on: 8644    
Bug Blocks: 14059    
Attachments:
Description Flags
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf
none
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf
none
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf ap: review+

Description Alexey Proskuryakov 2005-12-05 13:06:10 PST
(from bug 5744).

Currently, at least three distinct parsers for Content-Type strings are used:
1) For HTTP headers, Foundation does the parsing;
2) Http-Equiv metas are parsed in khtml::Decoder;
3) XmlHttpRequest MIME type overrides are parsed in xmlhttprequest.cpp.

The implementations are not identical in implementation and behavior, so they need to be synchronized 
and, if possible, reused.
Comment 1 Eric Seidel (no email) 2005-12-27 13:29:38 PST
Assigning bugs which hyatt is not actively working on to "nobody" for clarity/consistancy.
Comment 2 Alexey Proskuryakov 2006-12-08 10:27:48 PST
We now have plaftorm/network/HTTPParsers.{h,cpp} to hold this common implementation.
Comment 3 Holger Freyther 2007-07-10 16:19:59 PDT
Created attachment 15468 [details]
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf

Note: This copies two methods from a LGPL file to a BSD one.

These three parse methods will be used by the CURL backend to implement ResourceResponse handling. This is existing code copied to a different place. All three methods have known and documented issues and are not taken care by this change. The most important part of this change is making these three methods available to the CURL backend.

Fixing and improving the implementation will be done in following patches.
Comment 4 Holger Freyther 2007-07-10 16:21:10 PDT
The CURL backend patch needs these three methods for the implementation of ResourceResponse.
Comment 5 Holger Freyther 2007-07-10 16:28:05 PDT
I forgot to update the copyright header. Apple Inc. is missing from HTTPParsers.cpp
Comment 6 Holger Freyther 2007-07-10 17:23:17 PDT
Created attachment 15469 [details]
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf

Same patch as the previous one. Adds the Copyright notice of apple and renames getCharset to parseCharset in the implementation.
Comment 7 Holger Freyther 2007-07-11 11:56:12 PDT
Created attachment 15476 [details]
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf

Change function names, remove String parameter to follow the coding style. Change contentTypeString -> mediaType in the implementation.
Comment 8 Alexey Proskuryakov 2007-07-11 12:02:21 PDT
Comment on attachment 15476 [details]
Move getMIMEType and getCharset to HTTPParsers, and one parse method from platform/net/cf

r=me

+        Copy filenameFromHTTPContentDisposition to HTTPParsers as well. This parse

I'd say "move" here as well.
Comment 9 Mark Rowe (bdash) 2007-07-13 04:49:18 PDT
Landed in r24254.