This commit is contained in:
Tatsuhiro Tsujikawa 2013-07-20 01:28:52 +09:00
parent b92b49f882
commit 68afda92ac
2 changed files with 6 additions and 6 deletions

View File

@ -274,12 +274,12 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
nghttp2_hd_entry *new_ent; nghttp2_hd_entry *new_ent;
size_t room = entry_room(nv->namelen, nv->valuelen); size_t room = entry_room(nv->namelen, nv->valuelen);
if(context->hd_tablelen == context->hd_table_capacity || if(context->hd_tablelen == context->hd_table_capacity ||
room > NGHTTP2_MAX_HD_TABLE_CAPACITY) { room > NGHTTP2_HD_MAX_BUFFER_SIZE) {
return NULL; return NULL;
} }
context->hd_table_bufsize += room; context->hd_table_bufsize += room;
for(i = 0; i < context->hd_tablelen && for(i = 0; i < context->hd_tablelen &&
context->hd_table_bufsize > NGHTTP2_MAX_HD_TABLE_CAPACITY; ++i) { context->hd_table_bufsize > NGHTTP2_HD_MAX_BUFFER_SIZE; ++i) {
nghttp2_hd_entry *ent = context->hd_table[i]; nghttp2_hd_entry *ent = context->hd_table[i];
--ent->ref; --ent->ref;
context->hd_table_bufsize -= entry_room(ent->nv.namelen, ent->nv.valuelen); context->hd_table_bufsize -= entry_room(ent->nv.namelen, ent->nv.valuelen);
@ -319,7 +319,7 @@ static nghttp2_hd_entry* add_hd_table_subst(nghttp2_hd_context *context,
int k; int k;
nghttp2_hd_entry *new_ent; nghttp2_hd_entry *new_ent;
size_t room = entry_room(nv->namelen, nv->valuelen); size_t room = entry_room(nv->namelen, nv->valuelen);
if(room > NGHTTP2_MAX_HD_TABLE_CAPACITY || if(room > NGHTTP2_HD_MAX_BUFFER_SIZE ||
context->hd_tablelen <= subindex) { context->hd_tablelen <= subindex) {
return NULL; return NULL;
} }
@ -329,7 +329,7 @@ static nghttp2_hd_entry* add_hd_table_subst(nghttp2_hd_context *context,
context->hd_table_bufsize += room; context->hd_table_bufsize += room;
k = subindex; k = subindex;
for(i = 0; i < context->hd_tablelen && for(i = 0; i < context->hd_tablelen &&
context->hd_table_bufsize > NGHTTP2_MAX_HD_TABLE_CAPACITY; ++i, --k) { context->hd_table_bufsize > NGHTTP2_HD_MAX_BUFFER_SIZE; ++i, --k) {
nghttp2_hd_entry *ent = context->hd_table[i]; nghttp2_hd_entry *ent = context->hd_table[i];
--ent->ref; --ent->ref;
if(i != subindex) { if(i != subindex) {
@ -730,7 +730,7 @@ static int require_eviction_on_subst(nghttp2_hd_context *context,
{ {
return context->hd_table_bufsize - entry_room(ent->nv.namelen, return context->hd_table_bufsize - entry_room(ent->nv.namelen,
ent->nv.valuelen) + ent->nv.valuelen) +
entry_room(nv->namelen, nv->valuelen) > NGHTTP2_MAX_HD_TABLE_CAPACITY; entry_room(nv->namelen, nv->valuelen) > NGHTTP2_HD_MAX_BUFFER_SIZE;
} }
ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater, ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,

View File

@ -35,7 +35,7 @@
#define NGHTTP2_INITIAL_REFSET_SIZE 128 #define NGHTTP2_INITIAL_REFSET_SIZE 128
#define NGHTTP2_INITIAL_WS_SIZE 128 #define NGHTTP2_INITIAL_WS_SIZE 128
#define NGHTTP2_MAX_HD_TABLE_CAPACITY 4096 #define NGHTTP2_HD_MAX_BUFFER_SIZE 4096
#define NGHTTP2_HD_ENTRY_OVERHEAD 32 #define NGHTTP2_HD_ENTRY_OVERHEAD 32
typedef enum { typedef enum {