summaryrefslogtreecommitdiffstats
path: root/net/http/http_network_transaction.h
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 04:00:22 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 04:00:22 +0000
commit0757e770ac9ce685ee0db0179271f1a3dba47cb0 (patch)
tree54e1a153fd38a9f950187929076a1d5d6966357e /net/http/http_network_transaction.h
parent3a2d366b664bb0c13f4427f3ed6a3b6af6e77451 (diff)
downloadchromium_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_network_transaction.h')
-rw-r--r--net/http/http_network_transaction.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index 088a090..939a900 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -41,6 +41,11 @@ class HttpNetworkTransaction : public HttpTransaction {
virtual int RestartWithAuth(const std::wstring& username,
const std::wstring& password,
CompletionCallback* callback);
+ virtual bool IsReadyToRestartForAuth() {
+ return pending_auth_target_ != HttpAuth::AUTH_NONE &&
+ HaveAuth(pending_auth_target_);
+ }
+
virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
virtual const HttpResponseInfo* GetResponseInfo() const;
virtual LoadState GetLoadState() const;
@@ -152,10 +157,8 @@ class HttpNetworkTransaction : public HttpTransaction {
void AddAuthorizationHeader(HttpAuth::Target target);
// Handles HTTP status code 401 or 407.
- // HandleAuthChallenge() returns a network error code, or OK, or
- // WILL_RESTART_TRANSACTION. The latter indicates that the state machine has
- // been updated to restart the transaction with a new auth attempt.
- enum { WILL_RESTART_TRANSACTION = 1 };
+ // HandleAuthChallenge() returns a network error code, or OK on success.
+ // May update |pending_auth_target_| or |response_.auth_challenge|.
int HandleAuthChallenge();
// Populates response_.auth_challenge with the challenge information, so that
@@ -177,10 +180,6 @@ class HttpNetworkTransaction : public HttpTransaction {
// auth_handler_[target] with the cache entry's data and returns true.
bool SelectPreemptiveAuth(HttpAuth::Target target);
- bool NeedAuth(HttpAuth::Target target) const {
- return auth_handler_[target].get() && auth_identity_[target].invalid;
- }
-
bool HaveAuth(HttpAuth::Target target) const {
return auth_handler_[target].get() && !auth_identity_[target].invalid;
}
@@ -206,6 +205,11 @@ class HttpNetworkTransaction : public HttpTransaction {
// a number of places (url, cache, prompt).
HttpAuth::Identity auth_identity_[2];
+ // Whether this transaction is waiting for proxy auth, server auth, or is
+ // not waiting for any auth at all. |pending_auth_target_| is read and
+ // cleared by RestartWithAuth().
+ HttpAuth::Target pending_auth_target_;
+
CompletionCallbackImpl<HttpNetworkTransaction> io_callback_;
CompletionCallback* user_callback_;