| 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/quic/quic_crypto_server_stream.h" |    5 #include "net/quic/quic_crypto_server_stream.h" | 
|    6  |    6  | 
 |    7 #include <memory> | 
 |    8  | 
|    7 #include "base/base64.h" |    9 #include "base/base64.h" | 
|    8 #include "crypto/secure_hash.h" |   10 #include "crypto/secure_hash.h" | 
|    9 #include "net/quic/crypto/crypto_protocol.h" |   11 #include "net/quic/crypto/crypto_protocol.h" | 
|   10 #include "net/quic/crypto/crypto_utils.h" |   12 #include "net/quic/crypto/crypto_utils.h" | 
|   11 #include "net/quic/crypto/quic_crypto_server_config.h" |   13 #include "net/quic/crypto/quic_crypto_server_config.h" | 
|   12 #include "net/quic/crypto/quic_random.h" |   14 #include "net/quic/crypto/quic_random.h" | 
|   13 #include "net/quic/proto/cached_network_parameters.pb.h" |   15 #include "net/quic/proto/cached_network_parameters.pb.h" | 
|   14 #include "net/quic/quic_config.h" |   16 #include "net/quic/quic_config.h" | 
|   15 #include "net/quic/quic_flags.h" |   17 #include "net/quic/quic_flags.h" | 
|   16 #include "net/quic/quic_protocol.h" |   18 #include "net/quic/quic_protocol.h" | 
|   17 #include "net/quic/quic_session.h" |   19 #include "net/quic/quic_session.h" | 
|   18  |   20  | 
 |   21 using base::StringPiece; | 
|   19 using std::string; |   22 using std::string; | 
|   20  |   23  | 
|   21 namespace net { |   24 namespace net { | 
|   22  |   25  | 
|   23 namespace { |   26 namespace { | 
|   24 bool HasFixedTag(const CryptoHandshakeMessage& message) { |   27 bool HasFixedTag(const CryptoHandshakeMessage& message) { | 
|   25   const QuicTag* received_tags; |   28   const QuicTag* received_tags; | 
|   26   size_t received_tags_length; |   29   size_t received_tags_length; | 
|   27   QuicErrorCode error = |   30   QuicErrorCode error = | 
|   28       message.GetTaglist(kCOPT, &received_tags, &received_tags_length); |   31       message.GetTaglist(kCOPT, &received_tags, &received_tags_length); | 
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  229           session()->connection()->random_generator(), compressed_certs_cache_, |  232           session()->connection()->random_generator(), compressed_certs_cache_, | 
|  230           crypto_negotiated_params_, cached_network_params, |  233           crypto_negotiated_params_, cached_network_params, | 
|  231           &server_config_update_message)) { |  234           &server_config_update_message)) { | 
|  232     DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; |  235     DVLOG(1) << "Server: Failed to build server config update (SCUP)!"; | 
|  233     return; |  236     return; | 
|  234   } |  237   } | 
|  235  |  238  | 
|  236   DVLOG(1) << "Server: Sending server config update: " |  239   DVLOG(1) << "Server: Sending server config update: " | 
|  237            << server_config_update_message.DebugString(); |  240            << server_config_update_message.DebugString(); | 
|  238   const QuicData& data = server_config_update_message.GetSerialized(); |  241   const QuicData& data = server_config_update_message.GetSerialized(); | 
|  239   WriteOrBufferData(string(data.data(), data.length()), false, nullptr); |  242   WriteOrBufferData(StringPiece(data.data(), data.length()), false, nullptr); | 
|  240  |  243  | 
|  241   ++num_server_config_update_messages_sent_; |  244   ++num_server_config_update_messages_sent_; | 
|  242 } |  245 } | 
|  243  |  246  | 
|  244 void QuicCryptoServerStream::OnServerHelloAcked() { |  247 void QuicCryptoServerStream::OnServerHelloAcked() { | 
|  245   session()->connection()->OnHandshakeComplete(); |  248   session()->connection()->OnHandshakeComplete(); | 
|  246 } |  249 } | 
|  247  |  250  | 
|  248 uint8_t QuicCryptoServerStream::NumHandshakeMessages() const { |  251 uint8_t QuicCryptoServerStream::NumHandshakeMessages() const { | 
|  249   return num_handshake_messages_; |  252   return num_handshake_messages_; | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  380   } |  383   } | 
|  381   for (size_t i = 0; i < received_tags_length; ++i) { |  384   for (size_t i = 0; i < received_tags_length; ++i) { | 
|  382     if (received_tags[i] == kSREJ) { |  385     if (received_tags[i] == kSREJ) { | 
|  383       return true; |  386       return true; | 
|  384     } |  387     } | 
|  385   } |  388   } | 
|  386   return false; |  389   return false; | 
|  387 } |  390 } | 
|  388  |  391  | 
|  389 }  // namespace net |  392 }  // namespace net | 
| OLD | NEW |