summaryrefslogtreecommitdiffstats
path: root/net/spdy/hpack_output_stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/spdy/hpack_output_stream.h')
-rw-r--r--net/spdy/hpack_output_stream.h50
1 files changed, 8 insertions, 42 deletions
diff --git a/net/spdy/hpack_output_stream.h b/net/spdy/hpack_output_stream.h
index a88e522..7a0313b 100644
--- a/net/spdy/hpack_output_stream.h
+++ b/net/spdy/hpack_output_stream.h
@@ -12,8 +12,7 @@
#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "net/base/net_export.h"
-#include "net/spdy/hpack_constants.h" // For HpackPrefix.
-#include "net/spdy/hpack_encoding_context.h"
+#include "net/spdy/hpack_constants.h"
// All section references below are to
// http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-06
@@ -24,48 +23,21 @@ namespace net {
// header fields.
class NET_EXPORT_PRIVATE HpackOutputStream {
public:
- // |max_string_literal_size| is the largest that any one string
- // |literal (header name or header value) can be.
- explicit HpackOutputStream(uint32 max_string_literal_size);
+ explicit HpackOutputStream();
~HpackOutputStream();
- // Corresponds to 4.2.
- void AppendIndexedHeader(uint32 index_or_zero);
-
- // Corresponds to 4.3.1 (second form). Returns whether or not the
- // append was successful; if the append was unsuccessful, no other
- // member function may be called.
- bool AppendLiteralHeaderNoIndexingWithName(base::StringPiece name,
- base::StringPiece value);
-
- // Moves the internal buffer to the given string and clears all
- // internal state.
- void TakeString(std::string* output);
-
// Appends the lower |bit_size| bits of |bits| to the internal buffer.
//
// |bit_size| must be > 0 and <= 8. |bits| must not have any bits
// set other than the lower |bit_size| bits.
void AppendBits(uint8 bits, size_t bit_size);
- // Accessors for testing.
-
- void AppendBitsForTest(uint8 bits, size_t size) {
- AppendBits(bits, size);
- }
-
- void AppendUint32ForTest(uint32 I) {
- AppendUint32(I);
- }
-
- bool AppendStringLiteralForTest(base::StringPiece str) {
- return AppendStringLiteral(str);
- }
-
- private:
// Simply forwards to AppendBits(prefix.bits, prefix.bit-size).
void AppendPrefix(HpackPrefix prefix);
+ // Directly appends |buffer|.
+ void AppendBytes(base::StringPiece buffer);
+
// Appends the given integer using the representation described in
// 4.1.1. If the internal buffer ends on a byte boundary, the prefix
// length N is taken to be 8; otherwise, it is taken to be the
@@ -75,16 +47,10 @@ class NET_EXPORT_PRIVATE HpackOutputStream {
// boundary after this function is called.
void AppendUint32(uint32 I);
- // Appends the given string using the representation described in
- // 4.1.2. The internal buffer must end on a byte boundary, and it is
- // guaranteed that the internal buffer will end on a byte boundary
- // after this function is called. Returns whether or not the append
- // was successful; if the append was unsuccessful, no other member
- // function may be called.
- bool AppendStringLiteral(base::StringPiece str);
-
- const uint32 max_string_literal_size_;
+ // Swaps the interal buffer with |output|.
+ void TakeString(std::string* output);
+ private:
// The internal bit buffer.
std::string buffer_;