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
88f0bc70
Commit
88f0bc70
authored
Feb 08, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Reworkd inherited request headers in PUSH_PROMISE
parent
b14cfaf3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
18 deletions
+45
-18
genheaderfunc.py
genheaderfunc.py
+4
-2
src/http2.cc
src/http2.cc
+24
-6
src/http2.h
src/http2.h
+4
-2
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+13
-8
No files found.
genheaderfunc.py
View file @
88f0bc70
...
...
@@ -21,9 +21,11 @@ HEADERS = [
"content-length"
,
"location"
,
"trailer"
,
"referer"
,
"link"
,
"accept"
,
"accept-encoding"
,
"accept-language"
,
"cache-control"
,
"user-agent"
,
# disallowed h1 headers
'connection'
,
'keep-alive'
,
...
...
src/http2.cc
View file @
88f0bc70
...
...
@@ -478,9 +478,6 @@ int lookup_token(const uint8_t *name, size_t namelen) {
}
break
;
case
't'
:
if
(
util
::
streq
(
"accep"
,
name
,
5
))
{
return
HD_ACCEPT
;
}
if
(
util
::
streq
(
"expec"
,
name
,
5
))
{
return
HD_EXPECT
;
}
...
...
@@ -508,9 +505,6 @@ int lookup_token(const uint8_t *name, size_t namelen) {
}
break
;
case
'r'
:
if
(
util
::
streq
(
"refere"
,
name
,
6
))
{
return
HD_REFERER
;
}
if
(
util
::
streq
(
"traile"
,
name
,
6
))
{
return
HD_TRAILER
;
}
...
...
@@ -543,6 +537,11 @@ int lookup_token(const uint8_t *name, size_t namelen) {
return
HD_CONNECTION
;
}
break
;
case
't'
:
if
(
util
::
streq
(
"user-agen"
,
name
,
9
))
{
return
HD_USER_AGENT
;
}
break
;
case
'y'
:
if
(
util
::
streq
(
":authorit"
,
name
,
9
))
{
return
HD__AUTHORITY
;
...
...
@@ -550,6 +549,15 @@ int lookup_token(const uint8_t *name, size_t namelen) {
break
;
}
break
;
case
13
:
switch
(
name
[
namelen
-
1
])
{
case
'l'
:
if
(
util
::
streq
(
"cache-contro"
,
name
,
12
))
{
return
HD_CACHE_CONTROL
;
}
break
;
}
break
;
case
14
:
switch
(
name
[
namelen
-
1
])
{
case
'h'
:
...
...
@@ -566,6 +574,16 @@ int lookup_token(const uint8_t *name, size_t namelen) {
break
;
case
15
:
switch
(
name
[
namelen
-
1
])
{
case
'e'
:
if
(
util
::
streq
(
"accept-languag"
,
name
,
14
))
{
return
HD_ACCEPT_LANGUAGE
;
}
break
;
case
'g'
:
if
(
util
::
streq
(
"accept-encodin"
,
name
,
14
))
{
return
HD_ACCEPT_ENCODING
;
}
break
;
case
'r'
:
if
(
util
::
streq
(
"x-forwarded-fo"
,
name
,
14
))
{
return
HD_X_FORWARDED_FOR
;
...
...
src/http2.h
View file @
88f0bc70
...
...
@@ -195,8 +195,10 @@ enum {
HD__PATH
,
HD__SCHEME
,
HD__STATUS
,
HD_ACCEPT
,
HD_ACCEPT_ENCODING
,
HD_ACCEPT_LANGUAGE
,
HD_ALT_SVC
,
HD_CACHE_CONTROL
,
HD_CONNECTION
,
HD_CONTENT_LENGTH
,
HD_COOKIE
,
...
...
@@ -208,12 +210,12 @@ enum {
HD_LINK
,
HD_LOCATION
,
HD_PROXY_CONNECTION
,
HD_REFERER
,
HD_SERVER
,
HD_TE
,
HD_TRAILER
,
HD_TRANSFER_ENCODING
,
HD_UPGRADE
,
HD_USER_AGENT
,
HD_VIA
,
HD_X_FORWARDED_FOR
,
HD_X_FORWARDED_PROTO
,
...
...
src/shrpx_http2_upstream.cc
View file @
88f0bc70
...
...
@@ -568,6 +568,9 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame,
downstream
->
set_request_path
({
nv
.
value
,
nv
.
value
+
nv
.
valuelen
});
break
;
}
downstream
->
add_request_header
(
nv
.
name
,
nv
.
namelen
,
nv
.
value
,
nv
.
valuelen
,
nv
.
flags
&
NGHTTP2_NV_FLAG_NO_INDEX
,
token
);
}
downstream
->
inspect_http2_request
();
...
...
@@ -1588,6 +1591,16 @@ int Http2Upstream::submit_push_promise(const std::string &path,
nva
.
reserve
(
downstream
->
get_request_headers
().
size
());
for
(
auto
&
kv
:
downstream
->
get_request_headers
())
{
switch
(
kv
.
token
)
{
// TODO generate referer
case
http2
:
:
HD__AUTHORITY
:
case
http2
:
:
HD__SCHEME
:
case
http2
:
:
HD_ACCEPT_ENCODING
:
case
http2
:
:
HD_ACCEPT_LANGUAGE
:
case
http2
:
:
HD_CACHE_CONTROL
:
case
http2
:
:
HD_HOST
:
case
http2
:
:
HD_USER_AGENT
:
nva
.
push_back
(
http2
::
make_nv
(
kv
.
name
,
kv
.
value
,
kv
.
no_index
));
break
;
case
http2
:
:
HD__METHOD
:
// juse use "GET" for now
nva
.
push_back
(
http2
::
make_nv_lc
(
":method"
,
"GET"
));
...
...
@@ -1595,15 +1608,7 @@ int Http2Upstream::submit_push_promise(const std::string &path,
case
http2
:
:
HD__PATH
:
nva
.
push_back
(
http2
::
make_nv_ls
(
":path"
,
path
));
continue
;
case
http2
:
:
HD_ACCEPT
:
// browser tends to change accept header field value depending
// on requesting resource. So just omit it for now.
continue
;
case
http2
:
:
HD_REFERER
:
// TODO construct referer
continue
;
}
nva
.
push_back
(
http2
::
make_nv
(
kv
.
name
,
kv
.
value
,
kv
.
no_index
));
}
rv
=
nghttp2_submit_push_promise
(
session_
,
NGHTTP2_FLAG_NONE
,
...
...
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