Skip to content

Commit

Permalink
Merge pull request #280 from ngtcp2/revert-264
Browse files Browse the repository at this point in the history
Revert "Do huffman encoding only when the reduction is more than 25%"
  • Loading branch information
tatsuhiro-t authored Nov 23, 2024
2 parents 594e2b3 + 9942ce6 commit ca07550
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 ca07550

Please sign in to comment.