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

Side by Side Diff: net/tools/quic/chlo_extractor.cc

Issue 2391103003: Landing Recent QUIC changes until 3:24 PM, Oct 01, 2016 UTC-4 (Closed)
Patch Set: Add new error code to quic_error_mapping.cc Created 4 years, 2 months 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
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_client_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/quic/chlo_extractor.h" 5 #include "net/tools/quic/chlo_extractor.h"
6 6
7 #include "base/strings/string_util.h"
7 #include "net/quic/core/crypto/crypto_framer.h" 8 #include "net/quic/core/crypto/crypto_framer.h"
8 #include "net/quic/core/crypto/crypto_handshake_message.h" 9 #include "net/quic/core/crypto/crypto_handshake_message.h"
9 #include "net/quic/core/crypto/crypto_protocol.h" 10 #include "net/quic/core/crypto/crypto_protocol.h"
10 #include "net/quic/core/crypto/quic_decrypter.h" 11 #include "net/quic/core/crypto/quic_decrypter.h"
11 #include "net/quic/core/crypto/quic_encrypter.h" 12 #include "net/quic/core/crypto/quic_encrypter.h"
12 #include "net/quic/core/quic_framer.h" 13 #include "net/quic/core/quic_framer.h"
13 14
14 using base::StringPiece; 15 using base::StringPiece;
15 16
16 namespace net { 17 namespace net {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 bool ChloFramerVisitor::OnUnauthenticatedHeader( 86 bool ChloFramerVisitor::OnUnauthenticatedHeader(
86 const QuicPacketHeader& header) { 87 const QuicPacketHeader& header) {
87 return true; 88 return true;
88 } 89 }
89 bool ChloFramerVisitor::OnPacketHeader(const QuicPacketHeader& header) { 90 bool ChloFramerVisitor::OnPacketHeader(const QuicPacketHeader& header) {
90 return true; 91 return true;
91 } 92 }
92 bool ChloFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) { 93 bool ChloFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) {
93 StringPiece data(frame.data_buffer, frame.data_length); 94 StringPiece data(frame.data_buffer, frame.data_length);
94 if (frame.stream_id == kCryptoStreamId && frame.offset == 0 && 95 if (frame.stream_id == kCryptoStreamId && frame.offset == 0 &&
95 data.starts_with("CHLO")) { 96 base::StartsWith(data, "CHLO", base::CompareCase::INSENSITIVE_ASCII)) {
96 CryptoFramer crypto_framer; 97 CryptoFramer crypto_framer;
97 crypto_framer.set_visitor(this); 98 crypto_framer.set_visitor(this);
98 if (!crypto_framer.ProcessInput(data)) { 99 if (!crypto_framer.ProcessInput(data)) {
99 return false; 100 return false;
100 } 101 }
101 } 102 }
102 return true; 103 return true;
103 } 104 }
104 105
105 bool ChloFramerVisitor::OnAckFrame(const QuicAckFrame& frame) { 106 bool ChloFramerVisitor::OnAckFrame(const QuicAckFrame& frame) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER); 164 QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER);
164 ChloFramerVisitor visitor(&framer, delegate); 165 ChloFramerVisitor visitor(&framer, delegate);
165 framer.set_visitor(&visitor); 166 framer.set_visitor(&visitor);
166 if (!framer.ProcessPacket(packet)) { 167 if (!framer.ProcessPacket(packet)) {
167 return false; 168 return false;
168 } 169 }
169 return visitor.found_chlo(); 170 return visitor.found_chlo();
170 } 171 }
171 172
172 } // namespace net 173 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/quic_client_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698