Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: net/quic/core/quic_crypto_client_stream.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: correct quic_client_bin.cc Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/core/quic_crypto_client_stream.h" 5 #include "net/quic/core/quic_crypto_client_stream.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/metrics/sparse_histogram.h" 11 #include "base/metrics/sparse_histogram.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "net/quic/core/crypto/crypto_protocol.h" 13 #include "net/quic/core/crypto/crypto_protocol.h"
14 #include "net/quic/core/crypto/crypto_utils.h" 14 #include "net/quic/core/crypto/crypto_utils.h"
15 #include "net/quic/core/crypto/null_encrypter.h" 15 #include "net/quic/core/crypto/null_encrypter.h"
16 #include "net/quic/core/quic_flags.h" 16 #include "net/quic/core/quic_flags.h"
17 #include "net/quic/core/quic_packets.h" 17 #include "net/quic/core/quic_packets.h"
18 #include "net/quic/core/quic_session.h" 18 #include "net/quic/core/quic_session.h"
19 #include "net/quic/core/quic_utils.h" 19 #include "net/quic/core/quic_utils.h"
20 20
21 using std::string; 21 using std::string;
22 22
23 namespace net { 23 namespace net {
24 24
25 const int QuicCryptoClientStream::kMaxClientHellos;
26
25 QuicCryptoClientStreamBase::QuicCryptoClientStreamBase(QuicSession* session) 27 QuicCryptoClientStreamBase::QuicCryptoClientStreamBase(QuicSession* session)
26 : QuicCryptoStream(session) {} 28 : QuicCryptoStream(session) {}
27 29
28 QuicCryptoClientStream::ChannelIDSourceCallbackImpl:: 30 QuicCryptoClientStream::ChannelIDSourceCallbackImpl::
29 ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream) 31 ChannelIDSourceCallbackImpl(QuicCryptoClientStream* stream)
30 : stream_(stream) {} 32 : stream_(stream) {}
31 33
32 QuicCryptoClientStream::ChannelIDSourceCallbackImpl:: 34 QuicCryptoClientStream::ChannelIDSourceCallbackImpl::
33 ~ChannelIDSourceCallbackImpl() {} 35 ~ChannelIDSourceCallbackImpl() {}
34 36
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 272 }
271 return; 273 return;
272 } 274 }
273 275
274 // Send the client hello in plaintext. 276 // Send the client hello in plaintext.
275 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_NONE); 277 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_NONE);
276 encryption_established_ = false; 278 encryption_established_ = false;
277 if (num_client_hellos_ > kMaxClientHellos) { 279 if (num_client_hellos_ > kMaxClientHellos) {
278 CloseConnectionWithDetails( 280 CloseConnectionWithDetails(
279 QUIC_CRYPTO_TOO_MANY_REJECTS, 281 QUIC_CRYPTO_TOO_MANY_REJECTS,
280 base::StringPrintf("More than %u rejects", kMaxClientHellos).c_str()); 282 QuicStrCat("More than ", kMaxClientHellos, " rejects"));
281 return; 283 return;
282 } 284 }
283 num_client_hellos_++; 285 num_client_hellos_++;
284 286
285 CryptoHandshakeMessage out; 287 CryptoHandshakeMessage out;
286 DCHECK(session() != nullptr); 288 DCHECK(session() != nullptr);
287 DCHECK(session()->config() != nullptr); 289 DCHECK(session()->config() != nullptr);
288 // Send all the options, regardless of whether we're sending an 290 // Send all the options, regardless of whether we're sending an
289 // inchoate or subsequent hello. 291 // inchoate or subsequent hello.
290 session()->config()->ToHandshakeMessage(&out); 292 session()->config()->ToHandshakeMessage(&out);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 669 }
668 for (size_t i = 0; i < num_their_proof_demands; i++) { 670 for (size_t i = 0; i < num_their_proof_demands; i++) {
669 if (their_proof_demands[i] == kCHID) { 671 if (their_proof_demands[i] == kCHID) {
670 return true; 672 return true;
671 } 673 }
672 } 674 }
673 return false; 675 return false;
674 } 676 }
675 677
676 } // namespace net 678 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698