Commit 8cf37318 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

Experiment HPACK with upcoming changes

* remove substitution
* reversed insertion and removal from header table
* unified initial static table
parent e85418f0
This diff is collapsed.
...@@ -70,21 +70,23 @@ typedef struct { ...@@ -70,21 +70,23 @@ typedef struct {
nghttp2_nv nv; nghttp2_nv nv;
/* Reference count */ /* Reference count */
uint8_t ref; uint8_t ref;
/* Index in the header table */
uint8_t index;
uint8_t flags; uint8_t flags;
} nghttp2_hd_entry; } nghttp2_hd_entry;
typedef struct {
nghttp2_hd_entry **buffer;
size_t mask;
size_t first;
size_t len;
} nghttp2_hd_ringbuf;
typedef struct { typedef struct {
/* Header table */ /* Header table */
nghttp2_hd_entry **hd_table; nghttp2_hd_ringbuf hd_table;
nghttp2_hd_entry **static_hd_table;
/* Holding emitted entry in deflating header block to retain /* Holding emitted entry in deflating header block to retain
reference count. */ reference count. */
nghttp2_hd_entry **emit_set; nghttp2_hd_entry **emit_set;
/* The capacity of the |hd_table| */
uint16_t hd_table_capacity;
/* The number of entry the |hd_table| contains */
uint16_t hd_tablelen;
/* The capacity of the |emit_set| */ /* The capacity of the |emit_set| */
uint16_t emit_set_capacity; uint16_t emit_set_capacity;
/* The number of entry the |emit_set| contains */ /* The number of entry the |emit_set| contains */
...@@ -114,7 +116,7 @@ typedef struct { ...@@ -114,7 +116,7 @@ typedef struct {
* NGHTTP2_ERR_NOMEM * NGHTTP2_ERR_NOMEM
* Out of memory. * Out of memory.
*/ */
int nghttp2_hd_entry_init(nghttp2_hd_entry *ent, uint8_t index, uint8_t flags, int nghttp2_hd_entry_init(nghttp2_hd_entry *ent, uint8_t flags,
uint8_t *name, uint16_t namelen, uint8_t *name, uint16_t namelen,
uint8_t *value, uint16_t valuelen); uint8_t *value, uint16_t valuelen);
...@@ -238,4 +240,8 @@ int nghttp2_hd_emit_subst_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr, ...@@ -238,4 +240,8 @@ int nghttp2_hd_emit_subst_newname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
size_t *offset_ptr, nghttp2_nv *nv, size_t *offset_ptr, nghttp2_nv *nv,
size_t subindex); size_t subindex);
/* For unittesting purpose */
nghttp2_hd_entry* nghttp2_hd_table_get(nghttp2_hd_context *context,
size_t index);
#endif /* NGHTTP2_HD_COMP_H */ #endif /* NGHTTP2_HD_COMP_H */
...@@ -237,16 +237,6 @@ int main(int argc, char* argv[]) ...@@ -237,16 +237,6 @@ int main(int argc, char* argv[])
test_nghttp2_hd_inflate_indname_inc_eviction) || test_nghttp2_hd_inflate_indname_inc_eviction) ||
!CU_add_test(pSuite, "hd_inflate_newname_inc", !CU_add_test(pSuite, "hd_inflate_newname_inc",
test_nghttp2_hd_inflate_newname_inc) || test_nghttp2_hd_inflate_newname_inc) ||
!CU_add_test(pSuite, "hd_inflate_indname_subst",
test_nghttp2_hd_inflate_indname_subst) ||
!CU_add_test(pSuite, "hd_inflate_indname_subst_eviction",
test_nghttp2_hd_inflate_indname_subst_eviction) ||
!CU_add_test(pSuite, "hd_inflate_indname_subst_eviction_neg",
test_nghttp2_hd_inflate_indname_subst_eviction_neg) ||
!CU_add_test(pSuite, "hd_inflate_newname_subst",
test_nghttp2_hd_inflate_newname_subst) ||
!CU_add_test(pSuite, "hd_inflate_clearall_subst",
test_nghttp2_hd_inflate_clearall_subst) ||
!CU_add_test(pSuite, "hd_inflate_clearall_inc", !CU_add_test(pSuite, "hd_inflate_clearall_inc",
test_nghttp2_hd_inflate_clearall_inc) || test_nghttp2_hd_inflate_clearall_inc) ||
!CU_add_test(pSuite, "hd_deflate_inflate", !CU_add_test(pSuite, "hd_deflate_inflate",
......
This diff is collapsed.
...@@ -31,12 +31,7 @@ void test_nghttp2_hd_deflate_common_header_eviction(void); ...@@ -31,12 +31,7 @@ void test_nghttp2_hd_deflate_common_header_eviction(void);
void test_nghttp2_hd_inflate_indname_inc(void); void test_nghttp2_hd_inflate_indname_inc(void);
void test_nghttp2_hd_inflate_indname_inc_eviction(void); void test_nghttp2_hd_inflate_indname_inc_eviction(void);
void test_nghttp2_hd_inflate_newname_inc(void); void test_nghttp2_hd_inflate_newname_inc(void);
void test_nghttp2_hd_inflate_indname_subst(void);
void test_nghttp2_hd_inflate_indname_subst_eviction(void);
void test_nghttp2_hd_inflate_indname_subst_eviction_neg(void);
void test_nghttp2_hd_inflate_newname_subst(void);
void test_nghttp2_hd_inflate_clearall_inc(void); void test_nghttp2_hd_inflate_clearall_inc(void);
void test_nghttp2_hd_inflate_clearall_subst(void);
void test_nghttp2_hd_deflate_inflate(void); void test_nghttp2_hd_deflate_inflate(void);
#endif /* NGHTTP2_HD_TEST_H */ #endif /* NGHTTP2_HD_TEST_H */
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