From 22df6f4190b3c19e56ac7fbe347f566fc3d6f219 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 26 Oct 2013 23:30:48 +0900 Subject: [PATCH] nghttp2_hd: Fix bug on local_hd_table_bufsize_max > hd_table_bufsize_max --- lib/nghttp2_hd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index e0381b49..faa85b07 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -804,10 +804,6 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context, free(new_ent); return NULL; } - if(context->role == NGHTTP2_HD_ROLE_DEFLATE) { - context->local_hd_table_bufsize += room; - ++context->local_hd_tablelen; - } } if(room > context->hd_table_bufsize_max) { /* The entry taking more than NGHTTP2_HD_MAX_BUFFER_SIZE is @@ -817,6 +813,11 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context, context->hd_table_bufsize += room; new_ent->flags |= NGHTTP2_HD_FLAG_REFSET; nghttp2_hd_ringbuf_push_front(&context->hd_table, new_ent); + if(context->role == NGHTTP2_HD_ROLE_DEFLATE && + room <= context->local_hd_table_bufsize_max) { + context->local_hd_table_bufsize += room; + ++context->local_hd_tablelen; + } } return new_ent; }