Index: net/spdy/hpack_decoder.cc |
diff --git a/net/spdy/hpack_decoder.cc b/net/spdy/hpack_decoder.cc |
index 6aa4f59a4352196cd04654c7b14908ce0a24ec42..82abcab7ea5e9c18da413cea86f6e73a239c312f 100644 |
--- a/net/spdy/hpack_decoder.cc |
+++ b/net/spdy/hpack_decoder.cc |
@@ -6,7 +6,6 @@ |
#include "base/basictypes.h" |
#include "base/logging.h" |
-#include "base/strings/string_util.h" |
#include "net/spdy/hpack_constants.h" |
#include "net/spdy/hpack_output_stream.h" |
@@ -21,6 +20,8 @@ const uint8 kNoState = 0; |
// Set on entries added to the reference set during this decoding. |
const uint8 kReferencedThisEncoding = 1; |
+const char kCookieKey[] = "cookie"; |
+ |
} // namespace |
HpackDecoder::HpackDecoder(const HpackHuffmanTable& table) |
@@ -69,9 +70,8 @@ bool HpackDecoder::HandleControlFrameHeadersComplete(SpdyStreamId id) { |
} |
} |
// Emit the Cookie header, if any crumbles were encountered. |
- if (!cookie_name_.empty()) { |
- decoded_block_[cookie_name_] = cookie_value_; |
- cookie_name_.clear(); |
+ if (!cookie_value_.empty()) { |
+ decoded_block_[kCookieKey] = cookie_value_; |
cookie_value_.clear(); |
} |
return true; |
@@ -81,11 +81,8 @@ void HpackDecoder::HandleHeaderRepresentation(StringPiece name, |
StringPiece value) { |
typedef std::pair<std::map<string, string>::iterator, bool> InsertResult; |
- // TODO(jgraettinger): HTTP/2 requires strict lowercasing of headers, |
- // and the permissiveness here isn't wanted. Back this out in upstream. |
- if (LowerCaseEqualsASCII(name.begin(), name.end(), "cookie")) { |
- if (cookie_name_.empty()) { |
- cookie_name_.assign(name.data(), name.size()); |
+ if (name == kCookieKey) { |
+ if (cookie_value_.empty()) { |
cookie_value_.assign(value.data(), value.size()); |
} else { |
cookie_value_ += "; "; |
@@ -104,11 +101,6 @@ void HpackDecoder::HandleHeaderRepresentation(StringPiece name, |
} |
bool HpackDecoder::DecodeNextOpcode(HpackInputStream* input_stream) { |
- // Implements 4.4: Encoding context update. Context updates are a special-case |
- // of indexed header, and must be tested prior to |kIndexedOpcode| below. |
- if (input_stream->MatchPrefixAndConsume(kEncodingContextOpcode)) { |
- return DecodeNextContextUpdate(input_stream); |
- } |
// Implements 4.2: Indexed Header Field Representation. |
if (input_stream->MatchPrefixAndConsume(kIndexedOpcode)) { |
return DecodeNextIndexedHeader(input_stream); |
@@ -121,6 +113,15 @@ bool HpackDecoder::DecodeNextOpcode(HpackInputStream* input_stream) { |
if (input_stream->MatchPrefixAndConsume(kLiteralIncrementalIndexOpcode)) { |
return DecodeNextLiteralHeader(input_stream, true); |
} |
+ // Implements 4.3.3: Literal Header Field never Indexed. |
+ // TODO(jgraettinger): Preserve the never-indexed bit. |
+ if (input_stream->MatchPrefixAndConsume(kLiteralNeverIndexOpcode)) { |
+ return DecodeNextLiteralHeader(input_stream, false); |
+ } |
+ // Implements 4.4: Encoding context update. |
+ if (input_stream->MatchPrefixAndConsume(kEncodingContextOpcode)) { |
+ return DecodeNextContextUpdate(input_stream); |
+ } |
// Unrecognized opcode. |
return false; |
} |
@@ -150,9 +151,6 @@ bool HpackDecoder::DecodeNextIndexedHeader(HpackInputStream* input_stream) { |
if (!input_stream->DecodeNextUint32(&index)) |
return false; |
- // If index == 0, |kEncodingContextOpcode| would have matched. |
- CHECK_NE(index, 0u); |
- |
HpackEntry* entry = header_table_.GetByIndex(index); |
if (entry == NULL) |
return false; |