Skip to content

Commit

Permalink
copying each header to the cache, we must leave space for the string
Browse files Browse the repository at this point in the history
header, also, if there are duplicate headers, then we must write the
duplicate header.

earlier in the presence of duplicates, there was a double shift at the
beginning of the copying procedure
CSTR_MOVE_HDR
CSTR_WRITE_HDR
*CSTR_MOVE_HDR*
*CSTR_MOVE_HDR*
CSTR_WRITE_HDR
  • Loading branch information
avbelov23 committed Sep 23, 2020
1 parent ced0918 commit c415318
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tempesta_fw/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,23 +1152,22 @@ tfw_cache_h2_copy_hdr(TfwCacheEntry *ce, char **p, TdbVRec **trec, TfwStr *hdr,
return -ENOMEM;
}

CSTR_MOVE_HDR();

if (TFW_STR_DUP(hdr)) {
CSTR_WRITE_HDR(TFW_STR_DUPLICATE, hdr->nchunks);
CSTR_MOVE_HDR();
CSTR_WRITE_HDR(TFW_STR_DUPLICATE, hdr->nchunks);
}

TFW_STR_FOR_EACH_DUP(dup, hdr, dup_end) {
unsigned int prev_len = ce->hdr_len;
unsigned int prev_len;

if (dupl) {
TFW_STR_INIT(&s_nm);
TFW_STR_INIT(&s_val);
tfw_http_hdr_split(dup, &s_nm, &s_val, true);
st_index = dup->hpack_idx;
CSTR_MOVE_HDR();
}
CSTR_MOVE_HDR();
prev_len = ce->hdr_len;

if (st_index) {
if (tfw_cache_h2_copy_int(&ce->hdr_len, st_index, 0xF,
Expand Down

0 comments on commit c415318

Please sign in to comment.