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

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

Issue 2850513002: Delete QUIC/SPDY utility methods for parsing headers/trailers. (Closed)
Patch Set: 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/quic/core/spdy_utils.h ('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 cf16e347fff465f8078d1977a3028d040914ba24..5ad6a43a5cdb6f2f78111f65b57fb06477dde15a 100644
--- a/net/quic/core/spdy_utils.cc
+++ b/net/quic/core/spdy_utils.cc
@@ -32,24 +32,6 @@ string SpdyUtils::SerializeUncompressedHeaders(const SpdyHeaderBlock& headers) {
}
// static
-bool SpdyUtils::ParseHeaders(const char* data,
- uint32_t data_len,
- int64_t* content_length,
- SpdyHeaderBlock* headers) {
- SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
- if (!framer.ParseHeaderBlockInBuffer(data, data_len, headers) ||
- headers->empty()) {
- return false; // Headers were invalid.
- }
-
- if (!QuicContainsKey(*headers, "content-length")) {
- return true;
- }
-
- return ExtractContentLengthFromHeaders(content_length, headers);
-}
-
-// static
bool SpdyUtils::ExtractContentLengthFromHeaders(int64_t* content_length,
SpdyHeaderBlock* headers) {
auto it = headers->find("content-length");
@@ -83,47 +65,6 @@ bool SpdyUtils::ExtractContentLengthFromHeaders(int64_t* content_length,
}
}
-// static
-bool SpdyUtils::ParseTrailers(const char* data,
- uint32_t data_len,
- size_t* final_byte_offset,
- SpdyHeaderBlock* trailers) {
- SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
- if (!framer.ParseHeaderBlockInBuffer(data, data_len, trailers) ||
- trailers->empty()) {
- QUIC_DVLOG(1) << "Request Trailers are invalid.";
- return false; // Trailers were invalid.
- }
-
- // Pull out the final offset pseudo header which indicates the number of
- // response body bytes expected.
- auto it = trailers->find(kFinalOffsetHeaderKey);
- if (it == trailers->end() ||
- !QuicTextUtils::StringToSizeT(it->second, final_byte_offset)) {
- QUIC_DLOG(ERROR) << "Required key '" << kFinalOffsetHeaderKey
- << "' not present";
- return false;
- }
- // The final offset header is no longer needed.
- trailers->erase(it->first);
-
- // Trailers must not have empty keys, and must not contain pseudo headers.
- for (const auto& trailer : *trailers) {
- QuicStringPiece key = trailer.first;
- QuicStringPiece value = trailer.second;
- if (QuicTextUtils::StartsWith(key, ":")) {
- QUIC_DVLOG(1) << "Trailers must not contain pseudo-header: '" << key
- << "','" << value << "'.";
- return false;
- }
-
- // TODO(rjshade): Check for other forbidden keys, following the HTTP/2 spec.
- }
-
- QUIC_DVLOG(1) << "Successfully parsed Trailers: " << trailers->DebugString();
- return true;
-}
-
bool SpdyUtils::CopyAndValidateHeaders(const QuicHeaderList& header_list,
int64_t* content_length,
SpdyHeaderBlock* headers) {
« no previous file with comments | « net/quic/core/spdy_utils.h ('k') | net/quic/core/spdy_utils_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698