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

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

Issue 1976343002: Deprecate --quic_ignore_invalid_error_code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121416043
Patch Set: Created 4 years, 7 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_flags.cc ('k') | no next file » | 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 <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 return false; 1652 return false;
1653 } 1653 }
1654 1654
1655 uint32_t error_code; 1655 uint32_t error_code;
1656 if (!reader->ReadUInt32(&error_code)) { 1656 if (!reader->ReadUInt32(&error_code)) {
1657 set_detailed_error("Unable to read rst stream error code."); 1657 set_detailed_error("Unable to read rst stream error code.");
1658 return false; 1658 return false;
1659 } 1659 }
1660 1660
1661 if (error_code >= QUIC_STREAM_LAST_ERROR) { 1661 if (error_code >= QUIC_STREAM_LAST_ERROR) {
1662 if (FLAGS_quic_ignore_invalid_error_code) { 1662 // Ignore invalid stream error code if any.
1663 // Ignore invalid stream error code if any. 1663 error_code = QUIC_STREAM_LAST_ERROR;
1664 error_code = QUIC_STREAM_LAST_ERROR;
1665 } else {
1666 set_detailed_error("Invalid rst stream error code.");
1667 return false;
1668 }
1669 } 1664 }
1670 1665
1671 frame->error_code = static_cast<QuicRstStreamErrorCode>(error_code); 1666 frame->error_code = static_cast<QuicRstStreamErrorCode>(error_code);
1672 return true; 1667 return true;
1673 } 1668 }
1674 1669
1675 bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader, 1670 bool QuicFramer::ProcessConnectionCloseFrame(QuicDataReader* reader,
1676 QuicConnectionCloseFrame* frame) { 1671 QuicConnectionCloseFrame* frame) {
1677 uint32_t error_code; 1672 uint32_t error_code;
1678 if (!reader->ReadUInt32(&error_code)) { 1673 if (!reader->ReadUInt32(&error_code)) {
1679 set_detailed_error("Unable to read connection close error code."); 1674 set_detailed_error("Unable to read connection close error code.");
1680 return false; 1675 return false;
1681 } 1676 }
1682 1677
1683 if (error_code >= QUIC_LAST_ERROR) { 1678 if (error_code >= QUIC_LAST_ERROR) {
1684 if (FLAGS_quic_ignore_invalid_error_code) { 1679 // Ignore invalid QUIC error code if any.
1685 // Ignore invalid QUIC error code if any. 1680 error_code = QUIC_LAST_ERROR;
1686 error_code = QUIC_LAST_ERROR;
1687 } else {
1688 set_detailed_error("Invalid error code.");
1689 return false;
1690 }
1691 } 1681 }
1692 1682
1693 frame->error_code = static_cast<QuicErrorCode>(error_code); 1683 frame->error_code = static_cast<QuicErrorCode>(error_code);
1694 1684
1695 StringPiece error_details; 1685 StringPiece error_details;
1696 if (!reader->ReadStringPiece16(&error_details)) { 1686 if (!reader->ReadStringPiece16(&error_details)) {
1697 set_detailed_error("Unable to read connection close error details."); 1687 set_detailed_error("Unable to read connection close error details.");
1698 return false; 1688 return false;
1699 } 1689 }
1700 frame->error_details = error_details.as_string(); 1690 frame->error_details = error_details.as_string();
1701 1691
1702 return true; 1692 return true;
1703 } 1693 }
1704 1694
1705 bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader, 1695 bool QuicFramer::ProcessGoAwayFrame(QuicDataReader* reader,
1706 QuicGoAwayFrame* frame) { 1696 QuicGoAwayFrame* frame) {
1707 uint32_t error_code; 1697 uint32_t error_code;
1708 if (!reader->ReadUInt32(&error_code)) { 1698 if (!reader->ReadUInt32(&error_code)) {
1709 set_detailed_error("Unable to read go away error code."); 1699 set_detailed_error("Unable to read go away error code.");
1710 return false; 1700 return false;
1711 } 1701 }
1712 1702
1713 if (error_code >= QUIC_LAST_ERROR) { 1703 if (error_code >= QUIC_LAST_ERROR) {
1714 if (FLAGS_quic_ignore_invalid_error_code) { 1704 // Ignore invalid QUIC error code if any.
1715 // Ignore invalid QUIC error code if any. 1705 error_code = QUIC_LAST_ERROR;
1716 error_code = QUIC_LAST_ERROR;
1717 } else {
1718 set_detailed_error("Invalid error code.");
1719 return false;
1720 }
1721 } 1706 }
1722 frame->error_code = static_cast<QuicErrorCode>(error_code); 1707 frame->error_code = static_cast<QuicErrorCode>(error_code);
1723 1708
1724 uint32_t stream_id; 1709 uint32_t stream_id;
1725 if (!reader->ReadUInt32(&stream_id)) { 1710 if (!reader->ReadUInt32(&stream_id)) {
1726 set_detailed_error("Unable to read last good stream id."); 1711 set_detailed_error("Unable to read last good stream id.");
1727 return false; 1712 return false;
1728 } 1713 }
1729 frame->last_good_stream_id = static_cast<QuicStreamId>(stream_id); 1714 frame->last_good_stream_id = static_cast<QuicStreamId>(stream_id);
1730 1715
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 2563
2579 bool QuicFramer::RaiseError(QuicErrorCode error) { 2564 bool QuicFramer::RaiseError(QuicErrorCode error) {
2580 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) 2565 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error)
2581 << " detail: " << detailed_error_; 2566 << " detail: " << detailed_error_;
2582 set_error(error); 2567 set_error(error);
2583 visitor_->OnError(this); 2568 visitor_->OnError(this);
2584 return false; 2569 return false;
2585 } 2570 }
2586 2571
2587 } // namespace net 2572 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698