Skip to content

Commit

Permalink
Revert "Do huffman encoding only when the reduction is more than 25%"
Browse files Browse the repository at this point in the history
This reverts commit 8fd4bd8.
  • Loading branch information
tatsuhiro-t committed Nov 23, 2024
1 parent 594e2b3 commit 9942ce6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/nghttp3_qpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ static int qpack_encoder_write_indexed_name(nghttp3_qpack_encoder *encoder,
int h = 0;

hlen = nghttp3_qpack_huffman_encode_count(nv->value, nv->valuelen);
if (hlen * 4 < nv->valuelen * 3) {
if (hlen < nv->valuelen) {
h = 1;
len += nghttp3_qpack_put_varint_len(hlen, 7) + hlen;
} else {
Expand Down Expand Up @@ -1928,15 +1928,15 @@ static int qpack_encoder_write_literal(nghttp3_qpack_encoder *encoder,
int nh = 0, vh = 0;

nhlen = nghttp3_qpack_huffman_encode_count(nv->name, nv->namelen);
if (nhlen * 4 < nv->namelen * 3) {
if (nhlen < nv->namelen) {
nh = 1;
len = nghttp3_qpack_put_varint_len(nhlen, prefix) + nhlen;
} else {
len = nghttp3_qpack_put_varint_len(nv->namelen, prefix) + nv->namelen;
}

vhlen = nghttp3_qpack_huffman_encode_count(nv->value, nv->valuelen);
if (vhlen * 4 < nv->valuelen * 3) {
if (vhlen < nv->valuelen) {
vh = 1;
len += nghttp3_qpack_put_varint_len(vhlen, 7) + vhlen;
} else {
Expand Down

0 comments on commit 9942ce6

Please sign in to comment.