Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1086 return true; | 1086 return true; |
| 1087 case 401: | 1087 case 401: |
| 1088 if (server_auth_state_ == AUTH_STATE_CANCELED) | 1088 if (server_auth_state_ == AUTH_STATE_CANCELED) |
| 1089 return false; | 1089 return false; |
| 1090 server_auth_state_ = AUTH_STATE_NEED_AUTH; | 1090 server_auth_state_ = AUTH_STATE_NEED_AUTH; |
| 1091 return true; | 1091 return true; |
| 1092 } | 1092 } |
| 1093 return false; | 1093 return false; |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 bool URLRequestHttpJob::HasAuth() const { | |
| 1097 return proxy_auth_state_ == AUTH_STATE_HAVE_AUTH || | |
| 1098 server_auth_state_ == AUTH_STATE_HAVE_AUTH; | |
|
asanka
2013/04/04 17:20:31
These aren't set if the request used cached creden
qinmin
2013/04/04 22:34:25
Use transaction_->HasAuth() to get the credentials
| |
| 1099 } | |
| 1100 | |
| 1096 void URLRequestHttpJob::GetAuthChallengeInfo( | 1101 void URLRequestHttpJob::GetAuthChallengeInfo( |
| 1097 scoped_refptr<AuthChallengeInfo>* result) { | 1102 scoped_refptr<AuthChallengeInfo>* result) { |
| 1098 DCHECK(transaction_.get()); | 1103 DCHECK(transaction_.get()); |
| 1099 DCHECK(response_info_); | 1104 DCHECK(response_info_); |
| 1100 | 1105 |
| 1101 // sanity checks: | 1106 // sanity checks: |
| 1102 DCHECK(proxy_auth_state_ == AUTH_STATE_NEED_AUTH || | 1107 DCHECK(proxy_auth_state_ == AUTH_STATE_NEED_AUTH || |
| 1103 server_auth_state_ == AUTH_STATE_NEED_AUTH); | 1108 server_auth_state_ == AUTH_STATE_NEED_AUTH); |
| 1104 DCHECK((GetResponseHeaders()->response_code() == HTTP_UNAUTHORIZED) || | 1109 DCHECK((GetResponseHeaders()->response_code() == HTTP_UNAUTHORIZED) || |
| 1105 (GetResponseHeaders()->response_code() == | 1110 (GetResponseHeaders()->response_code() == |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 | 1581 |
| 1577 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1582 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1578 awaiting_callback_ = false; | 1583 awaiting_callback_ = false; |
| 1579 } | 1584 } |
| 1580 | 1585 |
| 1581 void URLRequestHttpJob::OnDetachRequest() { | 1586 void URLRequestHttpJob::OnDetachRequest() { |
| 1582 http_transaction_delegate_->OnDetachRequest(); | 1587 http_transaction_delegate_->OnDetachRequest(); |
| 1583 } | 1588 } |
| 1584 | 1589 |
| 1585 } // namespace net | 1590 } // namespace net |
| OLD | NEW |