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 29 matching lines...) Expand all Loading... |
40 #include "net/socket/ssl_client_socket.h" | 40 #include "net/socket/ssl_client_socket.h" |
41 #include "net/spdy/spdy_buffer_producer.h" | 41 #include "net/spdy/spdy_buffer_producer.h" |
42 #include "net/spdy/spdy_frame_builder.h" | 42 #include "net/spdy/spdy_frame_builder.h" |
43 #include "net/spdy/spdy_http_utils.h" | 43 #include "net/spdy/spdy_http_utils.h" |
44 #include "net/spdy/spdy_protocol.h" | 44 #include "net/spdy/spdy_protocol.h" |
45 #include "net/spdy/spdy_session_pool.h" | 45 #include "net/spdy/spdy_session_pool.h" |
46 #include "net/spdy/spdy_stream.h" | 46 #include "net/spdy/spdy_stream.h" |
47 #include "net/ssl/channel_id_service.h" | 47 #include "net/ssl/channel_id_service.h" |
48 #include "net/ssl/ssl_cipher_suite_names.h" | 48 #include "net/ssl/ssl_cipher_suite_names.h" |
49 #include "net/ssl/ssl_connection_status_flags.h" | 49 #include "net/ssl/ssl_connection_status_flags.h" |
| 50 #include "net/ssl/token_binding.h" |
50 | 51 |
51 namespace net { | 52 namespace net { |
52 | 53 |
53 namespace { | 54 namespace { |
54 | 55 |
55 const int kReadBufferSize = 8 * 1024; | 56 const int kReadBufferSize = 8 * 1024; |
56 const int kDefaultConnectionAtRiskOfLossSeconds = 10; | 57 const int kDefaultConnectionAtRiskOfLossSeconds = 10; |
57 const int kHungIntervalSeconds = 10; | 58 const int kHungIntervalSeconds = 10; |
58 | 59 |
59 // Minimum seconds that unclaimed pushed streams will be kept in memory. | 60 // Minimum seconds that unclaimed pushed streams will be kept in memory. |
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 } | 1995 } |
1995 | 1996 |
1996 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, | 1997 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, |
1997 bool* was_npn_negotiated, | 1998 bool* was_npn_negotiated, |
1998 NextProto* protocol_negotiated) { | 1999 NextProto* protocol_negotiated) { |
1999 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); | 2000 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); |
2000 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); | 2001 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); |
2001 return connection_->socket()->GetSSLInfo(ssl_info); | 2002 return connection_->socket()->GetSSLInfo(ssl_info); |
2002 } | 2003 } |
2003 | 2004 |
| 2005 int SpdySession::GetProvidedTokenBindingWithKey( |
| 2006 const scoped_ptr<crypto::ECPrivateKey>& key, |
| 2007 std::string* out) { |
| 2008 if (!is_secure_) { |
| 2009 NOTREACHED(); |
| 2010 return ERR_FAILED; |
| 2011 } |
| 2012 SSLClientSocket* ssl_socket = |
| 2013 static_cast<SSLClientSocket*>(connection_->socket()); |
| 2014 std::vector<uint8_t> signed_ekm; |
| 2015 if (ssl_socket->GetSignedEKMForTokenBinding(key.get(), &signed_ekm) != OK || |
| 2016 BuildProvidedTokenBinding(key.get(), signed_ekm, out) != OK) { |
| 2017 return ERR_FAILED; |
| 2018 } |
| 2019 return OK; |
| 2020 } |
| 2021 |
2004 void SpdySession::OnError(SpdyFramer::SpdyError error_code) { | 2022 void SpdySession::OnError(SpdyFramer::SpdyError error_code) { |
2005 CHECK(in_io_loop_); | 2023 CHECK(in_io_loop_); |
2006 | 2024 |
2007 RecordProtocolErrorHistogram(MapFramerErrorToProtocolError(error_code)); | 2025 RecordProtocolErrorHistogram(MapFramerErrorToProtocolError(error_code)); |
2008 std::string description = | 2026 std::string description = |
2009 base::StringPrintf("Framer error: %d (%s).", | 2027 base::StringPrintf("Framer error: %d (%s).", |
2010 error_code, | 2028 error_code, |
2011 SpdyFramer::ErrorCodeToString(error_code)); | 2029 SpdyFramer::ErrorCodeToString(error_code)); |
2012 DoDrainSession(MapFramerErrorToNetError(error_code), description); | 2030 DoDrainSession(MapFramerErrorToNetError(error_code), description); |
2013 } | 2031 } |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3277 if (!queue->empty()) { | 3295 if (!queue->empty()) { |
3278 SpdyStreamId stream_id = queue->front(); | 3296 SpdyStreamId stream_id = queue->front(); |
3279 queue->pop_front(); | 3297 queue->pop_front(); |
3280 return stream_id; | 3298 return stream_id; |
3281 } | 3299 } |
3282 } | 3300 } |
3283 return 0; | 3301 return 0; |
3284 } | 3302 } |
3285 | 3303 |
3286 } // namespace net | 3304 } // namespace net |
OLD | NEW |