Commit 0c1c62f3 authored by Victor Vasiliev's avatar Victor Vasiliev Committed by Commit Bot

Clean up various inconsistencies with internal version of HTTP/2

R=bnc@chromium.org

Change-Id: I37dddebc128654dc417ec7fbbcebe5679b3d9294
Reviewed-on: https://chromium-review.googlesource.com/c/1333139Reviewed-by: default avatarBence Béky <bnc@chromium.org>
Commit-Queue: Victor Vasiliev <vasilvv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607715}
parent da77121f
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
// caller. // caller.
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <algorithm> #include <algorithm>
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/platform/api/http2_export.h" #include "net/third_party/http2/platform/api/http2_export.h"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include <functional>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/test_tools/http2_random.h" #include "net/third_party/http2/test_tools/http2_random.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "net/third_party/http2/decoder/decode_http2_structures.h" #include "net/third_party/http2/decoder/decode_http2_structures.h"
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/http2_constants.h" #include "net/third_party/http2/http2_constants.h"
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/decoder/decode_status.h" #include "net/third_party/http2/decoder/decode_status.h"
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/decoder/decode_status.h" #include "net/third_party/http2/decoder/decode_status.h"
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include <type_traits> #include <type_traits>
#include "net/third_party/http2/http2_constants.h" #include "net/third_party/http2/http2_constants.h"
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "net/third_party/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/http2/decoder/http2_frame_decoder_listener.h"
#include "net/third_party/http2/http2_constants.h" #include "net/third_party/http2/http2_constants.h"
#include "net/third_party/http2/http2_structures.h" #include "net/third_party/http2/http2_structures.h"
......
...@@ -135,9 +135,8 @@ class Http2FrameDecoderTest : public RandomDecoderTest { ...@@ -135,9 +135,8 @@ class Http2FrameDecoderTest : public RandomDecoderTest {
AssertionResult DecodePayloadAndValidateSeveralWays( AssertionResult DecodePayloadAndValidateSeveralWays(
Http2StringPiece payload, Http2StringPiece payload,
const FrameParts& expected) { const FrameParts& expected) {
Validator validator = [&expected, this]( auto validator = [&expected, this](const DecodeBuffer& input,
const DecodeBuffer& input, DecodeStatus status) -> AssertionResult {
DecodeStatus status) -> AssertionResult {
VERIFY_EQ(status, DecodeStatus::kDecodeDone); VERIFY_EQ(status, DecodeStatus::kDecodeDone);
VERIFY_AND_RETURN_SUCCESS(VerifyCollected(expected)); VERIFY_AND_RETURN_SUCCESS(VerifyCollected(expected));
}; };
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
// split across buffer boundaries, than the cost of buffering upon // split across buffer boundaries, than the cost of buffering upon
// those rare occurrences is small, which then simplifies the callers. // those rare occurrences is small, which then simplifies the callers.
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/decoder/decode_http2_structures.h" #include "net/third_party/http2/decoder/decode_http2_structures.h"
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/decoder/decode_status.h" #include "net/third_party/http2/decoder/decode_status.h"
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
#include "net/third_party/http2/hpack/decoder/hpack_block_decoder.h" #include "net/third_party/http2/hpack/decoder/hpack_block_decoder.h"
#include <stdint.h> #include <cstdint>
#include <sstream> #include <sstream>
#include "base/logging.h" #include "base/logging.h"
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
#include "net/third_party/http2/hpack/decoder/hpack_block_decoder.h" #include "net/third_party/http2/hpack/decoder/hpack_block_decoder.h"
#include <cstdint>
// Tests of HpackBlockDecoder. // Tests of HpackBlockDecoder.
#include <cstdint>
#include <sstream> #include <sstream>
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
...@@ -85,7 +84,7 @@ class HpackBlockDecoderTest : public RandomDecoderTest { ...@@ -85,7 +84,7 @@ class HpackBlockDecoderTest : public RandomDecoderTest {
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.1 // http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.1
TEST_F(HpackBlockDecoderTest, SpecExample_C_2_1) { TEST_F(HpackBlockDecoderTest, SpecExample_C_2_1) {
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleLiteralNameValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleLiteralNameValueHeader(
HpackEntryType::kIndexedLiteralHeader, false, "custom-key", false, HpackEntryType::kIndexedLiteralHeader, false, "custom-key", false,
"custom-header")); "custom-header"));
...@@ -106,7 +105,7 @@ TEST_F(HpackBlockDecoderTest, SpecExample_C_2_1) { ...@@ -106,7 +105,7 @@ TEST_F(HpackBlockDecoderTest, SpecExample_C_2_1) {
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.2 // http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.2
TEST_F(HpackBlockDecoderTest, SpecExample_C_2_2) { TEST_F(HpackBlockDecoderTest, SpecExample_C_2_2) {
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleLiteralValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleLiteralValueHeader(
HpackEntryType::kUnindexedLiteralHeader, 4, false, "/sample/path")); HpackEntryType::kUnindexedLiteralHeader, 4, false, "/sample/path"));
}; };
...@@ -125,7 +124,7 @@ TEST_F(HpackBlockDecoderTest, SpecExample_C_2_2) { ...@@ -125,7 +124,7 @@ TEST_F(HpackBlockDecoderTest, SpecExample_C_2_2) {
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.3 // http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.3
TEST_F(HpackBlockDecoderTest, SpecExample_C_2_3) { TEST_F(HpackBlockDecoderTest, SpecExample_C_2_3) {
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleLiteralNameValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleLiteralNameValueHeader(
HpackEntryType::kNeverIndexedLiteralHeader, false, "password", false, HpackEntryType::kNeverIndexedLiteralHeader, false, "password", false,
"secret")); "secret"));
...@@ -145,7 +144,7 @@ TEST_F(HpackBlockDecoderTest, SpecExample_C_2_3) { ...@@ -145,7 +144,7 @@ TEST_F(HpackBlockDecoderTest, SpecExample_C_2_3) {
// http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.4 // http://httpwg.org/specs/rfc7541.html#rfc.section.C.2.4
TEST_F(HpackBlockDecoderTest, SpecExample_C_2_4) { TEST_F(HpackBlockDecoderTest, SpecExample_C_2_4) {
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleIndexedHeader(2)); VERIFY_AND_RETURN_SUCCESS(collector_.ValidateSoleIndexedHeader(2));
}; };
const char hpack_example[] = R"( const char hpack_example[] = R"(
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
// Tests of HpackDecoderStringBuffer. // Tests of HpackDecoderStringBuffer.
#include <initializer_list>
#include <sstream> #include <sstream>
#include "base/logging.h" #include "base/logging.h"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include <vector> #include <vector>
#include "base/containers/circular_deque.h" #include "base/containers/circular_deque.h"
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "net/third_party/http2/tools/http2_bug_tracker.h" #include "net/third_party/http2/tools/http2_bug_tracker.h"
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
#include "net/third_party/http2/hpack/decoder/hpack_entry_decoder.h" #include "net/third_party/http2/hpack/decoder/hpack_entry_decoder.h"
#include <cstdint>
// Tests of HpackEntryDecoder. // Tests of HpackEntryDecoder.
#include <cstdint>
#include "net/third_party/http2/hpack/decoder/hpack_entry_collector.h" #include "net/third_party/http2/hpack/decoder/hpack_entry_collector.h"
#include "net/third_party/http2/hpack/tools/hpack_block_builder.h" #include "net/third_party/http2/hpack/tools/hpack_block_builder.h"
#include "net/third_party/http2/test_tools/http2_random.h" #include "net/third_party/http2/test_tools/http2_random.h"
...@@ -58,7 +58,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Literals) { ...@@ -58,7 +58,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Literals) {
{ {
const char input[] = {0x82u}; // == Index 2 == const char input[] = {0x82u}; // == Index 2 ==
DecodeBuffer b(input); DecodeBuffer b(input);
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(2)); VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(2));
}; };
EXPECT_TRUE( EXPECT_TRUE(
...@@ -69,7 +69,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Literals) { ...@@ -69,7 +69,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Literals) {
{ {
const char input[] = {0xfeu}; // == Index 126 == const char input[] = {0xfeu}; // == Index 126 ==
DecodeBuffer b(input); DecodeBuffer b(input);
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(126)); VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(126));
}; };
EXPECT_TRUE( EXPECT_TRUE(
...@@ -80,7 +80,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Literals) { ...@@ -80,7 +80,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Literals) {
{ {
const char input[] = {0xffu, 0x00}; // == Index 127 == const char input[] = {0xffu, 0x00}; // == Index 127 ==
DecodeBuffer b(input); DecodeBuffer b(input);
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(127)); VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(127));
}; };
EXPECT_TRUE( EXPECT_TRUE(
...@@ -95,7 +95,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Various) { ...@@ -95,7 +95,7 @@ TEST_F(HpackEntryDecoderTest, IndexedHeader_Various) {
HpackBlockBuilder hbb; HpackBlockBuilder hbb;
hbb.AppendIndexedHeader(ndx); hbb.AppendIndexedHeader(ndx);
NoArgValidator do_check = [this, ndx]() { auto do_check = [this, ndx]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(ndx)); VERIFY_AND_RETURN_SUCCESS(collector_.ValidateIndexedHeader(ndx));
}; };
EXPECT_TRUE( EXPECT_TRUE(
...@@ -111,7 +111,7 @@ TEST_F(HpackEntryDecoderTest, IndexedLiteralValue_Literal) { ...@@ -111,7 +111,7 @@ TEST_F(HpackEntryDecoderTest, IndexedLiteralValue_Literal) {
"\x0d" // Value length (13) "\x0d" // Value length (13)
"custom-header"; // Value "custom-header"; // Value
DecodeBuffer b(input, sizeof input - 1); DecodeBuffer b(input, sizeof input - 1);
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralValueHeader(
HpackEntryType::kIndexedLiteralHeader, 0x40, false, "custom-header")); HpackEntryType::kIndexedLiteralHeader, 0x40, false, "custom-header"));
}; };
...@@ -128,7 +128,7 @@ TEST_F(HpackEntryDecoderTest, IndexedLiteralNameValue_Literal) { ...@@ -128,7 +128,7 @@ TEST_F(HpackEntryDecoderTest, IndexedLiteralNameValue_Literal) {
"custom-header"; // Value "custom-header"; // Value
DecodeBuffer b(input, sizeof input - 1); DecodeBuffer b(input, sizeof input - 1);
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralNameValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralNameValueHeader(
HpackEntryType::kIndexedLiteralHeader, false, "custom-key", false, HpackEntryType::kIndexedLiteralHeader, false, "custom-key", false,
"custom-header")); "custom-header"));
...@@ -141,7 +141,7 @@ TEST_F(HpackEntryDecoderTest, DynamicTableSizeUpdate_Literal) { ...@@ -141,7 +141,7 @@ TEST_F(HpackEntryDecoderTest, DynamicTableSizeUpdate_Literal) {
// Size update, length 31. // Size update, length 31.
const char input[] = "\x3f\x00"; const char input[] = "\x3f\x00";
DecodeBuffer b(input, 2); DecodeBuffer b(input, 2);
NoArgValidator do_check = [this]() { auto do_check = [this]() {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateDynamicTableSizeUpdate(31)); VERIFY_AND_RETURN_SUCCESS(collector_.ValidateDynamicTableSizeUpdate(31));
}; };
EXPECT_TRUE(DecodeAndValidateSeveralWays(&b, ValidateDoneAndEmpty(do_check))); EXPECT_TRUE(DecodeAndValidateSeveralWays(&b, ValidateDoneAndEmpty(do_check)));
...@@ -172,8 +172,8 @@ TEST_P(HpackLiteralEntryDecoderTest, RandNameIndexAndLiteralValue) { ...@@ -172,8 +172,8 @@ TEST_P(HpackLiteralEntryDecoderTest, RandNameIndexAndLiteralValue) {
HpackBlockBuilder hbb; HpackBlockBuilder hbb;
hbb.AppendNameIndexAndLiteralValue(entry_type_, ndx, hbb.AppendNameIndexAndLiteralValue(entry_type_, ndx,
value_is_huffman_encoded, value); value_is_huffman_encoded, value);
NoArgValidator do_check = [this, ndx, value_is_huffman_encoded, auto do_check = [this, ndx, value_is_huffman_encoded,
value]() -> AssertionResult { value]() -> AssertionResult {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralValueHeader(
entry_type_, ndx, value_is_huffman_encoded, value)); entry_type_, ndx, value_is_huffman_encoded, value));
}; };
...@@ -194,9 +194,8 @@ TEST_P(HpackLiteralEntryDecoderTest, RandLiteralNameAndValue) { ...@@ -194,9 +194,8 @@ TEST_P(HpackLiteralEntryDecoderTest, RandLiteralNameAndValue) {
HpackBlockBuilder hbb; HpackBlockBuilder hbb;
hbb.AppendLiteralNameAndValue(entry_type_, name_is_huffman_encoded, name, hbb.AppendLiteralNameAndValue(entry_type_, name_is_huffman_encoded, name,
value_is_huffman_encoded, value); value_is_huffman_encoded, value);
NoArgValidator do_check = [this, name_is_huffman_encoded, name, auto do_check = [this, name_is_huffman_encoded, name,
value_is_huffman_encoded, value_is_huffman_encoded, value]() -> AssertionResult {
value]() -> AssertionResult {
VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralNameValueHeader( VERIFY_AND_RETURN_SUCCESS(collector_.ValidateLiteralNameValueHeader(
entry_type_, name_is_huffman_encoded, name, value_is_huffman_encoded, entry_type_, name_is_huffman_encoded, name, value_is_huffman_encoded,
value)); value));
......
...@@ -13,7 +13,7 @@ namespace http2 { ...@@ -13,7 +13,7 @@ namespace http2 {
Http2String HpackEntryTypeDecoder::DebugString() const { Http2String HpackEntryTypeDecoder::DebugString() const {
return Http2StrCat( return Http2StrCat(
"HpackEntryTypeDecoder(varint_decoder=", varint_decoder_.DebugString(), "HpackEntryTypeDecoder(varint_decoder=", varint_decoder_.DebugString(),
", entry_type = ", entry_type_, ") "); ", entry_type=", entry_type_, ")");
} }
std::ostream& operator<<(std::ostream& out, const HpackEntryTypeDecoder& v) { std::ostream& operator<<(std::ostream& out, const HpackEntryTypeDecoder& v) {
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
// The integer represents an index into static or dynamic table, which may be // The integer represents an index into static or dynamic table, which may be
// zero, or is the new size limit of the dynamic table. // zero, or is the new size limit of the dynamic table.
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "net/third_party/http2/decoder/decode_buffer.h" #include "net/third_party/http2/decoder/decode_buffer.h"
#include "net/third_party/http2/decoder/decode_status.h" #include "net/third_party/http2/decoder/decode_status.h"
...@@ -43,8 +45,8 @@ class HTTP2_EXPORT_PRIVATE HpackEntryTypeDecoder { ...@@ -43,8 +45,8 @@ class HTTP2_EXPORT_PRIVATE HpackEntryTypeDecoder {
private: private:
HpackVarintDecoder varint_decoder_; HpackVarintDecoder varint_decoder_;
// This field is initialized just to keep memory corruption detectores // This field is initialized just to keep ASAN happy about reading it
// happy about reading it from DebugString(). // from DebugString().
HpackEntryType entry_type_ = HpackEntryType::kIndexedHeader; HpackEntryType entry_type_ = HpackEntryType::kIndexedHeader;
}; };
......
...@@ -40,7 +40,7 @@ TEST_F(HpackEntryTypeDecoderTest, DynamicTableSizeUpdate) { ...@@ -40,7 +40,7 @@ TEST_F(HpackEntryTypeDecoderTest, DynamicTableSizeUpdate) {
HpackBlockBuilder bb; HpackBlockBuilder bb;
bb.AppendDynamicTableSizeUpdate(size); bb.AppendDynamicTableSizeUpdate(size);
DecodeBuffer db(bb.buffer()); DecodeBuffer db(bb.buffer());
NoArgValidator validator = [size, this]() -> AssertionResult { auto validator = [size, this]() -> AssertionResult {
VERIFY_EQ(HpackEntryType::kDynamicTableSizeUpdate, decoder_.entry_type()); VERIFY_EQ(HpackEntryType::kDynamicTableSizeUpdate, decoder_.entry_type());
VERIFY_EQ(size, decoder_.varint()); VERIFY_EQ(size, decoder_.varint());
return AssertionSuccess(); return AssertionSuccess();
...@@ -66,8 +66,7 @@ TEST_F(HpackEntryTypeDecoderTest, HeaderWithIndex) { ...@@ -66,8 +66,7 @@ TEST_F(HpackEntryTypeDecoderTest, HeaderWithIndex) {
HpackBlockBuilder bb; HpackBlockBuilder bb;
bb.AppendEntryTypeAndVarint(entry_type, index); bb.AppendEntryTypeAndVarint(entry_type, index);
DecodeBuffer db(bb.buffer()); DecodeBuffer db(bb.buffer());
NoArgValidator validator = [entry_type, index, auto validator = [entry_type, index, this]() -> AssertionResult {
this]() -> AssertionResult {
VERIFY_EQ(entry_type, decoder_.entry_type()); VERIFY_EQ(entry_type, decoder_.entry_type());
VERIFY_EQ(index, decoder_.varint()); VERIFY_EQ(index, decoder_.varint());
return AssertionSuccess(); return AssertionSuccess();
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <stddef.h> #include <stddef.h>
#include <algorithm> #include <algorithm>
#include <cstdint>
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -192,8 +193,8 @@ class HTTP2_EXPORT_PRIVATE HpackStringDecoder { ...@@ -192,8 +193,8 @@ class HTTP2_EXPORT_PRIVATE HpackStringDecoder {
HpackVarintDecoder length_decoder_; HpackVarintDecoder length_decoder_;
// These fields are initialized just to keep memory corruption detectors // These fields are initialized just to keep ASAN happy about reading
// happy about reading them from DebugString(). // them from DebugString().
size_t remaining_ = 0; size_t remaining_ = 0;
StringDecoderState state_ = kStartDecodingLength; StringDecoderState state_ = kStartDecodingLength;
bool huffman_encoded_ = false; bool huffman_encoded_ = false;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include <iosfwd> #include <iosfwd>
#include "net/third_party/http2/platform/api/http2_export.h" #include "net/third_party/http2/platform/api/http2_export.h"
......
...@@ -37,4 +37,4 @@ HTTP2_EXPORT_PRIVATE void HuffmanEncode(Http2StringPiece plain, ...@@ -37,4 +37,4 @@ HTTP2_EXPORT_PRIVATE void HuffmanEncode(Http2StringPiece plain,
} // namespace http2 } // namespace http2
#endif // NET_THIRD_PARTY_HTTP2_HPACK_HUFFMAN_HPACK_HUFFMAN_DECODER_H_ #endif // NET_THIRD_PARTY_HTTP2_HPACK_HUFFMAN_HPACK_HUFFMAN_ENCODER_H_
...@@ -63,6 +63,7 @@ void HpackBlockBuilder::AppendEntryTypeAndVarint(HpackEntryType entry_type, ...@@ -63,6 +63,7 @@ void HpackBlockBuilder::AppendEntryTypeAndVarint(HpackEntryType entry_type,
HTTP2_BUG << "Unreached, entry_type=" << entry_type; HTTP2_BUG << "Unreached, entry_type=" << entry_type;
high_bits = 0; high_bits = 0;
prefix_length = 0; prefix_length = 0;
break;
} }
AppendHighBitsAndVarint(high_bits, prefix_length, varint); AppendHighBitsAndVarint(high_bits, prefix_length, varint);
} }
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "net/third_party/http2/hpack/http2_hpack_constants.h" #include "net/third_party/http2/hpack/http2_hpack_constants.h"
#include "net/third_party/http2/platform/api/http2_string.h" #include "net/third_party/http2/platform/api/http2_string.h"
#include "net/third_party/http2/platform/api/http2_string_piece.h" #include "net/third_party/http2/platform/api/http2_string_piece.h"
......
...@@ -29,7 +29,7 @@ void HpackExampleToStringOrDie(Http2StringPiece example, Http2String* output) { ...@@ -29,7 +29,7 @@ void HpackExampleToStringOrDie(Http2StringPiece example, Http2String* output) {
example.remove_prefix(1); example.remove_prefix(1);
continue; continue;
} }
if (example.starts_with("|")) { if (!example.empty() && example[0] == '|') {
// Start of a comment. Skip to end of line or of input. // Start of a comment. Skip to end of line or of input.
auto pos = example.find('\n'); auto pos = example.find('\n');
if (pos == Http2StringPiece::npos) { if (pos == Http2StringPiece::npos) {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "net/third_party/http2/http2_structures_test_util.h" #include "net/third_party/http2/http2_structures_test_util.h"
#include <cstdint>
#include "net/third_party/http2/http2_constants.h" #include "net/third_party/http2/http2_constants.h"
#include "net/third_party/http2/http2_constants_test_util.h" #include "net/third_party/http2/http2_constants_test_util.h"
#include "net/third_party/http2/http2_structures.h" #include "net/third_party/http2/http2_structures.h"
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include <vector> #include <vector>
#include "base/logging.h" #include "base/logging.h"
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include "net/third_party/http2/decoder/http2_frame_decoder_listener.h" #include "net/third_party/http2/decoder/http2_frame_decoder_listener.h"
#include "net/third_party/http2/http2_constants.h" #include "net/third_party/http2/http2_constants.h"
#include "net/third_party/http2/http2_structures.h" #include "net/third_party/http2/http2_structures.h"
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#include <stddef.h> // for size_t #include <stddef.h> // for size_t
#include <cstdint>
#include "net/third_party/http2/http2_constants.h" #include "net/third_party/http2/http2_constants.h"
#include "net/third_party/http2/http2_structures.h" #include "net/third_party/http2/http2_structures.h"
#include "net/third_party/http2/platform/api/http2_string.h" #include "net/third_party/http2/platform/api/http2_string.h"
......
...@@ -17,10 +17,6 @@ ...@@ -17,10 +17,6 @@
#include "net/third_party/http2/tools/failure.h" #include "net/third_party/http2/tools/failure.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
// It's rather time consuming to decode large buffers one at a time,
// especially with the log level cranked up. So, by default we don't do
// that unless explicitly requested.
using ::testing::AssertionFailure; using ::testing::AssertionFailure;
using ::testing::AssertionResult; using ::testing::AssertionResult;
using ::testing::AssertionSuccess; using ::testing::AssertionSuccess;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <stddef.h> #include <stddef.h>
#include <cstdint>
#include <functional> #include <functional>
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
...@@ -236,7 +237,7 @@ class RandomDecoderTest : public ::testing::Test { ...@@ -236,7 +237,7 @@ class RandomDecoderTest : public ::testing::Test {
return ValidateDoneAndOffset(offset, validator); return ValidateDoneAndOffset(offset, validator);
} }
// Expose |random_| as Http2Random so callers do not have to care about which // Expose |random_| as Http2Random so callers don't have to care about which
// sub-class of Http2Random is used, nor can they rely on the specific // sub-class of Http2Random is used, nor can they rely on the specific
// sub-class that RandomDecoderTest uses. // sub-class that RandomDecoderTest uses.
Http2Random& Random() { return random_; } Http2Random& Random() { return random_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment