From a41fae8db8109bfeed047015b77b0d9227118540 Mon Sep 17 00:00:00 2001 From: "jar@chromium.org" Date: Sat, 21 Feb 2009 06:11:45 +0000 Subject: Provide error reporting and recovery for SDCH responses not market as HTML Some AV software may actually strip content type as well as content encoding. As a result, when we propose a dicitonary (suggesting that this will probably be an SDCH encoded response) we need to be ready to "fix" the content-encoding string if it is not marked as gzip,sdch. Note that "fixups" put in tentative decodes, which degrade to pass-through filters if the content's header is not compatible with the decoding format. I also added a line of defensive coding in the dictionary fetcher, and cleaned up a line where I record stats after decoding sdch. bug=7679 r=openvcdiff,huanr Review URL: http://codereview.chromium.org/27016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10143 0039d316-1c4b-4281-b951-d872f2087c98 --- net/url_request/url_request_http_job.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'net/url_request') diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index 0f65534..32c6ed2 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -70,8 +70,15 @@ URLRequestHttpJob::~URLRequestHttpJob() { // Prior to reaching the destructor, request_ has been set to a NULL // pointer, so request_->url() is no longer valid in the destructor, and we // use an alternate copy |request_info_.url|. - SdchManager::Global()->FetchDictionary(request_info_.url, - sdch_dictionary_url_); + SdchManager* manager = SdchManager::Global(); + // To be extra safe, since this is a "different time" from when we decided + // to get the dictionary, we'll validate that an SdchManager is available. + // At shutdown time, care is taken to be sure that we don't delete this + // globally useful instance "too soon," so this check is just defensive + // coding to assure that IF the system is shutting down, we don't have any + // problem if the manager was deleted ahead of time. + if (manager) // Defensive programming. + manager->FetchDictionary(request_info_.url, sdch_dictionary_url_); } } -- cgit v1.1