Skip to content

Commit 83bcb0c

Browse files
authored
HPACK Table --> C++ (#26851)
* Buffer HPACK parsing until the end of a header boundary HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser. * maybe fixes * xx * fix boundary detection * clang-format * Revert "xx" This reverts commit 258d712. * fix tests * add missed check * fixes * fix * update tests * fix benchmark * properly unref * optimize final slice refcounting * cleanup bm_chttp2_hpack * start * new parser progress * refinement * get it compiling * bug-fix * build files * clang-tidy * fixes * fixes * fixes * fix-leaks * clang-tidy * comments * fix merge error * Revert "Buffer HPACK parsing until the end of a header boundary (#26700)" This reverts commit 8bab3e4. * streaming hpack parser start * streaming parser * clang-format * Rework HPackTable into C++ * clang-tidy * fix merge * actually set the size of the entries array * better
1 parent 8e0f8be commit 83bcb0c

File tree

20 files changed

+1052
-1580
lines changed

20 files changed

+1052
-1580
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,6 +2615,7 @@ grpc_cc_library(
26152615
"grpc_http_filters",
26162616
"grpc_trace",
26172617
"grpc_transport_chttp2_alpn",
2618+
"match",
26182619
"popularity_count",
26192620
],
26202621
)

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build_autogenerated.yaml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gRPC-C++.podspec

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gRPC-Core.podspec

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

grpc.gemspec

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

grpc.gyp

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/ext/transport/chttp2/transport/hpack_encoder.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ static void GPR_ATTRIBUTE_NOINLINE hpack_enc_log(grpc_mdelem elem) {
586586
}
587587

588588
static uint32_t dynidx(grpc_chttp2_hpack_compressor* c, uint32_t elem_index) {
589-
return 1 + GRPC_CHTTP2_LAST_STATIC_ENTRY + c->tail_remote_index +
589+
return 1 + grpc_core::HPackTable::kLastStaticEntry + c->tail_remote_index +
590590
c->table_elems - elem_index;
591591
}
592592

@@ -833,7 +833,7 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
833833
if (is_static &&
834834
(static_index =
835835
reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md))
836-
->StaticIndex()) < GRPC_CHTTP2_LAST_STATIC_ENTRY) {
836+
->StaticIndex()) < grpc_core::HPackTable::kLastStaticEntry) {
837837
emit_indexed(c, static_cast<uint32_t>(static_index + 1), &st);
838838
} else {
839839
hpack_enc(c, md, &st);
@@ -847,7 +847,8 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
847847
if (is_static &&
848848
(static_index = reinterpret_cast<grpc_core::StaticMetadata*>(
849849
GRPC_MDELEM_DATA(l->md))
850-
->StaticIndex()) < GRPC_CHTTP2_LAST_STATIC_ENTRY) {
850+
->StaticIndex()) <
851+
grpc_core::HPackTable::kLastStaticEntry) {
851852
emit_indexed(c, static_cast<uint32_t>(static_index + 1), &st);
852853
} else {
853854
hpack_enc(c, l->md, &st);

0 commit comments

Comments
 (0)