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/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "net/http/http_network_session.h" | 12 #include "net/http/http_network_session.h" |
13 #include "net/http/http_server_properties.h" | 13 #include "net/http/http_server_properties.h" |
14 #include "net/http/http_stream_factory_impl_job.h" | 14 #include "net/http/http_stream_factory_impl_job.h" |
15 #include "net/http/http_stream_factory_impl_request.h" | 15 #include "net/http/http_stream_factory_impl_request.h" |
16 #include "net/http/transport_security_state.h" | 16 #include "net/http/transport_security_state.h" |
17 #include "net/log/net_log.h" | 17 #include "net/log/net_log.h" |
18 #include "net/quic/quic_server_id.h" | 18 #include "net/quic/quic_server_id.h" |
19 #include "net/spdy/bidirectional_stream_spdy_job.h" | 19 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
20 #include "net/spdy/spdy_http_stream.h" | 20 #include "net/spdy/spdy_http_stream.h" |
21 #include "url/gurl.h" | 21 #include "url/gurl.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, | 25 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, |
26 bool for_websockets) | 26 bool for_websockets) |
27 : session_(session), | 27 : session_(session), |
28 for_websockets_(for_websockets) {} | 28 for_websockets_(for_websockets) {} |
29 | 29 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 HttpStreamRequest::Delegate* delegate, | 63 HttpStreamRequest::Delegate* delegate, |
64 WebSocketHandshakeStreamBase::CreateHelper* create_helper, | 64 WebSocketHandshakeStreamBase::CreateHelper* create_helper, |
65 const BoundNetLog& net_log) { | 65 const BoundNetLog& net_log) { |
66 DCHECK(for_websockets_); | 66 DCHECK(for_websockets_); |
67 DCHECK(create_helper); | 67 DCHECK(create_helper); |
68 return RequestStreamInternal(request_info, priority, server_ssl_config, | 68 return RequestStreamInternal(request_info, priority, server_ssl_config, |
69 proxy_ssl_config, delegate, create_helper, | 69 proxy_ssl_config, delegate, create_helper, |
70 HttpStreamRequest::HTTP_STREAM, net_log); | 70 HttpStreamRequest::HTTP_STREAM, net_log); |
71 } | 71 } |
72 | 72 |
73 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamJob( | 73 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( |
74 const HttpRequestInfo& request_info, | 74 const HttpRequestInfo& request_info, |
75 RequestPriority priority, | 75 RequestPriority priority, |
76 const SSLConfig& server_ssl_config, | 76 const SSLConfig& server_ssl_config, |
77 const SSLConfig& proxy_ssl_config, | 77 const SSLConfig& proxy_ssl_config, |
78 HttpStreamRequest::Delegate* delegate, | 78 HttpStreamRequest::Delegate* delegate, |
79 const BoundNetLog& net_log) { | 79 const BoundNetLog& net_log) { |
80 DCHECK(!for_websockets_); | 80 DCHECK(!for_websockets_); |
81 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); | 81 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); |
82 | 82 |
83 return RequestStreamInternal( | 83 return RequestStreamInternal( |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (!ContainsKey(spdy_session_request_map_, spdy_session_key)) | 313 if (!ContainsKey(spdy_session_request_map_, spdy_session_key)) |
314 break; | 314 break; |
315 Request* request = *spdy_session_request_map_[spdy_session_key].begin(); | 315 Request* request = *spdy_session_request_map_[spdy_session_key].begin(); |
316 request->Complete(was_npn_negotiated, protocol_negotiated, using_spdy); | 316 request->Complete(was_npn_negotiated, protocol_negotiated, using_spdy); |
317 if (for_websockets_) { | 317 if (for_websockets_) { |
318 // TODO(ricea): Restore this code path when WebSocket over SPDY | 318 // TODO(ricea): Restore this code path when WebSocket over SPDY |
319 // implementation is ready. | 319 // implementation is ready. |
320 NOTREACHED(); | 320 NOTREACHED(); |
321 } else if (request->stream_type() == | 321 } else if (request->stream_type() == |
322 HttpStreamRequest::BIDIRECTIONAL_STREAM) { | 322 HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
323 request->OnBidirectionalStreamJobReady( | 323 request->OnBidirectionalStreamImplReady( |
324 nullptr, used_ssl_config, used_proxy_info, | 324 nullptr, used_ssl_config, used_proxy_info, |
325 new BidirectionalStreamSpdyJob(spdy_session)); | 325 new BidirectionalStreamSpdyImpl(spdy_session)); |
326 } else { | 326 } else { |
327 bool use_relative_url = direct || request->url().SchemeIs("https"); | 327 bool use_relative_url = direct || request->url().SchemeIs("https"); |
328 request->OnStreamReady( | 328 request->OnStreamReady( |
329 nullptr, used_ssl_config, used_proxy_info, | 329 nullptr, used_ssl_config, used_proxy_info, |
330 new SpdyHttpStream(spdy_session, use_relative_url)); | 330 new SpdyHttpStream(spdy_session, use_relative_url)); |
331 } | 331 } |
332 } | 332 } |
333 // TODO(mbelshe): Alert other valid requests. | 333 // TODO(mbelshe): Alert other valid requests. |
334 } | 334 } |
335 | 335 |
(...skipping 22 matching lines...) Expand all Loading... |
358 return true; | 358 return true; |
359 | 359 |
360 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) | 360 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) |
361 return true; | 361 return true; |
362 | 362 |
363 return ContainsKey(session_->params().quic_host_whitelist, | 363 return ContainsKey(session_->params().quic_host_whitelist, |
364 base::ToLowerASCII(host)); | 364 base::ToLowerASCII(host)); |
365 } | 365 } |
366 | 366 |
367 } // namespace net | 367 } // namespace net |
OLD | NEW |