| 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 TransportSecurityState* transport_security_state, | 635 TransportSecurityState* transport_security_state, |
| 634 bool verify_domain_authentication, | 636 bool verify_domain_authentication, |
| 635 bool enable_sending_initial_data, | 637 bool enable_sending_initial_data, |
| 636 bool enable_compression, | 638 bool enable_compression, |
| 637 bool enable_ping_based_connection_checking, | 639 bool enable_ping_based_connection_checking, |
| 638 NextProto default_protocol, | 640 NextProto default_protocol, |
| 639 size_t session_max_recv_window_size, | 641 size_t session_max_recv_window_size, |
| 640 size_t stream_max_recv_window_size, | 642 size_t stream_max_recv_window_size, |
| 641 size_t initial_max_concurrent_streams, | 643 size_t initial_max_concurrent_streams, |
| 642 TimeFunc time_func, | 644 TimeFunc time_func, |
| 643 const HostPortPair& trusted_spdy_proxy, | 645 const base::WeakPtr<TrustedSpdyProxyProvider>& trusted_spdy_proxy_provider, |
| 644 NetLog* net_log) | 646 NetLog* net_log) |
| 645 : in_io_loop_(false), | 647 : in_io_loop_(false), |
| 646 spdy_session_key_(spdy_session_key), | 648 spdy_session_key_(spdy_session_key), |
| 647 pool_(NULL), | 649 pool_(NULL), |
| 648 http_server_properties_(http_server_properties), | 650 http_server_properties_(http_server_properties), |
| 649 transport_security_state_(transport_security_state), | 651 transport_security_state_(transport_security_state), |
| 650 read_buffer_(new IOBuffer(kReadBufferSize)), | 652 read_buffer_(new IOBuffer(kReadBufferSize)), |
| 651 stream_hi_water_mark_(kFirstStreamId), | 653 stream_hi_water_mark_(kFirstStreamId), |
| 652 last_accepted_push_stream_id_(0), | 654 last_accepted_push_stream_id_(0), |
| 653 num_pushed_streams_(0u), | 655 num_pushed_streams_(0u), |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP2_SESSION)), | 691 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HTTP2_SESSION)), |
| 690 verify_domain_authentication_(verify_domain_authentication), | 692 verify_domain_authentication_(verify_domain_authentication), |
| 691 enable_sending_initial_data_(enable_sending_initial_data), | 693 enable_sending_initial_data_(enable_sending_initial_data), |
| 692 enable_compression_(enable_compression), | 694 enable_compression_(enable_compression), |
| 693 enable_ping_based_connection_checking_( | 695 enable_ping_based_connection_checking_( |
| 694 enable_ping_based_connection_checking), | 696 enable_ping_based_connection_checking), |
| 695 protocol_(default_protocol), | 697 protocol_(default_protocol), |
| 696 connection_at_risk_of_loss_time_( | 698 connection_at_risk_of_loss_time_( |
| 697 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), | 699 base::TimeDelta::FromSeconds(kDefaultConnectionAtRiskOfLossSeconds)), |
| 698 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), | 700 hung_interval_(base::TimeDelta::FromSeconds(kHungIntervalSeconds)), |
| 699 trusted_spdy_proxy_(trusted_spdy_proxy), | |
| 700 time_func_(time_func), | 701 time_func_(time_func), |
| 701 send_priority_dependency_(priority_dependency_enabled_default), | 702 send_priority_dependency_(priority_dependency_enabled_default), |
| 702 weak_factory_(this) { | 703 weak_factory_(this) { |
| 703 DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); | 704 DCHECK_GE(protocol_, kProtoSPDYMinimumVersion); |
| 704 DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); | 705 DCHECK_LE(protocol_, kProtoSPDYMaximumVersion); |
| 705 DCHECK(HttpStreamFactory::spdy_enabled()); | 706 DCHECK(HttpStreamFactory::spdy_enabled()); |
| 706 net_log_.BeginEvent( | 707 net_log_.BeginEvent( |
| 707 NetLog::TYPE_HTTP2_SESSION, | 708 NetLog::TYPE_HTTP2_SESSION, |
| 708 base::Bind(&NetLogSpdySessionCallback, &host_port_proxy_pair())); | 709 base::Bind(&NetLogSpdySessionCallback, &host_port_proxy_pair())); |
| 709 next_unclaimed_push_stream_sweep_time_ = time_func_() + | 710 next_unclaimed_push_stream_sweep_time_ = time_func_() + |
| 710 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); | 711 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); |
| 711 if (base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial) == | 712 if (base::FieldTrialList::FindFullName(kSpdyDependenciesFieldTrial) == |
| 712 kSpdyDepencenciesFieldTrialEnable) { | 713 kSpdyDepencenciesFieldTrialEnable) { |
| 713 send_priority_dependency_ = true; | 714 send_priority_dependency_ = true; |
| 714 } | 715 } |
| 716 if (trusted_spdy_proxy_provider) { |
| 717 net::ProxyServer trusted_spdy_proxy; |
| 718 trusted_spdy_proxy_provider->GetTrustedSpdyProxy(&trusted_spdy_proxy); |
| 719 if (trusted_spdy_proxy.is_valid()) { |
| 720 DCHECK(trusted_spdy_proxy.is_https()); |
| 721 trusted_spdy_proxy_ = trusted_spdy_proxy.host_port_pair(); |
| 722 } |
| 723 } |
| 715 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. | 724 // TODO(mbelshe): consider randomization of the stream_hi_water_mark. |
| 716 } | 725 } |
| 717 | 726 |
| 718 SpdySession::~SpdySession() { | 727 SpdySession::~SpdySession() { |
| 719 CHECK(!in_io_loop_); | 728 CHECK(!in_io_loop_); |
| 720 DcheckDraining(); | 729 DcheckDraining(); |
| 721 | 730 |
| 722 // TODO(akalin): Check connection->is_initialized() instead. This | 731 // TODO(akalin): Check connection->is_initialized() instead. This |
| 723 // requires re-working CreateFakeSpdySession(), though. | 732 // requires re-working CreateFakeSpdySession(), though. |
| 724 DCHECK(connection_->socket()); | 733 DCHECK(connection_->socket()); |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3330 if (!queue->empty()) { | 3339 if (!queue->empty()) { |
| 3331 SpdyStreamId stream_id = queue->front(); | 3340 SpdyStreamId stream_id = queue->front(); |
| 3332 queue->pop_front(); | 3341 queue->pop_front(); |
| 3333 return stream_id; | 3342 return stream_id; |
| 3334 } | 3343 } |
| 3335 } | 3344 } |
| 3336 return 0; | 3345 return 0; |
| 3337 } | 3346 } |
| 3338 | 3347 |
| 3339 } // namespace net | 3348 } // namespace net |
| OLD | NEW |