Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
2e5c7f59
Commit
2e5c7f59
authored
May 11, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug HPACK deflater does not send context update after table size change
parent
4fffd23d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
18 deletions
+30
-18
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+18
-12
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+3
-0
python/hpackmake.py
python/hpackmake.py
+5
-2
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+4
-4
No files found.
lib/nghttp2_hd.c
View file @
2e5c7f59
...
...
@@ -326,7 +326,16 @@ int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater,
return
rv
;
}
deflater
->
no_refset
=
0
;
if
(
deflate_hd_table_bufsize_max
<
NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE
)
{
deflater
->
notify_table_size_change
=
1
;
deflater
->
ctx
.
hd_table_bufsize_max
=
deflate_hd_table_bufsize_max
;
}
else
{
deflater
->
notify_table_size_change
=
0
;
}
deflater
->
deflate_hd_table_bufsize_max
=
deflate_hd_table_bufsize_max
;
return
0
;
}
...
...
@@ -968,14 +977,10 @@ int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
return
rv
;
}
deflater
->
ctx
.
hd_table_bufsize_max
=
settings_hd_table_bufsize_max
;
deflater
->
ctx
.
hd_table_bufsize_max
=
next_bufsize
;
deflater
->
notify_table_size_change
=
1
;
if
(
settings_hd_table_bufsize_max
>=
deflater
->
deflate_hd_table_bufsize_max
)
{
/* On the next encoding, we sends encoding context update with
deflater->deflate_hd_table_bufsize_max if it is strictly
smaller than settings_hd_table_bufsize_max. */
return
0
;
}
hd_context_shrink_table_size
(
&
deflater
->
ctx
);
return
0
;
}
...
...
@@ -1217,14 +1222,15 @@ int nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater,
return
NGHTTP2_ERR_HEADER_COMP
;
}
if
(
deflater
->
ctx
.
hd_table_bufsize_max
>
deflater
->
deflate_hd_table_bufsize_max
)
{
rv
=
emit_table_size
(
bufs
,
deflater
->
deflate_hd_table_bufsize_max
);
if
(
deflater
->
notify_table_size_change
)
{
deflater
->
notify_table_size_change
=
0
;
rv
=
emit_table_size
(
bufs
,
deflater
->
ctx
.
hd_table_bufsize_max
);
if
(
rv
!=
0
)
{
goto
fail
;
}
deflater
->
ctx
.
hd_table_bufsize_max
=
deflater
->
deflate_hd_table_bufsize_max
;
}
if
(
deflater
->
no_refset
)
{
...
...
lib/nghttp2_hd.h
View file @
2e5c7f59
...
...
@@ -139,6 +139,9 @@ typedef struct {
/* Set to this nonzero to clear reference set on each deflation each
time. */
uint8_t
no_refset
;
/* If nonzero, send header table size using encoding context update
in the next deflate process */
uint8_t
notify_table_size_change
;
}
nghttp2_hd_deflater
;
struct
nghttp2_hd_inflater
{
...
...
python/hpackmake.py
View file @
2e5c7f59
...
...
@@ -25,7 +25,10 @@ result in less bits on the wire.'''
}
cases
=
[]
deflater
=
nghttp2
.
HDDeflater
(
deflate_table_size
)
deflater
.
change_table_size
(
table_size
)
if
table_size
!=
4096
:
deflater
.
change_table_size
(
table_size
)
for
casenum
,
item
in
enumerate
(
testdata
[
'cases'
]):
outitem
=
{
'seqno'
:
casenum
,
...
...
@@ -38,7 +41,7 @@ result in less bits on the wire.'''
outitem
[
'wire'
]
=
b2a_hex
(
deflater
.
deflate
(
hdrs
)).
decode
(
'utf-8'
)
cases
.
append
(
outitem
)
if
cases
:
if
cases
and
table_size
!=
4096
:
cases
[
0
][
'header_table_size'
]
=
table_size
res
[
'cases'
]
=
cases
...
...
tests/nghttp2_hd_test.c
View file @
2e5c7f59
...
...
@@ -664,7 +664,7 @@ void test_nghttp2_hd_change_table_size(void)
CU_ASSERT
(
0
==
nghttp2_hd_deflate_change_table_size
(
&
deflater
,
8000
));
CU_ASSERT
(
127
==
deflater
.
ctx
.
hd_table
.
mask
);
CU_ASSERT
(
8000
==
deflater
.
ctx
.
hd_table_bufsize_max
);
CU_ASSERT
(
4096
==
deflater
.
ctx
.
hd_table_bufsize_max
);
CU_ASSERT
(
255
==
inflater
.
ctx
.
hd_table
.
mask
);
CU_ASSERT
(
8000
==
inflater
.
ctx
.
hd_table_bufsize_max
);
...
...
@@ -702,7 +702,7 @@ void test_nghttp2_hd_change_table_size(void)
blocklen
=
nghttp2_bufs_len
(
&
bufs
);
CU_ASSERT
(
0
==
rv
);
CU_ASSERT
(
0
==
blocklen
);
CU_ASSERT
(
blocklen
>
0
);
CU_ASSERT
(
2
==
deflater
.
ctx
.
hd_table
.
len
);
CU_ASSERT
(
1024
==
deflater
.
ctx
.
hd_table_bufsize_max
);
...
...
@@ -784,7 +784,7 @@ void test_nghttp2_hd_change_table_size(void)
CU_ASSERT
(
0
==
nghttp2_hd_deflate_change_table_size
(
&
deflater
,
16383
));
CU_ASSERT
(
255
==
deflater
.
ctx
.
hd_table
.
mask
);
CU_ASSERT
(
16383
==
deflater
.
ctx
.
hd_table_bufsize_max
);
CU_ASSERT
(
8192
==
deflater
.
ctx
.
hd_table_bufsize_max
);
CU_ASSERT
(
511
==
inflater
.
ctx
.
hd_table
.
mask
);
CU_ASSERT
(
16383
==
inflater
.
ctx
.
hd_table_bufsize_max
);
...
...
@@ -824,7 +824,7 @@ void test_nghttp2_hd_change_table_size(void)
nghttp2_hd_inflate_init
(
&
inflater
);
CU_ASSERT
(
127
==
deflater
.
ctx
.
hd_table
.
mask
);
CU_ASSERT
(
4096
==
deflater
.
ctx
.
hd_table_bufsize_max
);
CU_ASSERT
(
1024
==
deflater
.
ctx
.
hd_table_bufsize_max
);
/* This emits context update with buffer size 1024 */
rv
=
nghttp2_hd_deflate_hd
(
&
deflater
,
&
bufs
,
nva
,
2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment