Commit 7021a9fc authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Incremental indexing only when the entry size if less than threshold

parent f74674aa
......@@ -812,34 +812,56 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
/* Check name exists in hd_table */
ent = find_name_in_hd_table(deflater, &nv[i]);
if(ent) {
nghttp2_hd_entry *new_ent;
uint8_t index = ent->index;
new_ent = add_hd_table_incremental(deflater, &nv[i]);
if(!new_ent) {
rv = NGHTTP2_ERR_HEADER_COMP;
goto fail;
}
rv = add_workingset(deflater, new_ent);
if(rv < 0) {
goto fail;
int incidx = 0;
if(entry_room(nv[i].namelen, nv[i].valuelen)
< NGHTTP2_HD_MAX_ENTRY_SIZE) {
nghttp2_hd_entry *new_ent;
new_ent = add_hd_table_incremental(deflater, &nv[i]);
if(!new_ent) {
rv = NGHTTP2_ERR_HEADER_COMP;
goto fail;
}
rv = add_workingset(deflater, new_ent);
if(rv < 0) {
goto fail;
}
incidx = 1;
} else {
rv = add_workingset_indname(deflater, ent, nv[i].value,
nv[i].valuelen);
if(rv < 0) {
goto fail;
}
}
rv = emit_indname_block(buf_ptr, buflen_ptr, &offset, index,
nv[i].value, nv[i].valuelen, 1);
nv[i].value, nv[i].valuelen, incidx);
if(rv < 0) {
goto fail;
}
} else {
nghttp2_hd_entry *new_ent;
new_ent = add_hd_table_incremental(deflater, &nv[i]);
if(!new_ent) {
rv = NGHTTP2_ERR_HEADER_COMP;
goto fail;
}
rv = add_workingset(deflater, new_ent);
if(rv < 0) {
goto fail;
int incidx = 0;
if(entry_room(nv[i].namelen, nv[i].valuelen)
< NGHTTP2_HD_MAX_ENTRY_SIZE) {
nghttp2_hd_entry *new_ent;
new_ent = add_hd_table_incremental(deflater, &nv[i]);
if(!new_ent) {
rv = NGHTTP2_ERR_HEADER_COMP;
goto fail;
}
rv = add_workingset(deflater, new_ent);
if(rv < 0) {
goto fail;
}
incidx = 1;
} else {
rv = add_workingset_newname(deflater, &nv[i]);
if(rv < 0) {
goto fail;
}
}
rv = emit_newname_block(buf_ptr, buflen_ptr, &offset, &nv[i], 1);
rv = emit_newname_block(buf_ptr, buflen_ptr, &offset, &nv[i],
incidx);
if(rv < 0) {
goto fail;
}
......
......@@ -36,6 +36,7 @@
#define NGHTTP2_INITIAL_WS_SIZE 128
#define NGHTTP2_HD_MAX_BUFFER_SIZE 4096
#define NGHTTP2_HD_MAX_ENTRY_SIZE 1024
#define NGHTTP2_HD_ENTRY_OVERHEAD 32
/* This value is sensible to NGHTTP2_HD_MAX_BUFFER_SIZE. Currently,
......
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