summaryrefslogtreecommitdiffstats
path: root/webkit/glue/weburlloader_impl.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-20 15:24:22 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-20 15:24:22 +0000
commit3fb484784aa97b89c6f11fc9da035fdfcf58da13 (patch)
treef8396e62239fa0970dd8e73b71672f5a8f19d03f /webkit/glue/weburlloader_impl.cc
parent2236bd1f2177a38f67c835a9a2ec6f6f3d26aeb3 (diff)
downloadchromium_src-3fb484784aa97b89c6f11fc9da035fdfcf58da13.zip
chromium_src-3fb484784aa97b89c6f11fc9da035fdfcf58da13.tar.gz
chromium_src-3fb484784aa97b89c6f11fc9da035fdfcf58da13.tar.bz2
Remove the fallback Mozilla code for parsing FTP LIST response.
The new parser seems to be compatible enough to do that. The Mozilla code was very helpful in the process of developing the new parser. Also add UI encouraging users to submit bug reports when we can't parse the listings, and an option to see the raw data sent by the server. This should allow us to fix remaining compatibility problems with very rare listing types or variations. When ?raw is found at the end of an FTP url and it is a directory listing, the parsing logic is bypassed and the data is displayed as-is with text/plain MIME type. TEST=none BUG=25520 Review URL: http://codereview.chromium.org/549053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36632 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/weburlloader_impl.cc')
-rw-r--r--webkit/glue/weburlloader_impl.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc
index ebfb11d..421cb8f 100644
--- a/webkit/glue/weburlloader_impl.cc
+++ b/webkit/glue/weburlloader_impl.cc
@@ -452,8 +452,17 @@ void WebURLLoaderImpl::Context::OnReceivedResponse(
PopulateURLResponse(request_.url(), info, &response);
response.setIsContentFiltered(content_filtered);
- if (info.mime_type == "text/vnd.chromium.ftp-dir")
- response.setMIMEType(WebString::fromUTF8("text/html"));
+ bool show_raw_listing = (GURL(request_.url()).query() == "raw");
+
+ if (info.mime_type == "text/vnd.chromium.ftp-dir") {
+ if (show_raw_listing) {
+ // Set the MIME type to plain text to prevent any active content.
+ response.setMIMEType("text/plain");
+ } else {
+ // We're going to produce a parsed listing in HTML.
+ response.setMIMEType("text/html");
+ }
+ }
client_->didReceiveResponse(loader_, response);
@@ -477,7 +486,8 @@ void WebURLLoaderImpl::Context::OnReceivedResponse(
multipart_delegate_.reset(
new MultipartResponseDelegate(client_, loader_, response, boundary));
}
- } else if (info.mime_type == "text/vnd.chromium.ftp-dir") {
+ } else if (info.mime_type == "text/vnd.chromium.ftp-dir" &&
+ !show_raw_listing) {
ftp_listing_delegate_.reset(
new FtpDirectoryListingResponseDelegate(client_, loader_, response));
}