| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/spdy/hpack_decoder.h" | 5 #include "net/spdy/hpack_decoder.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "net/spdy/hpack_constants.h" | 11 #include "net/spdy/hpack_constants.h" |
| 10 #include "net/spdy/hpack_output_stream.h" | 12 #include "net/spdy/hpack_output_stream.h" |
| 11 | 13 |
| 12 namespace net { | 14 namespace net { |
| 13 | 15 |
| 14 using base::StringPiece; | 16 using base::StringPiece; |
| 15 using std::string; | 17 using std::string; |
| 16 | 18 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Emit the Cookie header, if any crumbles were encountered. | 59 // Emit the Cookie header, if any crumbles were encountered. |
| 58 if (!cookie_value_.empty()) { | 60 if (!cookie_value_.empty()) { |
| 59 decoded_block_[kCookieKey] = cookie_value_; | 61 decoded_block_[kCookieKey] = cookie_value_; |
| 60 cookie_value_.clear(); | 62 cookie_value_.clear(); |
| 61 } | 63 } |
| 62 return true; | 64 return true; |
| 63 } | 65 } |
| 64 | 66 |
| 65 bool HpackDecoder::HandleHeaderRepresentation(StringPiece name, | 67 bool HpackDecoder::HandleHeaderRepresentation(StringPiece name, |
| 66 StringPiece value) { | 68 StringPiece value) { |
| 67 typedef std::pair<std::map<string, string>::iterator, bool> InsertResult; | 69 typedef std::pair<SpdyHeaderBlock::iterator, bool> InsertResult; |
| 68 | 70 |
| 69 // Fail if pseudo-header follows regular header. | 71 // Fail if pseudo-header follows regular header. |
| 70 if (name.size() > 0) { | 72 if (name.size() > 0) { |
| 71 if (name[0] == kPseudoHeaderPrefix) { | 73 if (name[0] == kPseudoHeaderPrefix) { |
| 72 if (regular_header_seen_) return false; | 74 if (regular_header_seen_) return false; |
| 73 } else { | 75 } else { |
| 74 regular_header_seen_ = true; | 76 regular_header_seen_ = true; |
| 75 } | 77 } |
| 76 } | 78 } |
| 77 | 79 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 return result; | 199 return result; |
| 198 } else if (input_stream->MatchPrefixAndConsume( | 200 } else if (input_stream->MatchPrefixAndConsume( |
| 199 kStringLiteralIdentityEncoded)) { | 201 kStringLiteralIdentityEncoded)) { |
| 200 return input_stream->DecodeNextIdentityString(output); | 202 return input_stream->DecodeNextIdentityString(output); |
| 201 } else { | 203 } else { |
| 202 return false; | 204 return false; |
| 203 } | 205 } |
| 204 } | 206 } |
| 205 | 207 |
| 206 } // namespace net | 208 } // namespace net |
| OLD | NEW |