nghttp2_hd_deflate_bound: Take into account possible 2nd context update

This commit is contained in:
Tatsuhiro Tsujikawa 2014-07-26 01:12:19 +09:00
parent 8d5422c9bb
commit 0752ce6701
2 changed files with 4 additions and 3 deletions

View File

@ -1136,8 +1136,9 @@ size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater,
size_t i; size_t i;
/* Possible Maximum Header Table Size Change. Encoding (1u << 31) - /* Possible Maximum Header Table Size Change. Encoding (1u << 31) -
1 using 4 bit prefix requires 6 bytes. */ 1 using 4 bit prefix requires 6 bytes. We may emit this at most
n += 6; twice. */
n += 12;
/* Use Literal Header Field without indexing - New Name, since it is /* Use Literal Header Field without indexing - New Name, since it is
most space consuming format. Also we choose the less one between most space consuming format. Also we choose the less one between

View File

@ -1081,7 +1081,7 @@ void test_nghttp2_hd_deflate_bound(void)
bound = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva)); bound = nghttp2_hd_deflate_bound(&deflater, nva, ARRLEN(nva));
CU_ASSERT(6 + 6 * 2 * 2 + CU_ASSERT(12 + 6 * 2 * 2 +
nva[0].namelen + nva[0].valuelen + nva[0].namelen + nva[0].valuelen +
nva[1].namelen + nva[1].valuelen nva[1].namelen + nva[1].valuelen
== bound); == bound);