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