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
13cc3f2f
Commit
13cc3f2f
authored
Feb 25, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src, python: Only produce header_table_size when it is changed
parent
7cf574d0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
python/hpackmake.py
python/hpackmake.py
+5
-2
src/deflatehd.c
src/deflatehd.c
+5
-2
src/inflatehd.c
src/inflatehd.c
+8
-4
No files found.
python/hpackmake.py
View file @
13cc3f2f
...
@@ -15,7 +15,7 @@ import nghttp2
...
@@ -15,7 +15,7 @@ import nghttp2
def
testsuite
(
testdata
,
filename
,
outdir
,
table_size
,
deflate_table_size
):
def
testsuite
(
testdata
,
filename
,
outdir
,
table_size
,
deflate_table_size
):
res
=
{
res
=
{
'draft'
:
5
,
'context'
:
testdata
[
'context'
]
,
'draft'
:
6
,
'description'
:
'''
\
'description'
:
'''
\
Encoded by nghttp2. The basic encoding strategy is described in
\
Encoded by nghttp2. The basic encoding strategy is described in
\
http://lists.w3.org/Archives/Public/ietf-http-wg/2013JulSep/1135.html
\
http://lists.w3.org/Archives/Public/ietf-http-wg/2013JulSep/1135.html
\
...
@@ -28,7 +28,6 @@ result in less bits on the wire.'''
...
@@ -28,7 +28,6 @@ result in less bits on the wire.'''
deflater
.
change_table_size
(
table_size
)
deflater
.
change_table_size
(
table_size
)
for
casenum
,
item
in
enumerate
(
testdata
[
'cases'
]):
for
casenum
,
item
in
enumerate
(
testdata
[
'cases'
]):
outitem
=
{
outitem
=
{
'header_table_size'
:
table_size
,
'headers'
:
item
[
'headers'
]
'headers'
:
item
[
'headers'
]
}
}
casenum
+=
1
casenum
+=
1
...
@@ -37,6 +36,10 @@ result in less bits on the wire.'''
...
@@ -37,6 +36,10 @@ result in less bits on the wire.'''
for
x
in
item
[
'headers'
]]
for
x
in
item
[
'headers'
]]
outitem
[
'wire'
]
=
b2a_hex
(
deflater
.
deflate
(
hdrs
)).
decode
(
'utf-8'
)
outitem
[
'wire'
]
=
b2a_hex
(
deflater
.
deflate
(
hdrs
)).
decode
(
'utf-8'
)
cases
.
append
(
outitem
)
cases
.
append
(
outitem
)
if
cases
:
cases
[
0
][
'header_table_size'
]
=
table_size
res
[
'cases'
]
=
cases
res
[
'cases'
]
=
cases
jsonstr
=
json
.
dumps
(
res
,
indent
=
2
)
jsonstr
=
json
.
dumps
(
res
,
indent
=
2
)
with
open
(
os
.
path
.
join
(
outdir
,
filename
),
'w'
)
as
f
:
with
open
(
os
.
path
.
join
(
outdir
,
filename
),
'w'
)
as
f
:
...
...
src/deflatehd.c
View file @
13cc3f2f
...
@@ -95,8 +95,11 @@ static void output_to_json(nghttp2_hd_deflater *deflater,
...
@@ -95,8 +95,11 @@ static void output_to_json(nghttp2_hd_deflater *deflater,
json_object_set_new
(
obj
,
"wire"
,
json_pack
(
"s#"
,
hex
,
len
*
2
));
json_object_set_new
(
obj
,
"wire"
,
json_pack
(
"s#"
,
hex
,
len
*
2
));
}
}
json_object_set_new
(
obj
,
"headers"
,
dump_headers
(
nva
,
nvlen
));
json_object_set_new
(
obj
,
"headers"
,
dump_headers
(
nva
,
nvlen
));
if
(
seq
==
0
)
{
/* We only change the header table size only once at the beginning */
json_object_set_new
(
obj
,
"header_table_size"
,
json_object_set_new
(
obj
,
"header_table_size"
,
json_integer
(
config
.
table_size
));
json_integer
(
config
.
table_size
));
}
if
(
config
.
dump_header_table
)
{
if
(
config
.
dump_header_table
)
{
json_object_set_new
(
obj
,
"header_table"
,
json_object_set_new
(
obj
,
"header_table"
,
dump_header_table
(
&
deflater
->
ctx
));
dump_header_table
(
&
deflater
->
ctx
));
...
...
src/inflatehd.c
View file @
13cc3f2f
...
@@ -67,7 +67,8 @@ static void decode_hex(uint8_t *dest, const char *src, size_t len)
...
@@ -67,7 +67,8 @@ static void decode_hex(uint8_t *dest, const char *src, size_t len)
}
}
static
void
to_json
(
nghttp2_hd_inflater
*
inflater
,
static
void
to_json
(
nghttp2_hd_inflater
*
inflater
,
json_t
*
headers
,
json_t
*
wire
,
int
seq
)
json_t
*
headers
,
json_t
*
wire
,
int
seq
,
size_t
old_settings_table_size
)
{
{
json_t
*
obj
;
json_t
*
obj
;
...
@@ -75,8 +76,10 @@ static void to_json(nghttp2_hd_inflater *inflater,
...
@@ -75,8 +76,10 @@ static void to_json(nghttp2_hd_inflater *inflater,
json_object_set_new
(
obj
,
"seq"
,
json_integer
(
seq
));
json_object_set_new
(
obj
,
"seq"
,
json_integer
(
seq
));
json_object_set
(
obj
,
"wire"
,
wire
);
json_object_set
(
obj
,
"wire"
,
wire
);
json_object_set
(
obj
,
"headers"
,
headers
);
json_object_set
(
obj
,
"headers"
,
headers
);
if
(
old_settings_table_size
!=
inflater
->
settings_hd_table_bufsize_max
)
{
json_object_set_new
(
obj
,
"header_table_size"
,
json_object_set_new
(
obj
,
"header_table_size"
,
json_integer
(
inflater
->
ctx
.
hd_table_bufsize_max
));
json_integer
(
inflater
->
settings_hd_table_bufsize_max
));
}
if
(
config
.
dump_header_table
)
{
if
(
config
.
dump_header_table
)
{
json_object_set_new
(
obj
,
"header_table"
,
json_object_set_new
(
obj
,
"header_table"
,
dump_header_table
(
&
inflater
->
ctx
));
dump_header_table
(
&
inflater
->
ctx
));
...
@@ -95,6 +98,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq)
...
@@ -95,6 +98,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq)
ssize_t
rv
;
ssize_t
rv
;
nghttp2_nv
nv
;
nghttp2_nv
nv
;
int
inflate_flags
;
int
inflate_flags
;
size_t
old_settings_table_size
=
inflater
->
settings_hd_table_bufsize_max
;
wire
=
json_object_get
(
obj
,
"wire"
);
wire
=
json_object_get
(
obj
,
"wire"
);
if
(
wire
==
NULL
)
{
if
(
wire
==
NULL
)
{
...
@@ -149,7 +153,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq)
...
@@ -149,7 +153,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq)
}
}
assert
(
buflen
==
0
);
assert
(
buflen
==
0
);
nghttp2_hd_inflate_end_headers
(
inflater
);
nghttp2_hd_inflate_end_headers
(
inflater
);
to_json
(
inflater
,
headers
,
wire
,
seq
);
to_json
(
inflater
,
headers
,
wire
,
seq
,
old_settings_table_size
);
json_decref
(
headers
);
json_decref
(
headers
);
free
(
buf
);
free
(
buf
);
return
0
;
return
0
;
...
...
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