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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "base/values.h" | 25 #include "base/values.h" |
26 #include "crypto/ec_private_key.h" | 26 #include "crypto/ec_private_key.h" |
27 #include "crypto/ec_signature_creator.h" | 27 #include "crypto/ec_signature_creator.h" |
28 #include "net/base/connection_type_histograms.h" | 28 #include "net/base/connection_type_histograms.h" |
29 #include "net/base/net_log.h" | 29 #include "net/base/net_log.h" |
30 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
31 #include "net/cert/asn1_util.h" | 31 #include "net/cert/asn1_util.h" |
| 32 #include "net/cert/cert_verify_result.h" |
32 #include "net/http/http_log_util.h" | 33 #include "net/http/http_log_util.h" |
33 #include "net/http/http_network_session.h" | 34 #include "net/http/http_network_session.h" |
34 #include "net/http/http_server_properties.h" | 35 #include "net/http/http_server_properties.h" |
35 #include "net/http/http_util.h" | 36 #include "net/http/http_util.h" |
| 37 #include "net/http/transport_security_state.h" |
36 #include "net/spdy/spdy_buffer_producer.h" | 38 #include "net/spdy/spdy_buffer_producer.h" |
37 #include "net/spdy/spdy_frame_builder.h" | 39 #include "net/spdy/spdy_frame_builder.h" |
38 #include "net/spdy/spdy_http_utils.h" | 40 #include "net/spdy/spdy_http_utils.h" |
39 #include "net/spdy/spdy_protocol.h" | 41 #include "net/spdy/spdy_protocol.h" |
40 #include "net/spdy/spdy_session_pool.h" | 42 #include "net/spdy/spdy_session_pool.h" |
41 #include "net/spdy/spdy_stream.h" | 43 #include "net/spdy/spdy_stream.h" |
42 #include "net/ssl/channel_id_service.h" | 44 #include "net/ssl/channel_id_service.h" |
43 #include "net/ssl/ssl_cipher_suite_names.h" | 45 #include "net/ssl/ssl_cipher_suite_names.h" |
44 #include "net/ssl/ssl_connection_status_flags.h" | 46 #include "net/ssl/ssl_connection_status_flags.h" |
45 | 47 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 SpdyStreamId stream_id, | 527 SpdyStreamId stream_id, |
526 base::TimeTicks creation_time) | 528 base::TimeTicks creation_time) |
527 : stream_id(stream_id), | 529 : stream_id(stream_id), |
528 creation_time(creation_time) {} | 530 creation_time(creation_time) {} |
529 | 531 |
530 SpdySession::PushedStreamInfo::~PushedStreamInfo() {} | 532 SpdySession::PushedStreamInfo::~PushedStreamInfo() {} |
531 | 533 |
532 SpdySession::SpdySession( | 534 SpdySession::SpdySession( |
533 const SpdySessionKey& spdy_session_key, | 535 const SpdySessionKey& spdy_session_key, |
534 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 536 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
| 537 TransportSecurityState* transport_security_state, |
535 bool verify_domain_authentication, | 538 bool verify_domain_authentication, |
536 bool enable_sending_initial_data, | 539 bool enable_sending_initial_data, |
537 bool enable_compression, | 540 bool enable_compression, |
538 bool enable_ping_based_connection_checking, | 541 bool enable_ping_based_connection_checking, |
539 NextProto default_protocol, | 542 NextProto default_protocol, |
540 size_t stream_initial_recv_window_size, | 543 size_t stream_initial_recv_window_size, |
541 size_t initial_max_concurrent_streams, | 544 size_t initial_max_concurrent_streams, |
542 size_t max_concurrent_streams_limit, | 545 size_t max_concurrent_streams_limit, |
543 TimeFunc time_func, | 546 TimeFunc time_func, |
544 const HostPortPair& trusted_spdy_proxy, | 547 const HostPortPair& trusted_spdy_proxy, |
545 NetLog* net_log) | 548 NetLog* net_log) |
546 : in_io_loop_(false), | 549 : in_io_loop_(false), |
547 spdy_session_key_(spdy_session_key), | 550 spdy_session_key_(spdy_session_key), |
548 pool_(NULL), | 551 pool_(NULL), |
549 http_server_properties_(http_server_properties), | 552 http_server_properties_(http_server_properties), |
| 553 transport_security_state_(transport_security_state), |
550 read_buffer_(new IOBuffer(kReadBufferSize)), | 554 read_buffer_(new IOBuffer(kReadBufferSize)), |
551 stream_hi_water_mark_(kFirstStreamId), | 555 stream_hi_water_mark_(kFirstStreamId), |
552 num_pushed_streams_(0u), | 556 num_pushed_streams_(0u), |
553 num_active_pushed_streams_(0u), | 557 num_active_pushed_streams_(0u), |
554 in_flight_write_frame_type_(DATA), | 558 in_flight_write_frame_type_(DATA), |
555 in_flight_write_frame_size_(0), | 559 in_flight_write_frame_size_(0), |
556 is_secure_(false), | 560 is_secure_(false), |
557 certificate_error_code_(OK), | 561 certificate_error_code_(OK), |
558 availability_state_(STATE_AVAILABLE), | 562 availability_state_(STATE_AVAILABLE), |
559 read_state_(READ_STATE_DO_READ), | 563 read_state_(READ_STATE_DO_READ), |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 711 |
708 if (availability_state_ == STATE_DRAINING) | 712 if (availability_state_ == STATE_DRAINING) |
709 return false; | 713 return false; |
710 | 714 |
711 SSLInfo ssl_info; | 715 SSLInfo ssl_info; |
712 bool was_npn_negotiated; | 716 bool was_npn_negotiated; |
713 NextProto protocol_negotiated = kProtoUnknown; | 717 NextProto protocol_negotiated = kProtoUnknown; |
714 if (!GetSSLInfo(&ssl_info, &was_npn_negotiated, &protocol_negotiated)) | 718 if (!GetSSLInfo(&ssl_info, &was_npn_negotiated, &protocol_negotiated)) |
715 return true; // This is not a secure session, so all domains are okay. | 719 return true; // This is not a secure session, so all domains are okay. |
716 | 720 |
717 // Disable pooling for secure sessions. | 721 return HttpUtil::CanPool(transport_security_state_, ssl_info, |
718 // TODO(rch): re-enable this. | 722 host_port_pair().host(), domain); |
719 return false; | |
720 #if 0 | |
721 bool unused = false; | |
722 return | |
723 !ssl_info.client_cert_sent && | |
724 (!ssl_info.channel_id_sent || | |
725 (ChannelIDService::GetDomainForHost(domain) == | |
726 ChannelIDService::GetDomainForHost(host_port_pair().host()))) && | |
727 ssl_info.cert->VerifyNameMatch(domain, &unused); | |
728 #endif | |
729 } | 723 } |
730 | 724 |
731 int SpdySession::GetPushStream( | 725 int SpdySession::GetPushStream( |
732 const GURL& url, | 726 const GURL& url, |
733 base::WeakPtr<SpdyStream>* stream, | 727 base::WeakPtr<SpdyStream>* stream, |
734 const BoundNetLog& stream_net_log) { | 728 const BoundNetLog& stream_net_log) { |
735 CHECK(!in_io_loop_); | 729 CHECK(!in_io_loop_); |
736 | 730 |
737 stream->reset(); | 731 stream->reset(); |
738 | 732 |
(...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 if (!queue->empty()) { | 3158 if (!queue->empty()) { |
3165 SpdyStreamId stream_id = queue->front(); | 3159 SpdyStreamId stream_id = queue->front(); |
3166 queue->pop_front(); | 3160 queue->pop_front(); |
3167 return stream_id; | 3161 return stream_id; |
3168 } | 3162 } |
3169 } | 3163 } |
3170 return 0; | 3164 return 0; |
3171 } | 3165 } |
3172 | 3166 |
3173 } // namespace net | 3167 } // namespace net |
OLD | NEW |