| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(ukai): code is similar with http_network_transaction.cc. We should | 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should |
| 6 // think about ways to share code, if possible. | 6 // think about ways to share code, if possible. |
| 7 | 7 |
| 8 #include "net/socket_stream/socket_stream.h" | 8 #include "net/socket_stream/socket_stream.h" |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 DCHECK(!proxy_info_.is_empty()); | 923 DCHECK(!proxy_info_.is_empty()); |
| 924 return GURL("http://" + | 924 return GURL("http://" + |
| 925 proxy_info_.proxy_server().host_port_pair().ToString()); | 925 proxy_info_.proxy_server().host_port_pair().ToString()); |
| 926 } | 926 } |
| 927 | 927 |
| 928 int SocketStream::HandleAuthChallenge(const HttpResponseHeaders* headers) { | 928 int SocketStream::HandleAuthChallenge(const HttpResponseHeaders* headers) { |
| 929 GURL auth_origin(ProxyAuthOrigin()); | 929 GURL auth_origin(ProxyAuthOrigin()); |
| 930 | 930 |
| 931 LOG(INFO) << "The proxy " << auth_origin << " requested auth"; | 931 LOG(INFO) << "The proxy " << auth_origin << " requested auth"; |
| 932 | 932 |
| 933 // The auth we tried just failed, hence it can't be valid. | 933 // TODO(cbentzel): Since SocketStream only suppports basic authentication |
| 934 // Remove it from the cache so it won't be used again. | 934 // right now, another challenge is always treated as a rejection. |
| 935 if (auth_handler_.get() && !auth_identity_.invalid && | 935 // Ultimately this should be converted to use HttpAuthController like the |
| 936 auth_handler_->IsFinalRound()) { | 936 // HttpNetworkTransaction has. |
| 937 if (auth_handler_.get() && !auth_identity_.invalid) { |
| 937 if (auth_identity_.source != HttpAuth::IDENT_SRC_PATH_LOOKUP) | 938 if (auth_identity_.source != HttpAuth::IDENT_SRC_PATH_LOOKUP) |
| 938 auth_cache_.Remove(auth_origin, | 939 auth_cache_.Remove(auth_origin, |
| 939 auth_handler_->realm(), | 940 auth_handler_->realm(), |
| 940 auth_handler_->scheme(), | 941 auth_handler_->scheme(), |
| 941 auth_identity_.username, | 942 auth_identity_.username, |
| 942 auth_identity_.password); | 943 auth_identity_.password); |
| 943 auth_handler_.reset(); | 944 auth_handler_.reset(); |
| 944 auth_identity_ = HttpAuth::Identity(); | 945 auth_identity_ = HttpAuth::Identity(); |
| 945 } | 946 } |
| 946 | 947 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 | 1021 |
| 1021 SSLConfigService* SocketStream::ssl_config_service() const { | 1022 SSLConfigService* SocketStream::ssl_config_service() const { |
| 1022 return context_->ssl_config_service(); | 1023 return context_->ssl_config_service(); |
| 1023 } | 1024 } |
| 1024 | 1025 |
| 1025 ProxyService* SocketStream::proxy_service() const { | 1026 ProxyService* SocketStream::proxy_service() const { |
| 1026 return context_->proxy_service(); | 1027 return context_->proxy_service(); |
| 1027 } | 1028 } |
| 1028 | 1029 |
| 1029 } // namespace net | 1030 } // namespace net |
| OLD | NEW |