| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tools/flip_server/sm_connection.h" | 5 #include "net/tools/flip_server/sm_connection.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <netinet/tcp.h> | 8 #include <netinet/tcp.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // If this is an SSL connection, check if NPN specifies SPDY. | 312 // If this is an SSL connection, check if NPN specifies SPDY. |
| 313 if (ssl_) { | 313 if (ssl_) { |
| 314 const unsigned char* npn_proto; | 314 const unsigned char* npn_proto; |
| 315 unsigned int npn_proto_len; | 315 unsigned int npn_proto_len; |
| 316 SSL_get0_next_proto_negotiated(ssl_, &npn_proto, &npn_proto_len); | 316 SSL_get0_next_proto_negotiated(ssl_, &npn_proto, &npn_proto_len); |
| 317 if (npn_proto_len > 0) { | 317 if (npn_proto_len > 0) { |
| 318 std::string npn_proto_str((const char*)npn_proto, npn_proto_len); | 318 std::string npn_proto_str((const char*)npn_proto, npn_proto_len); |
| 319 VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT | 319 VLOG(1) << log_prefix_ << ACCEPTOR_CLIENT_IDENT |
| 320 << "NPN protocol detected: " << npn_proto_str; | 320 << "NPN protocol detected: " << npn_proto_str; |
| 321 if (!strncmp(reinterpret_cast<const char*>(npn_proto), | 321 if (!strncmp(reinterpret_cast<const char*>(npn_proto), |
| 322 "spdy/2", | |
| 323 npn_proto_len)) { | |
| 324 *version_negotiated = SPDY2; | |
| 325 return true; | |
| 326 } | |
| 327 if (!strncmp(reinterpret_cast<const char*>(npn_proto), | |
| 328 "spdy/3", | 322 "spdy/3", |
| 329 npn_proto_len)) { | 323 npn_proto_len)) { |
| 330 *version_negotiated = SPDY3; | 324 *version_negotiated = SPDY3; |
| 331 return true; | 325 return true; |
| 332 } | 326 } |
| 333 if (!strncmp(reinterpret_cast<const char*>(npn_proto), | 327 if (!strncmp(reinterpret_cast<const char*>(npn_proto), |
| 334 "spdy/4a2", | 328 "spdy/4a2", |
| 335 npn_proto_len)) { | 329 npn_proto_len)) { |
| 336 *version_negotiated = HTTP2; | 330 *version_negotiated = HTTP2; |
| 337 return true; | 331 return true; |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 SMConnection* SMConnection::NewSMConnection(EpollServer* epoll_server, | 652 SMConnection* SMConnection::NewSMConnection(EpollServer* epoll_server, |
| 659 SSLState* ssl_state, | 653 SSLState* ssl_state, |
| 660 MemoryCache* memory_cache, | 654 MemoryCache* memory_cache, |
| 661 FlipAcceptor* acceptor, | 655 FlipAcceptor* acceptor, |
| 662 std::string log_prefix) { | 656 std::string log_prefix) { |
| 663 return new SMConnection( | 657 return new SMConnection( |
| 664 epoll_server, ssl_state, memory_cache, acceptor, log_prefix); | 658 epoll_server, ssl_state, memory_cache, acceptor, log_prefix); |
| 665 } | 659 } |
| 666 | 660 |
| 667 } // namespace net | 661 } // namespace net |
| OLD | NEW |