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 #include "net/http/http_stream_request.h" | 5 #include "net/http/http_stream_request.h" |
6 | 6 |
7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 const HttpResponseInfo& response, | 199 const HttpResponseInfo& response, |
200 HttpAuthController* auth_controller) { | 200 HttpAuthController* auth_controller) { |
201 delegate_->OnNeedsProxyAuth(response, auth_controller); | 201 delegate_->OnNeedsProxyAuth(response, auth_controller); |
202 } | 202 } |
203 | 203 |
204 void HttpStreamRequest::OnNeedsClientAuthCallback( | 204 void HttpStreamRequest::OnNeedsClientAuthCallback( |
205 SSLCertRequestInfo* cert_info) { | 205 SSLCertRequestInfo* cert_info) { |
206 delegate_->OnNeedsClientAuth(cert_info); | 206 delegate_->OnNeedsClientAuth(cert_info); |
207 } | 207 } |
208 | 208 |
| 209 void HttpStreamRequest::OnNeedsTLSLoginCallback( |
| 210 AuthChallengeInfo* login_info) { |
| 211 delegate_->OnNeedsTLSLogin(login_info); |
| 212 } |
| 213 |
209 void HttpStreamRequest::OnHttpsProxyTunnelResponseCallback( | 214 void HttpStreamRequest::OnHttpsProxyTunnelResponseCallback( |
210 const HttpResponseInfo& response_info, | 215 const HttpResponseInfo& response_info, |
211 HttpStream* stream) { | 216 HttpStream* stream) { |
212 delegate_->OnHttpsProxyTunnelResponse(response_info, stream); | 217 delegate_->OnHttpsProxyTunnelResponse(response_info, stream); |
213 } | 218 } |
214 | 219 |
215 void HttpStreamRequest::OnPreconnectsComplete(int result) { | 220 void HttpStreamRequest::OnPreconnectsComplete(int result) { |
216 preconnect_delegate_->OnPreconnectsComplete(this, result); | 221 preconnect_delegate_->OnPreconnectsComplete(this, result); |
217 } | 222 } |
218 | 223 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 return ERR_IO_PENDING; | 277 return ERR_IO_PENDING; |
273 | 278 |
274 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: | 279 case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: |
275 MessageLoop::current()->PostTask( | 280 MessageLoop::current()->PostTask( |
276 FROM_HERE, | 281 FROM_HERE, |
277 method_factory_.NewRunnableMethod( | 282 method_factory_.NewRunnableMethod( |
278 &HttpStreamRequest::OnNeedsClientAuthCallback, | 283 &HttpStreamRequest::OnNeedsClientAuthCallback, |
279 connection_->ssl_error_response_info().cert_request_info)); | 284 connection_->ssl_error_response_info().cert_request_info)); |
280 return ERR_IO_PENDING; | 285 return ERR_IO_PENDING; |
281 | 286 |
| 287 case ERR_TLS_CLIENT_LOGIN_NEEDED: |
| 288 MessageLoop::current()->PostTask( |
| 289 FROM_HERE, |
| 290 method_factory_.NewRunnableMethod( |
| 291 &HttpStreamRequest::OnNeedsTLSLoginCallback, |
| 292 connection_->ssl_error_response_info().login_request_info)); |
| 293 return ERR_TLS_CLIENT_LOGIN_NEEDED; |
| 294 |
282 case ERR_HTTPS_PROXY_TUNNEL_RESPONSE: | 295 case ERR_HTTPS_PROXY_TUNNEL_RESPONSE: |
283 { | 296 { |
284 DCHECK(connection_.get()); | 297 DCHECK(connection_.get()); |
285 DCHECK(connection_->socket()); | 298 DCHECK(connection_->socket()); |
286 DCHECK(establishing_tunnel_); | 299 DCHECK(establishing_tunnel_); |
287 | 300 |
288 ProxyClientSocket* proxy_socket = | 301 ProxyClientSocket* proxy_socket = |
289 static_cast<ProxyClientSocket*>(connection_->socket()); | 302 static_cast<ProxyClientSocket*>(connection_->socket()); |
290 MessageLoop::current()->PostTask( | 303 MessageLoop::current()->PostTask( |
291 FROM_HERE, | 304 FROM_HERE, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 489 |
477 int HttpStreamRequest::DoInitConnection() { | 490 int HttpStreamRequest::DoInitConnection() { |
478 DCHECK(!connection_->is_initialized()); | 491 DCHECK(!connection_->is_initialized()); |
479 DCHECK(proxy_info()->proxy_server().is_valid()); | 492 DCHECK(proxy_info()->proxy_server().is_valid()); |
480 next_state_ = STATE_INIT_CONNECTION_COMPLETE; | 493 next_state_ = STATE_INIT_CONNECTION_COMPLETE; |
481 | 494 |
482 bool want_spdy_over_npn = | 495 bool want_spdy_over_npn = |
483 alternate_protocol_mode_ == kUsingAlternateProtocol && | 496 alternate_protocol_mode_ == kUsingAlternateProtocol && |
484 alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_2; | 497 alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_2; |
485 using_ssl_ = request_info().url.SchemeIs("https") || | 498 using_ssl_ = request_info().url.SchemeIs("https") || |
| 499 request_info().url.SchemeIs("httpsv") || |
486 ShouldForceSpdySSL() || want_spdy_over_npn; | 500 ShouldForceSpdySSL() || want_spdy_over_npn; |
487 using_spdy_ = false; | 501 using_spdy_ = false; |
488 | 502 |
489 // If spdy has been turned off on-the-fly, then there may be SpdySessions | 503 // If spdy has been turned off on-the-fly, then there may be SpdySessions |
490 // still active. But don't use them unless spdy is currently on. | 504 // still active. But don't use them unless spdy is currently on. |
491 if (HttpStreamFactory::spdy_enabled()) { | 505 if (HttpStreamFactory::spdy_enabled()) { |
492 // Check first if we have a spdy session for this group. If so, then go | 506 // Check first if we have a spdy session for this group. If so, then go |
493 // straight to using that. | 507 // straight to using that. |
494 HostPortProxyPair pair(endpoint_, proxy_info()->proxy_server()); | 508 HostPortProxyPair pair(endpoint_, proxy_info()->proxy_server()); |
495 if (session_->spdy_session_pool()->HasSession(pair)) { | 509 if (session_->spdy_session_pool()->HasSession(pair)) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 disable_resolver_cache); | 554 disable_resolver_cache); |
541 } else { | 555 } else { |
542 ProxyServer proxy_server = proxy_info()->proxy_server(); | 556 ProxyServer proxy_server = proxy_info()->proxy_server(); |
543 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); | 557 proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); |
544 scoped_refptr<TCPSocketParams> proxy_tcp_params( | 558 scoped_refptr<TCPSocketParams> proxy_tcp_params( |
545 new TCPSocketParams(*proxy_host_port, request_info().priority, | 559 new TCPSocketParams(*proxy_host_port, request_info().priority, |
546 request_info().referrer, disable_resolver_cache)); | 560 request_info().referrer, disable_resolver_cache)); |
547 | 561 |
548 if (proxy_info()->is_http() || proxy_info()->is_https()) { | 562 if (proxy_info()->is_http() || proxy_info()->is_https()) { |
549 GURL authentication_url = request_info().url; | 563 GURL authentication_url = request_info().url; |
550 if (using_ssl_ && !authentication_url.SchemeIs("https")) { | 564 if (using_ssl_ && !authentication_url.SchemeIs("https") && |
| 565 !authentication_url.SchemeIs("httpsv")) { |
551 // If a proxy tunnel connection needs to be established due to | 566 // If a proxy tunnel connection needs to be established due to |
552 // an Alternate-Protocol, the URL needs to be changed to indicate | 567 // an Alternate-Protocol, the URL needs to be changed to indicate |
553 // https or digest authentication attempts will fail. | 568 // https or digest authentication attempts will fail. |
554 // For example, suppose the initial request was for | 569 // For example, suppose the initial request was for |
555 // "http://www.example.com/index.html". If this is an SSL | 570 // "http://www.example.com/index.html". If this is an SSL |
556 // upgrade due to alternate protocol, the digest authorization | 571 // upgrade due to alternate protocol, the digest authorization |
557 // should have a uri="www.example.com:443" field rather than a | 572 // should have a uri="www.example.com:443" field rather than a |
558 // "/index.html" entry, even though the original request URL has not | 573 // "/index.html" entry, even though the original request URL has not |
559 // changed. | 574 // changed. |
560 authentication_url = UpgradeUrlToHttps(authentication_url); | 575 authentication_url = UpgradeUrlToHttps(authentication_url); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1096 base::TimeDelta::FromMinutes(6), | 1111 base::TimeDelta::FromMinutes(6), |
1097 100); | 1112 100); |
1098 break; | 1113 break; |
1099 default: | 1114 default: |
1100 NOTREACHED(); | 1115 NOTREACHED(); |
1101 break; | 1116 break; |
1102 } | 1117 } |
1103 } | 1118 } |
1104 | 1119 |
1105 } // namespace net | 1120 } // namespace net |
OLD | NEW |