| 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 <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 25 #include "base/strings/utf_string_conversions.h" |
| 26 #include "base/thread_task_runner_handle.h" | 26 #include "base/thread_task_runner_handle.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "base/values.h" | 28 #include "base/values.h" |
| 29 #include "crypto/ec_private_key.h" | 29 #include "crypto/ec_private_key.h" |
| 30 #include "crypto/ec_signature_creator.h" | 30 #include "crypto/ec_signature_creator.h" |
| 31 #include "net/base/connection_type_histograms.h" | 31 #include "net/base/connection_type_histograms.h" |
| 32 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
| 33 #include "net/base/trusted_spdy_proxy_provider.h" |
| 33 #include "net/cert/asn1_util.h" | 34 #include "net/cert/asn1_util.h" |
| 34 #include "net/cert/cert_verify_result.h" | 35 #include "net/cert/cert_verify_result.h" |
| 35 #include "net/http/http_log_util.h" | 36 #include "net/http/http_log_util.h" |
| 36 #include "net/http/http_network_session.h" | 37 #include "net/http/http_network_session.h" |
| 37 #include "net/http/http_server_properties.h" | 38 #include "net/http/http_server_properties.h" |
| 38 #include "net/http/http_util.h" | 39 #include "net/http/http_util.h" |
| 39 #include "net/http/transport_security_state.h" | 40 #include "net/http/transport_security_state.h" |
| 40 #include "net/log/net_log.h" | 41 #include "net/log/net_log.h" |
| 42 #include "net/proxy/proxy_server.h" |
| 41 #include "net/socket/ssl_client_socket.h" | 43 #include "net/socket/ssl_client_socket.h" |
| 42 #include "net/spdy/spdy_buffer_producer.h" | 44 #include "net/spdy/spdy_buffer_producer.h" |
| 43 #include "net/spdy/spdy_frame_builder.h" | 45 #include "net/spdy/spdy_frame_builder.h" |
| 44 #include "net/spdy/spdy_http_utils.h" | 46 #include "net/spdy/spdy_http_utils.h" |
| 45 #include "net/spdy/spdy_protocol.h" | 47 #include "net/spdy/spdy_protocol.h" |
| 46 #include "net/spdy/spdy_session_pool.h" | 48 #include "net/spdy/spdy_session_pool.h" |
| 47 #include "net/spdy/spdy_stream.h" | 49 #include "net/spdy/spdy_stream.h" |
| 48 #include "net/ssl/channel_id_service.h" | 50 #include "net/ssl/channel_id_service.h" |
| 49 #include "net/ssl/ssl_cipher_suite_names.h" | 51 #include "net/ssl/ssl_cipher_suite_names.h" |
| 50 #include "net/ssl/ssl_connection_status_flags.h" | 52 #include "net/ssl/ssl_connection_status_flags.h" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 TransportSecurityState* transport_security_state, | 631 TransportSecurityState* transport_security_state, |
| 630 bool verify_domain_authentication, | 632 bool verify_domain_authentication, |
| 631 bool enable_sending_initial_data, | 633 bool enable_sending_initial_data, |
| 632 bool enable_compression, | 634 bool enable_compression, |
| 633 bool enable_ping_based_connection_checking, | 635 bool enable_ping_based_connection_checking, |
| 634 NextProto default_protocol, | 636 NextProto default_protocol, |
| 635 size_t session_max_recv_window_size, | 637 size_t session_max_recv_window_size, |
| 636 size_t stream_max_recv_window_size, | 638 size_t stream_max_recv_window_size, |
| 637 size_t initial_max_concurrent_streams, | 639 size_t initial_max_concurrent_streams, |
| 638 TimeFunc time_func, | 640 TimeFunc time_func, |
| 639 const HostPortPair& trusted_spdy_proxy, | 641 const base::WeakPtr<TrustedSpdyProxyProvider>& trusted_spdy_proxy_provider, |
| 640 NetLog* net_log) | 642 NetLog* net_log) |
| 641 : in_io_loop_(false), | 643 : in_io_loop_(false), |
| 642 spdy_session_key_(spdy_session_key), | 644 spdy_session_key_(spdy_session_key), |
| 643 pool_(NULL), | 645 pool_(NULL), |
| 644 http_server_properties_(http_server_properties), | 646 http_server_properties_(http_server_properties), |
| 645 transport_security_state_(transport_security_state), | 647 transport_security_state_(transport_security_state), |
| 646 read_buffer_(new IOBuffer(kReadBufferSize)), | 648 read_buffer_(new IOBuffer(kReadBufferSize)), |
| 647 stream_hi_water_mark_(kFirstStreamId), | 649 stream_hi_water_mark_(kFirstStreamId), |
| 648 last_accepted_push_stream_id_(0), | 650 last_accepted_push_stream_id_(0), |
| 649 num_pushed_streams_(0u), | 651 num_pushed_streams_(0u), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP2_SESSION)), | 687 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP2_SESSION)), |
| 686 verify_domain_authentication_(verify_domain_authentication), | 688 verify_domain_authentication_(verify_domain_authentication), |
| 687 enable_sending_initial_data_(enable_sending_initial_data), | 689 enable_sending_initial_data_(enable_sending_initial_data), |
| 688 enable_compression_(enable_compression), | 690 enable_compression_(enable_compression), |
| 689 enable_ping_based_connection_checking_( | 691 enable_ping_based_connection_checking_( |
| 690 enable_ping_based_connection_checking), | 692 enable_ping_based_connection_checking), |
| 691 protocol_(default_protocol), | 693 protocol_(default_protocol), |
| 692 connection_at_risk_of_loss_time_( | 694 connection_at_risk_of_loss_time_( |
| 693 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), | 695 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), |
| 694 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), | 696 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), |
| 695 trusted_spdy_proxy_(trusted_spdy_proxy), | |
| 696 time_func_(time_func), | 697 time_func_(time_func), |
| 697 send_priority_dependency_(priority_dependency_enabled_default), | 698 send_priority_dependency_(priority_dependency_enabled_default), |
| 698 weak_factory_(this) { | 699 weak_factory_(this) { |
| 699 DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); | 700 DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); |
| 700 DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); | 701 DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); |
| 701 DCHECK(HttpStreamFactory::spdy_enabled()); | 702 DCHECK(HttpStreamFactory::spdy_enabled()); |
| 702 net_log_.BeginEvent( | 703 net_log_.BeginEvent( |
| 703 NetLog::TYPE_HTTP2_SESSION, | 704 NetLog::TYPE_HTTP2_SESSION, |
| 704 base::Bind(&NetLogSpdySessionCallback, &host_port_proxy_pair())); | 705 base::Bind(&NetLogSpdySessionCallback, &host_port_proxy_pair())); |
| 705 next_unclaimed_push_stream_sweep_time_ = time_func_() + | 706 next_unclaimed_push_stream_sweep_time_ = time_func_() + |
| 706 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); | 707 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); |
| 707 if (base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial) == | 708 if (base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial) == |
| 708 kSpdyDepencenciesFieldTrialEnable) { | 709 kSpdyDepencenciesFieldTrialEnable) { |
| 709 send_priority_dependency_ = true; | 710 send_priority_dependency_ = true; |
| 710 } | 711 } |
| 712 if (trusted_spdy_proxy_provider) { |
| 713 net::ProxyServer trusted_spdy_proxy; |
| 714 trusted_spdy_proxy_provider->GetTrustedSpdyProxy(&trusted_spdy_proxy); |
| 715 if (trusted_spdy_proxy.is_valid()) { |
| 716 DCHECK(trusted_spdy_proxy.is_https() || trusted_spdy_proxy.is_quic()); |
| 717 trusted_spdy_proxy_ = trusted_spdy_proxy.host_port_pair(); |
| 718 } |
| 719 } |
| 711 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. | 720 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. |
| 712 } | 721 } |
| 713 | 722 |
| 714 SpdySession::~SpdySession() { | 723 SpdySession::~SpdySession() { |
| 715 CHECK(!in_io_loop_); | 724 CHECK(!in_io_loop_); |
| 716 DcheckDraining(); | 725 DcheckDraining(); |
| 717 | 726 |
| 718 // TODO(akalin): Check connection->is_initialized() instead. This | 727 // TODO(akalin): Check connection->is_initialized() instead. This |
| 719 // requires re-working CreateFakeSpdySession(), though. | 728 // requires re-working CreateFakeSpdySession(), though. |
| 720 DCHECK(connection_->socket()); | 729 DCHECK(connection_->socket()); |
| (...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3321 if (!queue->empty()) { | 3330 if (!queue->empty()) { |
| 3322 SpdyStreamId stream_id = queue->front(); | 3331 SpdyStreamId stream_id = queue->front(); |
| 3323 queue->pop_front(); | 3332 queue->pop_front(); |
| 3324 return stream_id; | 3333 return stream_id; |
| 3325 } | 3334 } |
| 3326 } | 3335 } |
| 3327 return 0; | 3336 return 0; |
| 3328 } | 3337 } |
| 3329 | 3338 |
| 3330 } // namespace net | 3339 } // namespace net |
| OLD | NEW |