Never indexing still can use header field name in dynamic table

This commit is contained in:
Tatsuhiro Tsujikawa 2015-04-19 18:21:26 +09:00
parent 28bde2cef0
commit 91ad7e150e
1 changed files with 12 additions and 16 deletions

View File

@ -1208,24 +1208,20 @@ static search_result search_hd_table(nghttp2_hd_context *context,
} }
} }
/* Search dynamic table first, so that we can find recently used for (i = 0; i < context->hd_table.len; ++i) {
entry first */ nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, i);
if (indexing_mode != NGHTTP2_HD_NEVER_INDEXING) { if (ent->token != token || (token == -1 && !name_eq(&ent->nv, nv))) {
for (i = 0; i < context->hd_table.len; ++i) { continue;
nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, i); }
if (ent->token != token || (token == -1 && !name_eq(&ent->nv, nv))) {
continue;
}
if (res.index == -1) { if (res.index == -1) {
res.index = (ssize_t)(i + NGHTTP2_STATIC_TABLE_LENGTH); res.index = (ssize_t)(i + NGHTTP2_STATIC_TABLE_LENGTH);
} }
if (value_eq(&ent->nv, nv)) { if (indexing_mode != NGHTTP2_HD_NEVER_INDEXING && value_eq(&ent->nv, nv)) {
res.index = (ssize_t)(i + NGHTTP2_STATIC_TABLE_LENGTH); res.index = (ssize_t)(i + NGHTTP2_STATIC_TABLE_LENGTH);
res.name_value_match = 1; res.name_value_match = 1;
return res; return res;
}
} }
} }