| Index: net/quic/core/spdy_utils.cc
|
| diff --git a/net/quic/core/spdy_utils.cc b/net/quic/core/spdy_utils.cc
|
| index c2f4fd2d07a38fbbac2379450661990ddf38fa3a..11ca27585b59272bdefc6da58a67ede5de27762d 100644
|
| --- a/net/quic/core/spdy_utils.cc
|
| +++ b/net/quic/core/spdy_utils.cc
|
| @@ -8,6 +8,7 @@
|
| #include <vector>
|
|
|
| #include "base/stl_util.h"
|
| +#include "net/quic/platform/api/quic_logging.h"
|
| #include "net/quic/platform/api/quic_text_utils.h"
|
| #include "net/spdy/spdy_flags.h"
|
| #include "net/spdy/spdy_frame_builder.h"
|
| @@ -63,7 +64,8 @@ bool SpdyUtils::ExtractContentLengthFromHeaders(int64_t* content_length,
|
| for (const StringPiece& value : values) {
|
| int64_t new_value;
|
| if (!base::StringToInt64(value, &new_value) || new_value < 0) {
|
| - DLOG(ERROR) << "Content length was either unparseable or negative.";
|
| + QUIC_DLOG(ERROR)
|
| + << "Content length was either unparseable or negative.";
|
| return false;
|
| }
|
| if (*content_length < 0) {
|
| @@ -71,9 +73,10 @@ bool SpdyUtils::ExtractContentLengthFromHeaders(int64_t* content_length,
|
| continue;
|
| }
|
| if (new_value != *content_length) {
|
| - DLOG(ERROR) << "Parsed content length " << new_value << " is "
|
| - << "inconsistent with previously detected content length "
|
| - << *content_length;
|
| + QUIC_DLOG(ERROR)
|
| + << "Parsed content length " << new_value << " is "
|
| + << "inconsistent with previously detected content length "
|
| + << *content_length;
|
| return false;
|
| }
|
| }
|
| @@ -89,7 +92,7 @@ bool SpdyUtils::ParseTrailers(const char* data,
|
| SpdyFramer framer(SpdyFramer::ENABLE_COMPRESSION);
|
| if (!framer.ParseHeaderBlockInBuffer(data, data_len, trailers) ||
|
| trailers->empty()) {
|
| - DVLOG(1) << "Request Trailers are invalid.";
|
| + QUIC_DVLOG(1) << "Request Trailers are invalid.";
|
| return false; // Trailers were invalid.
|
| }
|
|
|
| @@ -98,7 +101,8 @@ bool SpdyUtils::ParseTrailers(const char* data,
|
| auto it = trailers->find(kFinalOffsetHeaderKey);
|
| if (it == trailers->end() ||
|
| !base::StringToSizeT(it->second, final_byte_offset)) {
|
| - DVLOG(1) << "Required key '" << kFinalOffsetHeaderKey << "' not present";
|
| + QUIC_DVLOG(1) << "Required key '" << kFinalOffsetHeaderKey
|
| + << "' not present";
|
| return false;
|
| }
|
| // The final offset header is no longer needed.
|
| @@ -109,15 +113,15 @@ bool SpdyUtils::ParseTrailers(const char* data,
|
| StringPiece key = trailer.first;
|
| StringPiece value = trailer.second;
|
| if (QuicTextUtils::StartsWith(key, ":")) {
|
| - DVLOG(1) << "Trailers must not contain pseudo-header: '" << key << "','"
|
| - << value << "'.";
|
| + 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.
|
| }
|
|
|
| - DVLOG(1) << "Successfully parsed Trailers.";
|
| + QUIC_DVLOG(1) << "Successfully parsed Trailers.";
|
| return true;
|
| }
|
|
|
| @@ -127,13 +131,13 @@ bool SpdyUtils::CopyAndValidateHeaders(const QuicHeaderList& header_list,
|
| for (const auto& p : header_list) {
|
| const string& name = p.first;
|
| if (name.empty()) {
|
| - DVLOG(1) << "Header name must not be empty.";
|
| + QUIC_DVLOG(1) << "Header name must not be empty.";
|
| return false;
|
| }
|
|
|
| if (QuicTextUtils::ContainsUpperCase(name)) {
|
| - DVLOG(1) << "Malformed header: Header name " << name
|
| - << " contains upper-case characters.";
|
| + QUIC_DLOG(ERROR) << "Malformed header: Header name " << name
|
| + << " contains upper-case characters.";
|
| return false;
|
| }
|
|
|
| @@ -145,7 +149,7 @@ bool SpdyUtils::CopyAndValidateHeaders(const QuicHeaderList& header_list,
|
| return false;
|
| }
|
|
|
| - DVLOG(1) << "Successfully parsed headers: " << headers->DebugString();
|
| + QUIC_DVLOG(1) << "Successfully parsed headers: " << headers->DebugString();
|
| return true;
|
| }
|
|
|
| @@ -167,19 +171,20 @@ bool SpdyUtils::CopyAndValidateTrailers(const QuicHeaderList& header_list,
|
| }
|
|
|
| if (name.empty() || name[0] == ':') {
|
| - DVLOG(1) << "Trailers must not be empty, and must not contain pseudo-"
|
| - << "headers. Found: '" << name << "'";
|
| + QUIC_DVLOG(1)
|
| + << "Trailers must not be empty, and must not contain pseudo-"
|
| + << "headers. Found: '" << name << "'";
|
| return false;
|
| }
|
|
|
| if (QuicTextUtils::ContainsUpperCase(name)) {
|
| - DVLOG(1) << "Malformed header: Header name " << name
|
| - << " contains upper-case characters.";
|
| + QUIC_DLOG(INFO) << "Malformed header: Header name " << name
|
| + << " contains upper-case characters.";
|
| return false;
|
| }
|
|
|
| if (trailers->find(name) != trailers->end()) {
|
| - DVLOG(1) << "Duplicate header '" << name << "' found in trailers.";
|
| + QUIC_DLOG(INFO) << "Duplicate header '" << name << "' found in trailers.";
|
| return false;
|
| }
|
|
|
| @@ -187,13 +192,14 @@ bool SpdyUtils::CopyAndValidateTrailers(const QuicHeaderList& header_list,
|
| }
|
|
|
| if (!found_final_byte_offset) {
|
| - DVLOG(1) << "Required key '" << kFinalOffsetHeaderKey << "' not present";
|
| + QUIC_DVLOG(1) << "Required key '" << kFinalOffsetHeaderKey
|
| + << "' not present";
|
| return false;
|
| }
|
|
|
| // TODO(rjshade): Check for other forbidden keys, following the HTTP/2 spec.
|
|
|
| - DVLOG(1) << "Successfully parsed Trailers: " << trailers->DebugString();
|
| + QUIC_DVLOG(1) << "Successfully parsed Trailers: " << trailers->DebugString();
|
| return true;
|
| }
|
|
|
|
|