diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-27 04:00:22 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-27 04:00:22 +0000 |
commit | 0757e770ac9ce685ee0db0179271f1a3dba47cb0 (patch) | |
tree | 54e1a153fd38a9f950187929076a1d5d6966357e /net/http/http_util.cc | |
parent | 3a2d366b664bb0c13f4427f3ed6a3b6af6e77451 (diff) | |
download | chromium_src-0757e770ac9ce685ee0db0179271f1a3dba47cb0.zip chromium_src-0757e770ac9ce685ee0db0179271f1a3dba47cb0.tar.gz chromium_src-0757e770ac9ce685ee0db0179271f1a3dba47cb0.tar.bz2 |
Respect cookies set in a 401 responses when restarting the http transaction.
There are two parts to this change:
(1) rebuild the request cookies before each transaction restart for
authentication
(2) notify the URLRequestHttpJob of header completion before *each*
transaction restart for authentication
By "each transaction" I mean the automatic restarts that don't require
user input, such as:
- replying to the first step of NTLM
- selecting identity embedded in URL
- selecting identity in auth-cache
Needing to notify URLRequestHttpJob for these intermediate restarts is
a consequence of cookie store management being done outside of
HttpNetworkTransaction.
After updating the cookie store, URLRequestHttpJob now tests
|HttpTransaction::IsReadyToRestartForAuth()| to check whether the
notification was informational or an identity is actually needed.
R=wtc
BUG=6450
Review URL: http://codereview.chromium.org/51004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12635 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_util.cc')
-rw-r--r-- | net/http/http_util.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/http/http_util.cc b/net/http/http_util.cc index 7094b03..500222a 100644 --- a/net/http/http_util.cc +++ b/net/http/http_util.cc @@ -218,6 +218,31 @@ bool HttpUtil::HasHeader(const std::string& headers, const char* name) { } // static +std::string HttpUtil::StripHeaders(const std::string& headers, + const char* const headers_to_remove[], + size_t headers_to_remove_len) { + std::string stripped_headers; + net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n"); + + while (it.GetNext()) { + bool should_remove = false; + for (size_t i = 0; i < headers_to_remove_len; ++i) { + if (LowerCaseEqualsASCII(it.name_begin(), it.name_end(), + headers_to_remove[i])) { + should_remove = true; + break; + } + } + if (!should_remove) { + // Assume that name and values are on the same line. + stripped_headers.append(it.name_begin(), it.values_end()); + stripped_headers.append("\r\n"); + } + } + return stripped_headers; +} + +// static bool HttpUtil::IsNonCoalescingHeader(string::const_iterator name_begin, string::const_iterator name_end) { // NOTE: "set-cookie2" headers do not support expires attributes, so we don't |