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

Unified Diff: net/spdy/header_coalescer.cc

Issue 2832973003: Split net/spdy into core and chromium subdirectories. (Closed)
Patch Set: Fix some more build rules. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/header_coalescer.h ('k') | net/spdy/header_coalescer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/header_coalescer.cc
diff --git a/net/spdy/header_coalescer.cc b/net/spdy/header_coalescer.cc
deleted file mode 100644
index 2158998328a2d0af6a2fef85d48e0e9b231392c6..0000000000000000000000000000000000000000
--- a/net/spdy/header_coalescer.cc
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/spdy/header_coalescer.h"
-
-#include <utility>
-
-#include "base/strings/string_util.h"
-#include "net/http/http_util.h"
-#include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
-#include "net/spdy/platform/api/spdy_string.h"
-
-namespace net {
-
-const size_t kMaxHeaderListSize = 256 * 1024;
-
-void HeaderCoalescer::OnHeader(SpdyStringPiece key, SpdyStringPiece value) {
- if (error_seen_) {
- return;
- }
-
- if (key.empty()) {
- DVLOG(1) << "Header name must not be empty.";
- error_seen_ = true;
- return;
- }
-
- SpdyStringPiece key_name = key;
- if (key[0] == ':') {
- if (regular_header_seen_) {
- error_seen_ = true;
- return;
- }
- key_name.remove_prefix(1);
- } else if (!regular_header_seen_) {
- regular_header_seen_ = true;
- }
-
- if (!HttpUtil::IsValidHeaderName(key_name)) {
- error_seen_ = true;
- return;
- }
-
- // 32 byte overhead according to RFC 7540 Section 6.5.2.
- header_list_size_ += key.size() + value.size() + 32;
- if (header_list_size_ > kMaxHeaderListSize) {
- error_seen_ = true;
- return;
- }
-
- // End of line delimiter is forbidden according to RFC 7230 Section 3.2.
- // Line folding, RFC 7230 Section 3.2.4., is a special case of this.
- if (value.find("\r\n") != SpdyStringPiece::npos) {
- error_seen_ = true;
- return;
- }
-
- auto iter = headers_.find(key);
- if (iter == headers_.end()) {
- headers_[key] = value;
- } else {
- // This header had multiple values, so it must be reconstructed.
- SpdyStringPiece v = iter->second;
- SpdyString s(v.data(), v.length());
- if (key == "cookie") {
- // Obeys section 8.1.2.5 in RFC 7540 for cookie reconstruction.
- s.append("; ");
- } else {
- SpdyStringPiece("\0", 1).AppendToString(&s);
- }
- value.AppendToString(&s);
- headers_[key] = s;
- }
-}
-
-SpdyHeaderBlock HeaderCoalescer::release_headers() {
- DCHECK(headers_valid_);
- headers_valid_ = false;
- return std::move(headers_);
-}
-
-size_t HeaderCoalescer::EstimateMemoryUsage() const {
- return SpdyEstimateMemoryUsage(headers_);
-}
-
-} // namespace net
« no previous file with comments | « net/spdy/header_coalescer.h ('k') | net/spdy/header_coalescer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698