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

Side by Side Diff: net/quic/quic_framer.cc

Issue 1908103002: Landing Recent QUIC changes until 4/15/2016 17:20 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 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/quic_flow_controller_test.cc ('k') | net/quic/quic_header_list.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) 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_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include <stdint.h> 7 #include <cstdint>
8 #include <memory>
8 9
9 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/stl_util.h" 12 #include "base/stl_util.h"
12 #include "net/quic/crypto/crypto_framer.h" 13 #include "net/quic/crypto/crypto_framer.h"
13 #include "net/quic/crypto/crypto_handshake_message.h" 14 #include "net/quic/crypto/crypto_handshake_message.h"
14 #include "net/quic/crypto/crypto_protocol.h" 15 #include "net/quic/crypto/crypto_protocol.h"
15 #include "net/quic/crypto/quic_decrypter.h" 16 #include "net/quic/crypto/quic_decrypter.h"
16 #include "net/quic/crypto/quic_encrypter.h" 17 #include "net/quic/crypto/quic_encrypter.h"
17 #include "net/quic/quic_bug_tracker.h" 18 #include "net/quic/quic_bug_tracker.h"
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 return false; 1488 return false;
1488 } 1489 }
1489 1490
1490 uint32_t error_code; 1491 uint32_t error_code;
1491 if (!reader->ReadUInt32(&error_code)) { 1492 if (!reader->ReadUInt32(&error_code)) {
1492 set_detailed_error("Unable to read rst stream error code."); 1493 set_detailed_error("Unable to read rst stream error code.");
1493 return false; 1494 return false;
1494 } 1495 }
1495 1496
1496 if (error_code >= QUIC_STREAM_LAST_ERROR) { 1497 if (error_code >= QUIC_STREAM_LAST_ERROR) {
1497 set_detailed_error("Invalid rst stream error code."); 1498 if (FLAGS_quic_ignore_invalid_error_code) {
1498 return false; 1499 // Ignore invalid stream error code if any.
1500 error_code = QUIC_STREAM_LAST_ERROR;
1501 } else {
1502 set_detailed_error("Invalid rst stream error code.");
1503 return false;
1504 }
1499 } 1505 }
1500 1506
1501 frame->error_code = static_cast<QuicRstStreamErrorCode>(error_code); 1507 frame->error_code = static_cast<QuicRstStreamErrorCode>(error_code);
1502 return true; 1508 return true;
1503 } 1509 }
1504 1510
1505 bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader, 1511 bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader,
1506 QuicConnectionCloseFrame* frame) { 1512 QuicConnectionCloseFrame* frame) {
1507 uint32_t error_code; 1513 uint32_t error_code;
1508 if (!reader->ReadUInt32(&error_code)) { 1514 if (!reader->ReadUInt32(&error_code)) {
1509 set_detailed_error("Unable to read connection close error code."); 1515 set_detailed_error("Unable to read connection close error code.");
1510 return false; 1516 return false;
1511 } 1517 }
1512 1518
1513 if (error_code >= QUIC_LAST_ERROR) { 1519 if (error_code >= QUIC_LAST_ERROR) {
1514 set_detailed_error("Invalid error code."); 1520 if (FLAGS_quic_ignore_invalid_error_code) {
1515 return false; 1521 // Ignore invalid QUIC error code if any.
1522 error_code = QUIC_LAST_ERROR;
1523 } else {
1524 set_detailed_error("Invalid error code.");
1525 return false;
1526 }
1516 } 1527 }
1517 1528
1518 frame->error_code = static_cast<QuicErrorCode>(error_code); 1529 frame->error_code = static_cast<QuicErrorCode>(error_code);
1519 1530
1520 StringPiece error_details; 1531 StringPiece error_details;
1521 if (!reader->ReadStringPiece16(&error_details)) { 1532 if (!reader->ReadStringPiece16(&error_details)) {
1522 set_detailed_error("Unable to read connection close error details."); 1533 set_detailed_error("Unable to read connection close error details.");
1523 return false; 1534 return false;
1524 } 1535 }
1525 frame->error_details = error_details.as_string(); 1536 frame->error_details = error_details.as_string();
1526 1537
1527 return true; 1538 return true;
1528 } 1539 }
1529 1540
1530 bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader, 1541 bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader,
1531 QuicGoAwayFrame* frame) { 1542 QuicGoAwayFrame* frame) {
1532 uint32_t error_code; 1543 uint32_t error_code;
1533 if (!reader->ReadUInt32(&error_code)) { 1544 if (!reader->ReadUInt32(&error_code)) {
1534 set_detailed_error("Unable to read go away error code."); 1545 set_detailed_error("Unable to read go away error code.");
1535 return false; 1546 return false;
1536 } 1547 }
1537 frame->error_code = static_cast<QuicErrorCode>(error_code);
1538 1548
1539 if (error_code >= QUIC_LAST_ERROR) { 1549 if (error_code >= QUIC_LAST_ERROR) {
1540 set_detailed_error("Invalid error code."); 1550 if (FLAGS_quic_ignore_invalid_error_code) {
1541 return false; 1551 // Ignore invalid QUIC error code if any.
1552 error_code = QUIC_LAST_ERROR;
1553 } else {
1554 set_detailed_error("Invalid error code.");
1555 return false;
1556 }
1542 } 1557 }
1558 frame->error_code = static_cast<QuicErrorCode>(error_code);
1543 1559
1544 uint32_t stream_id; 1560 uint32_t stream_id;
1545 if (!reader->ReadUInt32(&stream_id)) { 1561 if (!reader->ReadUInt32(&stream_id)) {
1546 set_detailed_error("Unable to read last good stream id."); 1562 set_detailed_error("Unable to read last good stream id.");
1547 return false; 1563 return false;
1548 } 1564 }
1549 frame->last_good_stream_id = static_cast<QuicStreamId>(stream_id); 1565 frame->last_good_stream_id = static_cast<QuicStreamId>(stream_id);
1550 1566
1551 StringPiece reason_phrase; 1567 StringPiece reason_phrase;
1552 if (!reader->ReadStringPiece16(&reason_phrase)) { 1568 if (!reader->ReadStringPiece16(&reason_phrase)) {
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 2257
2242 bool QuicFramer::RaiseError(QuicErrorCode error) { 2258 bool QuicFramer::RaiseError(QuicErrorCode error) {
2243 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) 2259 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error)
2244 << " detail: " << detailed_error_; 2260 << " detail: " << detailed_error_;
2245 set_error(error); 2261 set_error(error);
2246 visitor_->OnError(this); 2262 visitor_->OnError(this);
2247 return false; 2263 return false;
2248 } 2264 }
2249 2265
2250 } // namespace net 2266 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flow_controller_test.cc ('k') | net/quic/quic_header_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698