diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 01:21:35 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-24 01:21:35 +0000 |
commit | 86de13da4552bd122f2787872f9c60394661f251 (patch) | |
tree | 1d8c0985faff2c3505e6bf11b513047676a590b0 /net/http | |
parent | 64144178c9070dd0e08abf0a70c5da87af0f1722 (diff) | |
download | chromium_src-86de13da4552bd122f2787872f9c60394661f251.zip chromium_src-86de13da4552bd122f2787872f9c60394661f251.tar.gz chromium_src-86de13da4552bd122f2787872f9c60394661f251.tar.bz2 |
ChromeFrame's host network stack implementation for IE full tab mode implicitly follows redirects.
When Chrome receives a notification about a redirect it also attempts to follow the redirect request. While
this works in most cases, some sites actually returned an error for the second request initiated by Chrome.
Fix is to abort the request in urlmon, when we receive a notification about a redirect. I also fixed the
IsRedirectResponse function in the UrlRequestAutomationJob class to only treat 301, 302, 303 and 307 as
redirect codes on the same lines as the default http job.
Test=covered by existing network tests.
I also verified that http://code.google.com/p/chromium/issues/detail?id=25643 works with this CL.
Fixes http://code.google.com/p/chromium/issues/detail?id=28296
Bug=28296
Review URL: http://codereview.chromium.org/402107
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_response_headers.cc | 17 | ||||
-rw-r--r-- | net/http/http_response_headers.h | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc index 9348006..e342d3b 100644 --- a/net/http/http_response_headers.cc +++ b/net/http/http_response_headers.cc @@ -724,12 +724,7 @@ bool HttpResponseHeaders::GetCharset(std::string* charset) const { } bool HttpResponseHeaders::IsRedirect(std::string* location) const { - // Users probably want to see 300 (multiple choice) pages, so we don't count - // them as redirects that need to be followed. - if (!(response_code_ == 301 || - response_code_ == 302 || - response_code_ == 303 || - response_code_ == 307)) + if (!IsRedirectResponseCode(response_code_)) return false; // If we lack a Location header, then we can't treat this as a redirect. @@ -753,6 +748,16 @@ bool HttpResponseHeaders::IsRedirect(std::string* location) const { return true; } +// static +bool HttpResponseHeaders::IsRedirectResponseCode(int response_code) { + // Users probably want to see 300 (multiple choice) pages, so we don't count + // them as redirects that need to be followed. + return (response_code == 301 || + response_code == 302 || + response_code == 303 || + response_code == 307); +} + // From RFC 2616 section 13.2.4: // // The calculation to determine if a response has expired is quite simple: diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h index f1512b4..c071389 100644 --- a/net/http/http_response_headers.h +++ b/net/http/http_response_headers.h @@ -171,6 +171,10 @@ class HttpResponseHeaders // location of the redirect is optionally returned if location is non-null. bool IsRedirect(std::string* location) const; + // Returns true if the HTTP response code passed in corresponds to a + // redirect. + static bool IsRedirectResponseCode(int response_code); + // Returns true if the response cannot be reused without validation. The // result is relative to the current_time parameter, which is a parameter to // support unit testing. The request_time parameter indicates the time at |