summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-01-18 15:56:59 +0000
committerKristian Monsen <kristianm@google.com>2011-01-18 16:13:21 +0000
commit319a1ceb63784aba2c0c94808707e1ce9ac90f71 (patch)
tree5abb60554cfd0bb0565e0a8cc25486c41d86e18f /WebKit
parentf42f297f9d1e499b6b54e6c73ddb46dbb4745ede (diff)
downloadexternal_webkit-319a1ceb63784aba2c0c94808707e1ce9ac90f71.zip
external_webkit-319a1ceb63784aba2c0c94808707e1ce9ac90f71.tar.gz
external_webkit-319a1ceb63784aba2c0c94808707e1ce9ac90f71.tar.bz2
Try to guess content type if header is generic
Don't just use text/plain or application/octet-stream, this matches the old stack. Fix for bug 2981069 Change-Id: I1b5edf0e60e7c7012f4143906ec926227edcf927
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/WebResponse.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/WebKit/android/WebCoreSupport/WebResponse.cpp b/WebKit/android/WebCoreSupport/WebResponse.cpp
index 52297b2..a00b52d 100644
--- a/WebKit/android/WebCoreSupport/WebResponse.cpp
+++ b/WebKit/android/WebCoreSupport/WebResponse.cpp
@@ -114,7 +114,10 @@ void WebResponse::setUrl(const string& url)
// TODO: can we return a WTF::String directly? Need to check all callsites.
const string& WebResponse::getMimeType()
{
- if (!m_mime.length() && m_url.length())
+ if (!m_url.length())
+ return m_mime;
+
+ if (!m_mime.length() || !m_mime.compare("text/plain") || !m_mime.compare("application/octet-stream"))
m_mime = resolveMimeType(m_url);
return m_mime;
@@ -134,6 +137,7 @@ const string WebResponse::resolveMimeType(string url)
if (extensionPos != WTF::notFound) {
// We found a file extension.
path.remove(0, extensionPos + 1);
+ // TODO: Should use content-disposition instead of url if it is there
WTF::String mime = WebCore::MIMETypeRegistry::getMIMETypeForExtension(path);
if (!mime.isEmpty()) {
// Great, we found a MIME type.