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
6761a933
Unverified
Commit
6761a933
authored
Jan 14, 2018
by
Tatsuhiro Tsujikawa
Committed by
GitHub
Jan 14, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1105 from nghttp2/nghttpx-upgrade-scheme
nghttpx: Add upgrade-scheme parameter to backend option
parents
652f57e7
5cc3d159
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
5 deletions
+33
-5
src/shrpx.cc
src/shrpx.cc
+7
-0
src/shrpx_config.cc
src/shrpx_config.cc
+4
-0
src/shrpx_config.h
src/shrpx_config.h
+4
-0
src/shrpx_http2_downstream_connection.cc
src/shrpx_http2_downstream_connection.cc
+8
-1
src/shrpx_worker.cc
src/shrpx_worker.cc
+6
-4
src/shrpx_worker.h
src/shrpx_worker.h
+4
-0
No files found.
src/shrpx.cc
View file @
6761a933
...
...
@@ -1815,6 +1815,13 @@ Connections:
"redirect-if-no-tls" parameter to all backends
explicitly if this feature is desired.
If "upgrade-scheme" parameter is used along with "tls"
parameter, HTTP/2 :scheme pseudo header field is changed
to "https" from "http" when forwarding a request to this
particular backend. This is a workaround for a backend
server which requires "https" :scheme pseudo header
field on TLS encrypted connection.
Since ";" and ":" are used as delimiter, <PATTERN> must
not contain these characters. Since ";" has special
meaning in shell, the option value must be quoted.
...
...
src/shrpx_config.cc
View file @
6761a933
...
...
@@ -814,6 +814,7 @@ struct DownstreamParams {
bool
tls
;
bool
dns
;
bool
redirect_if_not_tls
;
bool
upgrade_scheme
;
};
namespace
{
...
...
@@ -918,6 +919,8 @@ int parse_downstream_params(DownstreamParams &out,
out
.
dns
=
true
;
}
else
if
(
util
::
strieq_l
(
"redirect-if-not-tls"
,
param
))
{
out
.
redirect_if_not_tls
=
true
;
}
else
if
(
util
::
strieq_l
(
"upgrade-scheme"
,
param
))
{
out
.
upgrade_scheme
=
true
;
}
else
if
(
!
param
.
empty
())
{
LOG
(
ERROR
)
<<
"backend: "
<<
param
<<
": unknown keyword"
;
return
-
1
;
...
...
@@ -977,6 +980,7 @@ int parse_mapping(Config *config, DownstreamAddrConfig &addr,
addr
.
tls
=
params
.
tls
;
addr
.
sni
=
make_string_ref
(
downstreamconf
.
balloc
,
params
.
sni
);
addr
.
dns
=
params
.
dns
;
addr
.
upgrade_scheme
=
params
.
upgrade_scheme
;
auto
&
routerconf
=
downstreamconf
.
router
;
auto
&
router
=
routerconf
.
router
;
...
...
src/shrpx_config.h
View file @
6761a933
...
...
@@ -461,6 +461,10 @@ struct DownstreamAddrConfig {
bool
tls
;
// true if dynamic DNS is enabled
bool
dns
;
// true if :scheme pseudo header field should be upgraded to secure
// variant (e.g., "https") when forwarding request to a backend
// connected by TLS connection.
bool
upgrade_scheme
;
};
// Mapping hash to idx which is an index into
...
...
src/shrpx_http2_downstream_connection.cc
View file @
6761a933
...
...
@@ -291,7 +291,14 @@ int Http2DownstreamConnection::push_request_headers() {
if
(
req
.
method
!=
HTTP_CONNECT
)
{
assert
(
!
req
.
scheme
.
empty
());
nva
.
push_back
(
http2
::
make_nv_ls_nocopy
(
":scheme"
,
req
.
scheme
));
auto
addr
=
http2session_
->
get_addr
();
assert
(
addr
);
// We will handle more protocol scheme upgrade in the future.
if
(
addr
->
tls
&&
addr
->
upgrade_scheme
&&
req
.
scheme
==
"http"
)
{
nva
.
push_back
(
http2
::
make_nv_ll
(
":scheme"
,
"https"
));
}
else
{
nva
.
push_back
(
http2
::
make_nv_ls_nocopy
(
":scheme"
,
req
.
scheme
));
}
if
(
req
.
method
==
HTTP_OPTIONS
&&
req
.
path
.
empty
())
{
nva
.
push_back
(
http2
::
make_nv_ll
(
":path"
,
"*"
));
...
...
src/shrpx_worker.cc
View file @
6761a933
...
...
@@ -70,10 +70,10 @@ void proc_wev_cb(struct ev_loop *loop, ev_timer *w, int revents) {
// DownstreamKey is used to index SharedDownstreamAddr in order to
// find the same configuration.
using
DownstreamKey
=
std
::
tuple
<
std
::
vector
<
std
::
tuple
<
StringRef
,
StringRef
,
size_t
,
size_t
,
shrpx_proto
,
uint16_t
,
bool
,
bool
,
bool
>>
,
bool
,
int
,
StringRef
,
StringRef
,
int
>
;
using
DownstreamKey
=
std
::
tuple
<
std
::
vector
<
std
::
tuple
<
StringRef
,
StringRef
,
size_t
,
size_t
,
shrpx_proto
,
uint16_t
,
bool
,
bool
,
bool
,
bool
>>
,
bool
,
int
,
StringRef
,
StringRef
,
int
>
;
namespace
{
DownstreamKey
create_downstream_key
(
...
...
@@ -93,6 +93,7 @@ DownstreamKey create_downstream_key(
std
::
get
<
6
>
(
*
p
)
=
a
.
host_unix
;
std
::
get
<
7
>
(
*
p
)
=
a
.
tls
;
std
::
get
<
8
>
(
*
p
)
=
a
.
dns
;
std
::
get
<
9
>
(
*
p
)
=
a
.
upgrade_scheme
;
++
p
;
}
std
::
sort
(
std
::
begin
(
addrs
),
std
::
end
(
addrs
));
...
...
@@ -220,6 +221,7 @@ void Worker::replace_downstream_config(
dst_addr
.
fall
=
src_addr
.
fall
;
dst_addr
.
rise
=
src_addr
.
rise
;
dst_addr
.
dns
=
src_addr
.
dns
;
dst_addr
.
upgrade_scheme
=
src_addr
.
upgrade_scheme
;
auto
shared_addr_ptr
=
shared_addr
.
get
();
...
...
src/shrpx_worker.h
View file @
6761a933
...
...
@@ -115,6 +115,10 @@ struct DownstreamAddr {
bool
tls
;
// true if dynamic DNS is enabled
bool
dns
;
// true if :scheme pseudo header field should be upgraded to secure
// variant (e.g., "https") when forwarding request to a backend
// connected by TLS connection.
bool
upgrade_scheme
;
};
// Simplified weighted fair queuing. Actually we don't use queue here
...
...
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