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 #ifndef NET_SPDY_HPACK_ENCODER_H_ | 5 #ifndef NET_SPDY_HPACK_ENCODER_H_ |
6 #define NET_SPDY_HPACK_ENCODER_H_ | 6 #define NET_SPDY_HPACK_ENCODER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 15 #include "net/spdy/hpack_output_stream.h" |
15 | 16 |
16 // An HpackEncoder encodes header sets as outlined in | 17 // An HpackEncoder encodes header sets as outlined in |
17 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-06 | 18 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-06 |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 namespace test { | 22 namespace test { |
22 class HpackEncoderPeer; | 23 class HpackEncoderPeer; |
23 } // namespace test | 24 } // namespace test |
24 | 25 |
25 class NET_EXPORT_PRIVATE HpackEncoder { | 26 class NET_EXPORT_PRIVATE HpackEncoder { |
26 public: | 27 public: |
27 friend class test::HpackEncoderPeer; | 28 friend class test::HpackEncoderPeer; |
28 | 29 |
29 explicit HpackEncoder(); | 30 explicit HpackEncoder(); |
30 ~HpackEncoder(); | 31 ~HpackEncoder(); |
31 | 32 |
32 // Encodes the given header set into the given string. Returns | 33 // Encodes the given header set into the given string. Returns |
33 // whether or not the encoding was successful. | 34 // whether or not the encoding was successful. |
34 bool EncodeHeaderSet(const std::map<std::string, std::string>& header_set, | 35 bool EncodeHeaderSet(const std::map<std::string, std::string>& header_set, |
35 std::string* output); | 36 std::string* output); |
36 | 37 |
37 private: | 38 private: |
| 39 void EmitNonIndexedLiteral(base::StringPiece name, |
| 40 base::StringPiece value, |
| 41 HpackOutputStream* output_stream); |
| 42 |
38 static void CookieToCrumbs(base::StringPiece cookie, | 43 static void CookieToCrumbs(base::StringPiece cookie, |
39 std::vector<base::StringPiece>* out); | 44 std::vector<base::StringPiece>* out); |
40 | 45 |
41 uint32 max_string_literal_size_; | 46 uint32 max_string_literal_size_; |
42 | 47 |
43 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); | 48 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); |
44 }; | 49 }; |
45 | 50 |
46 } // namespace net | 51 } // namespace net |
47 | 52 |
48 #endif // NET_SPDY_HPACK_ENCODER_H_ | 53 #endif // NET_SPDY_HPACK_ENCODER_H_ |
OLD | NEW |