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