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

Unified Diff: net/quic/spdy_utils.cc

Issue 1979763002: Landing Recent QUIC changes until Sun May 8 00:39:29 2016 +0000 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/reliable_quic_stream_test.cc ('k') | net/quic/spdy_utils_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/spdy_utils.cc
diff --git a/net/quic/spdy_utils.cc b/net/quic/spdy_utils.cc
index bdb4a752ebdce67ec352a484644dbaa40de8a150..90e65373827dc08b0052c52e8e019117d7f82813 100644
--- a/net/quic/spdy_utils.cc
+++ b/net/quic/spdy_utils.cc
@@ -11,6 +11,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
#include "net/spdy/spdy_frame_builder.h"
#include "net/spdy/spdy_framer.h"
#include "net/spdy/spdy_protocol.h"
@@ -125,12 +126,20 @@ bool SpdyUtils::CopyAndValidateHeaders(const QuicHeaderList& header_list,
return false;
}
- if (headers->find(name) != headers->end()) {
- DLOG(ERROR) << "Duplicate header '" << name << "' found.";
- return false;
+ auto iter = headers->find(name);
+ if (iter == headers->end()) {
+ (*headers)[name] = p.second;
+ } else if (name == "cookie") {
+ // Obeys section 8.1.2.5 in RFC 7540 for cookie reconstruction.
+ headers->ReplaceOrAppendHeader(
+ name, base::StringPrintf("%s; %s", iter->second.as_string().c_str(),
+ p.second.c_str()));
+ } else {
+ // This header had multiple values, so it must be reconstructed.
+ string value = base::StringPrintf(
+ "%s%c%s", iter->second.as_string().c_str(), '\0', p.second.c_str());
+ headers->ReplaceOrAppendHeader(name, value);
}
-
- (*headers)[name] = p.second;
}
if (ContainsKey(*headers, "content-length")) {
« no previous file with comments | « net/quic/reliable_quic_stream_test.cc ('k') | net/quic/spdy_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698