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
4807e71b
Commit
4807e71b
authored
Aug 18, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Fix bug that api and healthmon params do not work with http2 proxy
parent
09c647fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
10 deletions
+18
-10
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+6
-3
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+7
-6
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+5
-1
No files found.
src/shrpx_http2_upstream.cc
View file @
4807e71b
...
...
@@ -306,8 +306,11 @@ int Http2Upstream::on_request_headers(Downstream *downstream,
return
0
;
}
// For HTTP/2 proxy, we request :authority.
if
(
method_token
!=
HTTP_CONNECT
&&
get_config
()
->
http2_proxy
&&
!
authority
)
{
auto
faddr
=
handler_
->
get_upstream_addr
();
// For HTTP/2 proxy, we require :authority.
if
(
method_token
!=
HTTP_CONNECT
&&
get_config
()
->
http2_proxy
&&
!
faddr
->
alt_mode
&&
!
authority
)
{
rst_stream
(
downstream
,
NGHTTP2_PROTOCOL_ERROR
);
return
0
;
}
...
...
@@ -331,7 +334,7 @@ int Http2Upstream::on_request_headers(Downstream *downstream,
if
(
method_token
==
HTTP_OPTIONS
&&
path
->
value
==
StringRef
::
from_lit
(
"*"
))
{
// Server-wide OPTIONS request. Path is empty.
}
else
if
(
get_config
()
->
http2_proxy
)
{
}
else
if
(
get_config
()
->
http2_proxy
&&
!
faddr
->
alt_mode
)
{
req
.
path
=
path
->
value
;
}
else
{
req
.
path
=
http2
::
rewrite_clean_path
(
downstream
->
get_block_allocator
(),
...
...
src/shrpx_https_upstream.cc
View file @
4807e71b
...
...
@@ -202,7 +202,7 @@ int htp_hdr_valcb(http_parser *htp, const char *data, size_t len) {
namespace
{
void
rewrite_request_host_path_from_uri
(
BlockAllocator
&
balloc
,
Request
&
req
,
const
StringRef
&
uri
,
http_parser_url
&
u
)
{
http_parser_url
&
u
,
bool
http2_proxy
)
{
assert
(
u
.
field_set
&
(
1
<<
UF_HOST
));
// As per https://tools.ietf.org/html/rfc7230#section-5.4, we
...
...
@@ -271,7 +271,7 @@ void rewrite_request_host_path_from_uri(BlockAllocator &balloc, Request &req,
}
}
if
(
get_config
()
->
http2_proxy
)
{
if
(
http2_proxy
)
{
req
.
path
=
path
;
}
else
{
req
.
path
=
http2
::
rewrite_clean_path
(
balloc
,
path
);
...
...
@@ -338,6 +338,7 @@ int htp_hdrs_completecb(http_parser *htp) {
downstream
->
inspect_http1_request
();
auto
faddr
=
handler
->
get_upstream_addr
();
auto
&
balloc
=
downstream
->
get_block_allocator
();
if
(
method
!=
HTTP_CONNECT
)
{
...
...
@@ -349,7 +350,7 @@ int htp_hdrs_completecb(http_parser *htp) {
}
// checking UF_HOST could be redundant, but just in case ...
if
(
!
(
u
.
field_set
&
(
1
<<
UF_SCHEMA
))
||
!
(
u
.
field_set
&
(
1
<<
UF_HOST
)))
{
if
(
get_config
()
->
http2_proxy
)
{
if
(
get_config
()
->
http2_proxy
&&
!
faddr
->
alt_mode
)
{
// Request URI should be absolute-form for client proxy mode
return
-
1
;
}
...
...
@@ -372,7 +373,9 @@ int htp_hdrs_completecb(http_parser *htp) {
req
.
scheme
=
StringRef
::
from_lit
(
"http"
);
}
}
else
{
rewrite_request_host_path_from_uri
(
balloc
,
req
,
req
.
path
,
u
);
rewrite_request_host_path_from_uri
(
balloc
,
req
,
req
.
path
,
u
,
get_config
()
->
http2_proxy
&&
!
faddr
->
alt_mode
);
}
}
...
...
@@ -411,8 +414,6 @@ int htp_hdrs_completecb(http_parser *htp) {
return
-
1
;
}
auto
faddr
=
handler
->
get_upstream_addr
();
if
(
faddr
->
alt_mode
)
{
// Normally, we forward expect: 100-continue to backend server,
// and let them decide whether responds with 100 Continue or not.
...
...
src/shrpx_spdy_upstream.cc
View file @
4807e71b
...
...
@@ -267,7 +267,11 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
}
else
{
req
.
scheme
=
scheme
->
value
;
req
.
authority
=
host
->
value
;
if
(
get_config
()
->
http2_proxy
)
{
auto
handler
=
upstream
->
get_client_handler
();
auto
faddr
=
handler
->
get_upstream_addr
();
if
(
get_config
()
->
http2_proxy
&&
!
faddr
->
alt_mode
)
{
req
.
path
=
path
->
value
;
}
else
if
(
method_token
==
HTTP_OPTIONS
&&
path
->
value
==
StringRef
::
from_lit
(
"*"
))
{
...
...
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