Chromium Code Reviews| Index: net/url_request/url_request_http_job.cc |
| =================================================================== |
| --- net/url_request/url_request_http_job.cc (revision 83675) |
| +++ net/url_request/url_request_http_job.cc (working copy) |
| @@ -101,6 +101,7 @@ |
| virtual base::Time GetRequestTime() const; |
| virtual bool IsCachedContent() const; |
| virtual bool IsDownload() const; |
| + virtual void SetSdchResponse(bool active); |
|
wtc
2011/05/04 17:22:36
This method should not be listed in this group bec
jar (doing other things)
2011/05/04 17:24:50
Done.
|
| virtual bool IsSdchResponse() const; |
| virtual int64 GetByteReadCount() const; |
| virtual int GetResponseCode() const; |
| @@ -144,6 +145,10 @@ |
| return (job_->request_info_.load_flags & LOAD_IS_DOWNLOAD) != 0; |
| } |
| +void URLRequestHttpJob::HttpFilterContext::SetSdchResponse(bool active) { |
| + job_->sdch_dictionary_advertised_ = false; |
|
wtc
2011/05/04 17:22:36
Typo: false => active
Or perhaps you just need a
jar (doing other things)
2011/05/04 17:24:50
Done.
|
| +} |
| + |
| bool URLRequestHttpJob::HttpFilterContext::IsSdchResponse() const { |
| return job_->sdch_dictionary_advertised_; |
| } |
| @@ -866,6 +871,23 @@ |
| encoding_types.push_back(Filter::ConvertEncodingToType(encoding_type)); |
| } |
| + if (filter_context_->IsSdchResponse()) { |
| + // We are wary of proxies that discard or damage SDCH encoding. If a server |
| + // explicitly states that this is not SDCH content, then we can correct our |
| + // assumption that this is an SDCH response, and avoid the need to recover |
| + // as though the content is corrupted (when we discover it is not SDCH |
| + // encoded). |
| + std::string sdch_response_status; |
| + iter = NULL; |
| + while (response_info_->headers->EnumerateHeader(&iter, "X-Sdch-Encode", |
| + &sdch_response_status)) { |
| + if (sdch_response_status == "0") { |
| + filter_context_->SetSdchResponse(false); |
| + break; |
| + } |
| + } |
| + } |
| + |
| // Even if encoding types are empty, there is a chance that we need to add |
| // some decoding, as some proxies strip encoding completely. In such cases, |
| // we may need to add (for example) SDCH filtering (when the context suggests |