diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-04 18:39:53 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-04 18:39:53 +0000 |
commit | 6c74c2a80e7d2664308b932c7cd6787ef7aea20f (patch) | |
tree | c7f636cae6f03c8bf84de9f7e94e573b60b9e5d9 /net | |
parent | 880b8305e94fb45c10e9ecbff4822dc11fae880b (diff) | |
download | chromium_src-6c74c2a80e7d2664308b932c7cd6787ef7aea20f.zip chromium_src-6c74c2a80e7d2664308b932c7cd6787ef7aea20f.tar.gz chromium_src-6c74c2a80e7d2664308b932c7cd6787ef7aea20f.tar.bz2 |
Add metarefresh for SDCH in yet another case.
I had historically hit meta-refresh loops, and the code appeared
to be too careful to avoid such a loop. This change avoids the
infinite loop, and does at least an SDCH backoff of support
when an infinite loop might otherwise be induced.
BUG=31271
r=kmixter
Review URL: http://codereview.chromium.org/518029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/sdch_filter.cc | 15 | ||||
-rw-r--r-- | net/base/sdch_manager.h | 2 |
2 files changed, 14 insertions, 3 deletions
diff --git a/net/base/sdch_filter.cc b/net/base/sdch_filter.cc index 1687226..725ee3e 100644 --- a/net/base/sdch_filter.cc +++ b/net/base/sdch_filter.cc @@ -189,14 +189,25 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer, // the meta-refresh result. // TODO(jar): Improve robustness by sniffing for valid text that we can // actual use re: decoding_status_ = PASS_THROUGH; - } else if (!dictionary_hash_is_plausible_) { + } else if (dictionary_hash_is_plausible_) { + // We need a meta-refresh since we don't have the dictionary. + // The common cause is a restart of the browser, where we try to render + // cached content that was saved when we had a dictionary. + } else if (filter_context().IsSdchResponse()) { + // This is a very corrupt SDCH request response. We can't decode it. + // We'll use a meta-refresh, and get content without asking for SDCH. + // This will also progressively disable SDCH for this domain. + } else { // One of the first 9 bytes precluded consideration as a hash. // This can't be an SDCH payload, even though the server said it was. // This is a major error, as the server or proxy tagged this SDCH even // though it is not! + // Meta-refresh won't help, as we didn't advertise an SDCH dictionary!! + // Worse yet, meta-refresh could lead to an infinite refresh loop. SdchManager::SdchErrorRecovery(SdchManager::PASSING_THROUGH_NON_SDCH); - // Meta-refresh won't help... we didn't advertise an SDCH dictionary!! decoding_status_ = PASS_THROUGH; + // ... but further back-off on advertising SDCH support. + SdchManager::BlacklistDomain(url_); } if (decoding_status_ == PASS_THROUGH) { diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h index e6286f5..67ca5e5 100644 --- a/net/base/sdch_manager.h +++ b/net/base/sdch_manager.h @@ -120,7 +120,7 @@ class SdchManager { // defunct = 73, // PASSING_THROUGH_NON_SDCH plus DISCARD_TENTATIVE_SDCH. META_REFRESH_UNSUPPORTED = 74, // Unrecoverable error. CACHED_META_REFRESH_UNSUPPORTED = 75, // As above, but pulled from cache. - PASSING_THROUGH_NON_SDCH = 76, // Non-html tagged as sdch but malformed. + PASSING_THROUGH_NON_SDCH = 76, // Tagged sdch but missing dictionary-hash. INCOMPLETE_SDCH_CONTENT = 77, // Last window was not completely decoded. PASS_THROUGH_404_CODE = 78, // URL not found message passing through. |