| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // Resets the members of the transaction so it can be restarted. | 155 // Resets the members of the transaction so it can be restarted. |
| 156 void ResetStateForRestart(); | 156 void ResetStateForRestart(); |
| 157 | 157 |
| 158 // Attach any credentials needed for the proxy server or origin server. | 158 // Attach any credentials needed for the proxy server or origin server. |
| 159 void ApplyAuth(); | 159 void ApplyAuth(); |
| 160 | 160 |
| 161 // Helper used by ApplyAuth(). Adds either the proxy auth header, or the | 161 // Helper used by ApplyAuth(). Adds either the proxy auth header, or the |
| 162 // origin server auth header, as specified by |target| | 162 // origin server auth header, as specified by |target| |
| 163 void AddAuthorizationHeader(HttpAuth::Target target); | 163 void AddAuthorizationHeader(HttpAuth::Target target); |
| 164 | 164 |
| 165 // Returns a log message for all the response headers related to the auth |
| 166 // challenge. |
| 167 std::string AuthChallengeLogMessage() const; |
| 168 |
| 165 // Handles HTTP status code 401 or 407. | 169 // Handles HTTP status code 401 or 407. |
| 166 // HandleAuthChallenge() returns a network error code, or OK on success. | 170 // HandleAuthChallenge() returns a network error code, or OK on success. |
| 167 // May update |pending_auth_target_| or |response_.auth_challenge|. | 171 // May update |pending_auth_target_| or |response_.auth_challenge|. |
| 168 int HandleAuthChallenge(); | 172 int HandleAuthChallenge(); |
| 169 | 173 |
| 170 // Populates response_.auth_challenge with the challenge information, so that | 174 // Populates response_.auth_challenge with the challenge information, so that |
| 171 // URLRequestHttpJob can prompt for a username/password. | 175 // URLRequestHttpJob can prompt for a username/password. |
| 172 void PopulateAuthChallenge(HttpAuth::Target target); | 176 void PopulateAuthChallenge(HttpAuth::Target target); |
| 173 | 177 |
| 174 // Invalidates any auth cache entries after authentication has failed. | 178 // Invalidates any auth cache entries after authentication has failed. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 190 return auth_handler_[target].get() && !auth_identity_[target].invalid; | 194 return auth_handler_[target].get() && !auth_identity_[target].invalid; |
| 191 } | 195 } |
| 192 | 196 |
| 193 // Get the {scheme, host, port} for the authentication target | 197 // Get the {scheme, host, port} for the authentication target |
| 194 GURL AuthOrigin(HttpAuth::Target target) const; | 198 GURL AuthOrigin(HttpAuth::Target target) const; |
| 195 | 199 |
| 196 // Get the absolute path of the resource needing authentication. | 200 // Get the absolute path of the resource needing authentication. |
| 197 // For proxy authentication the path is always empty string. | 201 // For proxy authentication the path is always empty string. |
| 198 std::string AuthPath(HttpAuth::Target target) const; | 202 std::string AuthPath(HttpAuth::Target target) const; |
| 199 | 203 |
| 204 // Returns a string representation of a HttpAuth::Target value that can be |
| 205 // used in log messages. |
| 206 static std::string AuthTargetString(HttpAuth::Target target); |
| 207 |
| 200 // The following three auth members are arrays of size two -- index 0 is | 208 // The following three auth members are arrays of size two -- index 0 is |
| 201 // for the proxy server, and index 1 is for the origin server. | 209 // for the proxy server, and index 1 is for the origin server. |
| 202 // Use the enum HttpAuth::Target to index into them. | 210 // Use the enum HttpAuth::Target to index into them. |
| 203 | 211 |
| 204 // auth_handler encapsulates the logic for the particular auth-scheme. | 212 // auth_handler encapsulates the logic for the particular auth-scheme. |
| 205 // This includes the challenge's parameters. If NULL, then there is no | 213 // This includes the challenge's parameters. If NULL, then there is no |
| 206 // associated auth handler. | 214 // associated auth handler. |
| 207 scoped_refptr<HttpAuthHandler> auth_handler_[2]; | 215 scoped_refptr<HttpAuthHandler> auth_handler_[2]; |
| 208 | 216 |
| 209 // auth_identity_ holds the (username/password) that should be used by | 217 // auth_identity_ holds the (username/password) that should be used by |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 STATE_DRAIN_BODY_FOR_AUTH_RESTART, | 345 STATE_DRAIN_BODY_FOR_AUTH_RESTART, |
| 338 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, | 346 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, |
| 339 STATE_NONE | 347 STATE_NONE |
| 340 }; | 348 }; |
| 341 State next_state_; | 349 State next_state_; |
| 342 }; | 350 }; |
| 343 | 351 |
| 344 } // namespace net | 352 } // namespace net |
| 345 | 353 |
| 346 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ | 354 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ |
| OLD | NEW |