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
a42cb136
Commit
a42cb136
authored
Jan 21, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hpackmake.py: Add option parser
parent
201ab1a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
python/hpackmake.py
python/hpackmake.py
+19
-6
No files found.
python/hpackmake.py
View file @
a42cb136
...
...
@@ -9,11 +9,11 @@
# exist, otherwise the script will fail. The output filename is the
# same as the input filename.
#
import
sys
,
base64
,
json
,
os
.
path
import
sys
,
base64
,
json
,
os
.
path
,
os
,
argparse
,
errno
from
binascii
import
b2a_hex
import
nghttp2
def
testsuite
(
testdata
,
filename
):
def
testsuite
(
testdata
,
filename
,
outdir
,
table_size
):
if
testdata
[
'context'
]
==
'request'
:
side
=
nghttp2
.
HD_SIDE_REQUEST
else
:
...
...
@@ -30,9 +30,10 @@ result in less bits on the wire.'''
}
cases
=
[]
deflater
=
nghttp2
.
HDDeflater
(
side
)
deflater
.
change_table_size
(
table_size
)
for
casenum
,
item
in
enumerate
(
testdata
[
'cases'
]):
outitem
=
{
'header_table_size'
:
4096
,
'header_table_size'
:
table_size
,
'headers'
:
item
[
'headers'
]
}
casenum
+=
1
...
...
@@ -43,12 +44,24 @@ result in less bits on the wire.'''
cases
.
append
(
outitem
)
res
[
'cases'
]
=
cases
jsonstr
=
json
.
dumps
(
res
,
indent
=
2
)
with
open
(
os
.
path
.
join
(
'out'
,
filename
),
'w'
)
as
f
:
with
open
(
os
.
path
.
join
(
outdir
,
filename
),
'w'
)
as
f
:
f
.
write
(
jsonstr
)
if
__name__
==
'__main__'
:
for
filename
in
sys
.
argv
[
1
:]:
ap
=
argparse
.
ArgumentParser
(
description
=
'HPACK test case generator'
)
ap
.
add_argument
(
'-d'
,
'--dir'
,
help
=
'output directory'
,
default
=
'out'
)
ap
.
add_argument
(
'-s'
,
'--table-size'
,
help
=
'max header table size'
,
type
=
int
,
default
=
4096
)
ap
.
add_argument
(
'file'
,
nargs
=
'*'
,
help
=
'input file'
)
args
=
ap
.
parse_args
()
try
:
os
.
mkdir
(
args
.
dir
)
except
OSError
as
e
:
if
e
.
errno
!=
errno
.
EEXIST
:
raise
e
for
filename
in
args
.
file
:
sys
.
stderr
.
write
(
'{}
\n
'
.
format
(
filename
))
with
open
(
filename
)
as
f
:
input
=
f
.
read
()
testsuite
(
json
.
loads
(
input
),
os
.
path
.
basename
(
filename
))
testsuite
(
json
.
loads
(
input
),
os
.
path
.
basename
(
filename
),
args
.
dir
,
args
.
table_size
)
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