summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-21 06:11:45 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-21 06:11:45 +0000
commita41fae8db8109bfeed047015b77b0d9227118540 (patch)
tree62ffb92aedeb660c0def2f6d5e187ba8161291e6 /net/url_request
parent46ec902d42373598dd4a1d30da48690109f6571c (diff)
downloadchromium_src-a41fae8db8109bfeed047015b77b0d9227118540.zip
chromium_src-a41fae8db8109bfeed047015b77b0d9227118540.tar.gz
chromium_src-a41fae8db8109bfeed047015b77b0d9227118540.tar.bz2
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
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_http_job.cc11
1 files changed, 9 insertions, 2 deletions
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_);
}
}