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

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

Issue 2964583002: Landing Recent QUIC changes until Jun 27 19:50:48 2017 +0000 (Closed)
Patch Set: Created 3 years, 6 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_stream.cc ('k') | net/quic/core/spdy_utils_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/spdy_utils.cc
diff --git a/net/quic/core/spdy_utils.cc b/net/quic/core/spdy_utils.cc
index 5ad6a43a5cdb6f2f78111f65b57fb06477dde15a..2dfec6b3011052603e3539d173ae07469372673a 100644
--- a/net/quic/core/spdy_utils.cc
+++ b/net/quic/core/spdy_utils.cc
@@ -7,6 +7,8 @@
#include <memory>
#include <vector>
+#include "net/quic/platform/api/quic_flag_utils.h"
+#include "net/quic/platform/api/quic_flags.h"
#include "net/quic/platform/api/quic_logging.h"
#include "net/quic/platform/api/quic_map_util.h"
#include "net/quic/platform/api/quic_string_piece.h"
@@ -96,6 +98,8 @@ bool SpdyUtils::CopyAndValidateHeaders(const QuicHeaderList& header_list,
bool SpdyUtils::CopyAndValidateTrailers(const QuicHeaderList& header_list,
size_t* final_byte_offset,
SpdyHeaderBlock* trailers) {
+ const bool handle_duplicate_trailers =
+ FLAGS_quic_reloadable_flag_quic_handle_duplicate_trailers;
bool found_final_byte_offset = false;
for (const auto& p : header_list) {
const string& name = p.first;
@@ -121,13 +125,22 @@ bool SpdyUtils::CopyAndValidateTrailers(const QuicHeaderList& header_list,
return false;
}
- if (trailers->find(name) != trailers->end()) {
- QUIC_DLOG(ERROR) << "Duplicate header '" << name
- << "' found in trailers.";
- return false;
+ if (handle_duplicate_trailers) {
+ QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_handle_duplicate_trailers, 1,
+ 3);
+ trailers->AppendValueOrAddHeader(name, p.second);
+ } else {
+ QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_handle_duplicate_trailers, 2,
+ 3);
+ if (trailers->find(name) != trailers->end()) {
+ QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_handle_duplicate_trailers,
+ 3, 3);
+ QUIC_DLOG(ERROR) << "Duplicate header '" << name
+ << "' found in trailers.";
+ return false;
+ }
+ (*trailers)[name] = p.second;
}
-
- (*trailers)[name] = p.second;
}
if (!found_final_byte_offset) {
« no previous file with comments | « net/quic/core/quic_stream.cc ('k') | net/quic/core/spdy_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698