Index: net/spdy/hpack_output_stream.cc |
diff --git a/net/spdy/hpack_output_stream.cc b/net/spdy/hpack_output_stream.cc |
index 529089222b5ea9e96bd543fb4c3593e8bea1f5cf..20f901d3b398c7f3f7df071daa101eb6f62410bb 100644 |
--- a/net/spdy/hpack_output_stream.cc |
+++ b/net/spdy/hpack_output_stream.cc |
@@ -6,43 +6,17 @@ |
#include "base/logging.h" |
-using base::StringPiece; |
namespace net { |
+using base::StringPiece; |
using std::string; |
-HpackOutputStream::HpackOutputStream(uint32 max_string_literal_size) |
- : max_string_literal_size_(max_string_literal_size), |
- bit_offset_(0) {} |
+HpackOutputStream::HpackOutputStream() |
+ : bit_offset_(0) {} |
HpackOutputStream::~HpackOutputStream() {} |
-void HpackOutputStream::AppendIndexedHeader(uint32 index_or_zero) { |
- AppendPrefix(kIndexedOpcode); |
- AppendUint32(index_or_zero); |
-} |
- |
-bool HpackOutputStream::AppendLiteralHeaderNoIndexingWithName( |
- StringPiece name, StringPiece value) { |
- AppendPrefix(kLiteralNoIndexOpcode); |
- AppendBits(0x0, 8 - kLiteralNoIndexOpcode.bit_size); |
- if (!AppendStringLiteral(name)) |
- return false; |
- if (!AppendStringLiteral(value)) |
- return false; |
- return true; |
-} |
- |
-void HpackOutputStream::TakeString(string* output) { |
- // This must hold, since all public functions cause the buffer to |
- // end on a byte boundary. |
- DCHECK_EQ(bit_offset_, 0u); |
- buffer_.swap(*output); |
- buffer_.clear(); |
- bit_offset_ = 0; |
-} |
- |
void HpackOutputStream::AppendBits(uint8 bits, size_t bit_size) { |
DCHECK_GT(bit_size, 0u); |
DCHECK_LE(bit_size, 8u); |
@@ -69,6 +43,11 @@ void HpackOutputStream::AppendPrefix(HpackPrefix prefix) { |
AppendBits(prefix.bits, prefix.bit_size); |
} |
+void HpackOutputStream::AppendBytes(StringPiece buffer) { |
+ DCHECK_EQ(bit_offset_, 0u); |
+ buffer_.append(buffer.data(), buffer.size()); |
+} |
+ |
void HpackOutputStream::AppendUint32(uint32 I) { |
// The algorithm below is adapted from the pseudocode in 4.1.1. |
size_t N = 8 - bit_offset_; |
@@ -86,15 +65,13 @@ void HpackOutputStream::AppendUint32(uint32 I) { |
} |
} |
-bool HpackOutputStream::AppendStringLiteral(base::StringPiece str) { |
+void HpackOutputStream::TakeString(string* output) { |
+ // This must hold, since all public functions cause the buffer to |
+ // end on a byte boundary. |
DCHECK_EQ(bit_offset_, 0u); |
- // TODO(akalin): Implement Huffman encoding. |
- AppendPrefix(kStringLiteralIdentityEncoded); |
- if (str.size() > max_string_literal_size_) |
- return false; |
- AppendUint32(static_cast<uint32>(str.size())); |
- buffer_.append(str.data(), str.size()); |
- return true; |
+ buffer_.swap(*output); |
+ buffer_.clear(); |
+ bit_offset_ = 0; |
} |
} // namespace net |