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

Unified Diff: net/quic/core/quic_spdy_session.cc

Issue 2747443002: Landing recent QUIC changes until Sun Mar 5 09:18:09 2017 +0000 (Closed)
Patch Set: Fixed formatting errors in quic_error_mapping.cc Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_server_session_base_test.cc ('k') | net/quic/core/quic_spdy_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_spdy_session.cc
diff --git a/net/quic/core/quic_spdy_session.cc b/net/quic/core/quic_spdy_session.cc
index 4c14b615305ca1a86854f8c5d792f6184d793d92..61d16c9020abdb0d62d865fd57960e25884634c9 100644
--- a/net/quic/core/quic_spdy_session.cc
+++ b/net/quic/core/quic_spdy_session.cc
@@ -124,7 +124,8 @@ class QuicSpdySession::SpdyFramerVisitor
if (session_->OnStreamFrameData(stream_id, data, len)) {
return;
}
- CloseConnection("SPDY DATA frame received.");
+ CloseConnection("SPDY DATA frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnStreamEnd(SpdyStreamId stream_id) override {
@@ -133,13 +134,23 @@ class QuicSpdySession::SpdyFramerVisitor
}
void OnStreamPadding(SpdyStreamId stream_id, size_t len) override {
- CloseConnection("SPDY frame padding received.");
+ CloseConnection("SPDY frame padding received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnError(SpdyFramer* framer) override {
- CloseConnection(QuicStrCat(
- "SPDY framing error: ",
- SpdyFramer::SpdyFramerErrorToString(framer->spdy_framer_error())));
+ QuicErrorCode code = QUIC_INVALID_HEADERS_STREAM_DATA;
+ SpdyFramer::SpdyFramerError error = framer->spdy_framer_error();
+ switch (error) {
+ case SpdyFramer::SpdyFramerError::SPDY_DECOMPRESS_FAILURE:
+ code = QUIC_HEADERS_STREAM_DATA_DECOMPRESS_FAILURE;
+ break;
+ default:
+ break;
+ }
+ CloseConnection(QuicStrCat("SPDY framing error: ",
+ SpdyFramer::SpdyFramerErrorToString(error)),
+ code);
}
void OnDataFrameHeader(SpdyStreamId stream_id,
@@ -148,16 +159,19 @@ class QuicSpdySession::SpdyFramerVisitor
if (session_->OnDataFrameHeader(stream_id, length, fin)) {
return;
}
- CloseConnection("SPDY DATA frame received.");
+ CloseConnection("SPDY DATA frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnRstStream(SpdyStreamId stream_id, SpdyErrorCode error_code) override {
- CloseConnection("SPDY RST_STREAM frame received.");
+ CloseConnection("SPDY RST_STREAM frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnSetting(SpdySettingsIds id, uint32_t value) override {
if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) {
- CloseConnection("SPDY SETTINGS frame received.");
+ CloseConnection("SPDY SETTINGS frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
return;
}
switch (id) {
@@ -170,14 +184,16 @@ class QuicSpdySession::SpdyFramerVisitor
// See rfc7540, Section 6.5.2.
if (value > 1) {
CloseConnection(
- QuicStrCat("Invalid value for SETTINGS_ENABLE_PUSH: ", value));
+ QuicStrCat("Invalid value for SETTINGS_ENABLE_PUSH: ", value),
+ QUIC_INVALID_HEADERS_STREAM_DATA);
return;
}
session_->UpdateEnableServerPush(value > 0);
break;
} else {
CloseConnection(
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id));
+ QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id),
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
break;
// TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when
@@ -188,29 +204,34 @@ class QuicSpdySession::SpdyFramerVisitor
}
default:
CloseConnection(
- QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id));
+ QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id),
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
}
void OnSettingsAck() override {
if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) {
- CloseConnection("SPDY SETTINGS frame received.");
+ CloseConnection("SPDY SETTINGS frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
}
void OnSettingsEnd() override {
if (!FLAGS_quic_reloadable_flag_quic_respect_http2_settings_frame) {
- CloseConnection("SPDY SETTINGS frame received.");
+ CloseConnection("SPDY SETTINGS frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
}
void OnPing(SpdyPingId unique_id, bool is_ack) override {
- CloseConnection("SPDY PING frame received.");
+ CloseConnection("SPDY PING frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnGoAway(SpdyStreamId last_accepted_stream_id,
SpdyErrorCode error_code) override {
- CloseConnection("SPDY GOAWAY frame received.");
+ CloseConnection("SPDY GOAWAY frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnHeaders(SpdyStreamId stream_id,
@@ -232,14 +253,16 @@ class QuicSpdySession::SpdyFramerVisitor
}
void OnWindowUpdate(SpdyStreamId stream_id, int delta_window_size) override {
- CloseConnection("SPDY WINDOW_UPDATE frame received.");
+ CloseConnection("SPDY WINDOW_UPDATE frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
void OnPushPromise(SpdyStreamId stream_id,
SpdyStreamId promised_stream_id,
bool end) override {
if (!session_->supports_push_promise()) {
- CloseConnection("PUSH_PROMISE not supported.");
+ CloseConnection("PUSH_PROMISE not supported.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
return;
}
if (!session_->IsConnected()) {
@@ -254,11 +277,13 @@ class QuicSpdySession::SpdyFramerVisitor
SpdyStreamId parent_id,
int weight,
bool exclusive) override {
- CloseConnection("SPDY PRIORITY frame received.");
+ CloseConnection("SPDY PRIORITY frame received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
}
bool OnUnknownFrame(SpdyStreamId stream_id, uint8_t frame_type) override {
- CloseConnection("Unknown frame type received.");
+ CloseConnection("Unknown frame type received.",
+ QUIC_INVALID_HEADERS_STREAM_DATA);
return false;
}
@@ -290,10 +315,9 @@ class QuicSpdySession::SpdyFramerVisitor
}
private:
- void CloseConnection(const string& details) {
+ void CloseConnection(const string& details, QuicErrorCode code) {
if (session_->IsConnected()) {
- session_->CloseConnectionWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
- details);
+ session_->CloseConnectionWithDetails(code, details);
}
}
« no previous file with comments | « net/quic/core/quic_server_session_base_test.cc ('k') | net/quic/core/quic_spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698