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
ea0ab938
Commit
ea0ab938
authored
Jan 03, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Only index header in lowercase
parent
9763ea76
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
31 deletions
+31
-31
genheaderfunc.py
genheaderfunc.py
+4
-4
src/http2.cc
src/http2.cc
+27
-27
No files found.
genheaderfunc.py
View file @
ea0ab938
...
...
@@ -54,22 +54,22 @@ enum {'''
def
gen_index_header
():
print
'''
\
void index_header(int *hdidx, const uint8_t *
s, size_t
len, size_t idx) {
switch (len) {'''
void index_header(int *hdidx, const uint8_t *
name, size_t name
len, size_t idx) {
switch (
name
len) {'''
b
=
build_header
(
HEADERS
)
for
size
in
sorted
(
b
.
keys
()):
ents
=
b
[
size
]
print
'''
\
case {}:'''
.
format
(
size
)
print
'''
\
switch (util::lowcase(
s[
len - 1])) {'''
switch (util::lowcase(
name[name
len - 1])) {'''
for
c
in
sorted
(
ents
.
keys
()):
headers
=
sorted
(
ents
[
c
])
print
'''
\
case '{}':'''
.
format
(
c
)
for
k
in
headers
:
print
'''
\
if (util::str
ieq("{}", s
, {})) {{
if (util::str
eq("{}", name
, {})) {{
hdidx[{}] = idx;
return;
}}'''
.
format
(
k
[:
-
1
],
size
-
1
,
to_enum_hd
(
k
))
...
...
src/http2.cc
View file @
ea0ab938
...
...
@@ -576,12 +576,12 @@ void init_hdidx(int *hdidx) { memset(hdidx, -1, sizeof(hdidx[0]) * HD_MAXIDX); }
// This function was generated by genheaderfunc.py. Inspired by h2o
// header lookup. https://github.com/h2o/h2o
void
index_header
(
int
*
hdidx
,
const
uint8_t
*
s
,
size_t
len
,
size_t
idx
)
{
switch
(
len
)
{
void
index_header
(
int
*
hdidx
,
const
uint8_t
*
name
,
size_t
name
len
,
size_t
idx
)
{
switch
(
name
len
)
{
case
2
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
'e'
:
if
(
util
::
str
ieq
(
"t"
,
s
,
1
))
{
if
(
util
::
str
eq
(
"t"
,
name
,
1
))
{
hdidx
[
HD_TE
]
=
idx
;
return
;
}
...
...
@@ -589,9 +589,9 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
4
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
't'
:
if
(
util
::
str
ieq
(
"hos"
,
s
,
3
))
{
if
(
util
::
str
eq
(
"hos"
,
name
,
3
))
{
hdidx
[
HD_HOST
]
=
idx
;
return
;
}
...
...
@@ -599,9 +599,9 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
5
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
'h'
:
if
(
util
::
str
ieq
(
":pat"
,
s
,
4
))
{
if
(
util
::
str
eq
(
":pat"
,
name
,
4
))
{
hdidx
[
HD_PATH
]
=
idx
;
return
;
}
...
...
@@ -609,9 +609,9 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
6
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
't'
:
if
(
util
::
str
ieq
(
"expec"
,
s
,
5
))
{
if
(
util
::
str
eq
(
"expec"
,
name
,
5
))
{
hdidx
[
HD_EXPECT
]
=
idx
;
return
;
}
...
...
@@ -619,19 +619,19 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
7
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
'd'
:
if
(
util
::
str
ieq
(
":metho"
,
s
,
6
))
{
if
(
util
::
str
eq
(
":metho"
,
name
,
6
))
{
hdidx
[
HD_METHOD
]
=
idx
;
return
;
}
break
;
case
'e'
:
if
(
util
::
str
ieq
(
":schem"
,
s
,
6
))
{
if
(
util
::
str
eq
(
":schem"
,
name
,
6
))
{
hdidx
[
HD_SCHEME
]
=
idx
;
return
;
}
if
(
util
::
str
ieq
(
"upgrad"
,
s
,
6
))
{
if
(
util
::
str
eq
(
"upgrad"
,
name
,
6
))
{
hdidx
[
HD_UPGRADE
]
=
idx
;
return
;
}
...
...
@@ -639,21 +639,21 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
10
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
'e'
:
if
(
util
::
str
ieq
(
"keep-aliv"
,
s
,
9
))
{
if
(
util
::
str
eq
(
"keep-aliv"
,
name
,
9
))
{
hdidx
[
HD_KEEP_ALIVE
]
=
idx
;
return
;
}
break
;
case
'n'
:
if
(
util
::
str
ieq
(
"connectio"
,
s
,
9
))
{
if
(
util
::
str
eq
(
"connectio"
,
name
,
9
))
{
hdidx
[
HD_CONNECTION
]
=
idx
;
return
;
}
break
;
case
'y'
:
if
(
util
::
str
ieq
(
":authorit"
,
s
,
9
))
{
if
(
util
::
str
eq
(
":authorit"
,
name
,
9
))
{
hdidx
[
HD_AUTHORITY
]
=
idx
;
return
;
}
...
...
@@ -661,9 +661,9 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
16
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
'n'
:
if
(
util
::
str
ieq
(
"proxy-connectio"
,
s
,
15
))
{
if
(
util
::
str
eq
(
"proxy-connectio"
,
name
,
15
))
{
hdidx
[
HD_PROXY_CONNECTION
]
=
idx
;
return
;
}
...
...
@@ -671,15 +671,15 @@ void index_header(int *hdidx, const uint8_t *s, size_t len, size_t idx) {
}
break
;
case
17
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
switch
(
util
::
lowcase
(
name
[
name
len
-
1
]))
{
case
'e'
:
if
(
util
::
str
ieq
(
"if-modified-sinc"
,
s
,
16
))
{
if
(
util
::
str
eq
(
"if-modified-sinc"
,
name
,
16
))
{
hdidx
[
HD_IF_MODIFIED_SINCE
]
=
idx
;
return
;
}
break
;
case
'g'
:
if
(
util
::
str
ieq
(
"transfer-encodin"
,
s
,
16
))
{
if
(
util
::
str
eq
(
"transfer-encodin"
,
name
,
16
))
{
hdidx
[
HD_TRANSFER_ENCODING
]
=
idx
;
return
;
}
...
...
@@ -695,7 +695,7 @@ bool check_http2_request_pseudo_header(int *hdidx, const uint8_t *s,
case
5
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
case
'h'
:
if
(
util
::
str
i
eq
(
":pat"
,
s
,
4
))
{
if
(
util
::
streq
(
":pat"
,
s
,
4
))
{
if
(
hdidx
[
HD_PATH
]
!=
-
1
)
{
return
false
;
}
...
...
@@ -707,7 +707,7 @@ bool check_http2_request_pseudo_header(int *hdidx, const uint8_t *s,
case
7
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
case
'd'
:
if
(
util
::
str
i
eq
(
":metho"
,
s
,
6
))
{
if
(
util
::
streq
(
":metho"
,
s
,
6
))
{
if
(
hdidx
[
HD_METHOD
]
!=
-
1
)
{
return
false
;
}
...
...
@@ -715,7 +715,7 @@ bool check_http2_request_pseudo_header(int *hdidx, const uint8_t *s,
}
break
;
case
'e'
:
if
(
util
::
str
i
eq
(
":schem"
,
s
,
6
))
{
if
(
util
::
streq
(
":schem"
,
s
,
6
))
{
if
(
hdidx
[
HD_SCHEME
]
!=
-
1
)
{
return
false
;
}
...
...
@@ -727,7 +727,7 @@ bool check_http2_request_pseudo_header(int *hdidx, const uint8_t *s,
case
10
:
switch
(
util
::
lowcase
(
s
[
len
-
1
]))
{
case
'y'
:
if
(
util
::
str
i
eq
(
":authorit"
,
s
,
9
))
{
if
(
util
::
streq
(
":authorit"
,
s
,
9
))
{
if
(
hdidx
[
HD_AUTHORITY
]
!=
-
1
)
{
return
false
;
}
...
...
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