Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Unified Diff: net/url_request/url_request_http_job.cc

Issue 206503006: Fix content-encoding handling with buggy servers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/filter/filter.cc ('K') | « net/filter/mock_filter_context.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 7207777517db74bcfff9d1a4abb8ceb80b655dc5..9453a861a263967673f42e8c313278af8c670002 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -25,6 +25,7 @@
#include "net/base/sdch_manager.h"
#include "net/cert/cert_status_flags.h"
#include "net/cookies/cookie_monster.h"
+#include "net/http/http_content_disposition.h"
#include "net/http/http_network_session.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
@@ -58,6 +59,7 @@ class URLRequestHttpJob::HttpFilterContext : public FilterContext {
// FilterContext implementation.
virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
virtual bool GetURL(GURL* gurl) const OVERRIDE;
+ virtual bool GetFilename(std::string* filename) const OVERRIDE;
virtual base::Time GetRequestTime() const OVERRIDE;
virtual bool IsCachedContent() const OVERRIDE;
virtual bool IsDownload() const OVERRIDE;
@@ -96,6 +98,21 @@ bool URLRequestHttpJob::HttpFilterContext::GetURL(GURL* gurl) const {
return true;
}
+bool URLRequestHttpJob::HttpFilterContext::GetFilename(
+ std::string* filename) const {
+ HttpResponseHeaders* headers = job_->GetResponseHeaders();
+ std::string disposition;
+ void *iter = NULL;
+ if (!headers->EnumerateHeader(&iter, "Content-Disposition", &disposition))
+ return false;
+ HttpContentDisposition parsed_disposition(disposition, std::string());
+ std::string parsed_filename = parsed_disposition.filename();
+ if (parsed_filename.empty())
+ return false;
+ *filename = parsed_filename;
+ return true;
+}
+
base::Time URLRequestHttpJob::HttpFilterContext::GetRequestTime() const {
return job_->request() ? job_->request()->request_time() : base::Time();
}
« net/filter/filter.cc ('K') | « net/filter/mock_filter_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698