(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.
Assigning bugs which hyatt is not actively working on to "nobody" for clarity/consistancy.
We now have plaftorm/network/HTTPParsers.{h,cpp} to hold this common implementation.
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.
The CURL backend patch needs these three methods for the implementation of ResourceResponse.
I forgot to update the copyright header. Apple Inc. is missing from HTTPParsers.cpp
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.
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 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.
Landed in r24254.