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
230b1f92
Commit
230b1f92
authored
Sep 15, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use hash table for dynamic table lookup
parent
4ac8edfe
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
249 additions
and
104 deletions
+249
-104
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+217
-100
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+19
-2
mkstatichdtbl.py
mkstatichdtbl.py
+13
-2
No files found.
lib/nghttp2_hd.c
View file @
230b1f92
This diff is collapsed.
Click to expand it.
lib/nghttp2_hd.h
View file @
230b1f92
...
...
@@ -126,15 +126,25 @@ typedef enum {
NGHTTP2_HD_FLAG_VALUE_GIFT
=
1
<<
3
}
nghttp2_hd_flags
;
typedef
struct
{
struct
nghttp2_hd_entry
;
typedef
struct
nghttp2_hd_entry
nghttp2_hd_entry
;
struct
nghttp2_hd_entry
{
nghttp2_nv
nv
;
/* The next entry which shares same bucket in hash table. */
nghttp2_hd_entry
*
next
;
/* The sequence number. We will increment it by one whenever we
store nghttp2_hd_entry to dynamic header table. */
uint32_t
seq
;
/* The hash value for header name (nv.name). */
uint32_t
hash
;
/* nghttp2_token value for nv.name. It could be -1 if we have no
token for that header field name. */
int
token
;
/* Reference count */
uint8_t
ref
;
uint8_t
flags
;
}
nghttp2_hd_entry
;
};
typedef
struct
{
nghttp2_hd_entry
**
buffer
;
...
...
@@ -183,14 +193,21 @@ typedef struct {
size_t
hd_table_bufsize
;
/* The effective header table size. */
size_t
hd_table_bufsize_max
;
/* Next sequence number for nghttp2_hd_entry */
uint32_t
next_seq
;
/* If inflate/deflate error occurred, this value is set to 1 and
further invocation of inflate/deflate will fail with
NGHTTP2_ERR_HEADER_COMP. */
uint8_t
bad
;
}
nghttp2_hd_context
;
#define HD_MAP_SIZE 128
typedef
struct
{
nghttp2_hd_entry
*
table
[
HD_MAP_SIZE
];
}
nghttp2_hd_map
;
struct
nghttp2_hd_deflater
{
nghttp2_hd_context
ctx
;
nghttp2_hd_map
map
;
/* The upper limit of the header table size the deflater accepts. */
size_t
deflate_hd_table_bufsize_max
;
/* Minimum header table size notified in the next context update */
...
...
mkstatichdtbl.py
View file @
230b1f92
...
...
@@ -10,6 +10,17 @@
from
__future__
import
unicode_literals
import
re
,
sys
def
hd_map_hash
(
name
):
h
=
2166136261
# FNV hash variant: http://isthe.com/chongo/tech/comp/fnv/
for
c
in
name
:
h
^=
ord
(
c
)
h
*=
16777619
h
&=
0xffffffff
return
h
entries
=
[]
for
line
in
sys
.
stdin
:
m
=
re
.
match
(
r'(\d+)\s+(\S+)\s+(\S.*)?'
,
line
)
...
...
@@ -21,6 +32,6 @@ idx = 0
for
i
,
ent
in
enumerate
(
entries
):
if
entries
[
idx
][
1
]
!=
ent
[
1
]:
idx
=
i
print
'MAKE_STATIC_ENT("{}", "{}", {}),'
\
.
format
(
ent
[
1
],
ent
[
2
],
entries
[
idx
][
0
]
-
1
)
print
'MAKE_STATIC_ENT("{}", "{}", {}
, {}u
),'
\
.
format
(
ent
[
1
],
ent
[
2
],
entries
[
idx
][
0
]
-
1
,
hd_map_hash
(
ent
[
1
])
)
print
'};'
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