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
de0543f6
Commit
de0543f6
authored
Mar 13, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Refactor a bit
parent
46e3be7b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
src/shrpx_http2_downstream_connection.cc
src/shrpx_http2_downstream_connection.cc
+5
-4
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+6
-3
No files found.
src/shrpx_http2_downstream_connection.cc
View file @
de0543f6
...
@@ -261,15 +261,16 @@ int Http2DownstreamConnection::push_request_headers() {
...
@@ -261,15 +261,16 @@ int Http2DownstreamConnection::push_request_headers() {
// http2session_ has already in CONNECTED state, so we can get
// http2session_ has already in CONNECTED state, so we can get
// addr_idx here.
// addr_idx here.
auto
addr_idx
=
http2session_
->
get_addr_idx
();
auto
addr_idx
=
http2session_
->
get_addr_idx
();
auto
&
downstream_addr
=
get_config
()
->
downstream_addrs
[
addr_idx
];
auto
downstream_hostport
=
get_config
()
->
downstream_addrs
[
addr_idx
].
hostport
.
get
();
const
char
*
authority
=
nullptr
,
*
host
=
nullptr
;
const
char
*
authority
=
nullptr
,
*
host
=
nullptr
;
if
(
!
no_host_rewrite
)
{
if
(
!
no_host_rewrite
)
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
authority
=
downstream_
addr
.
hostport
.
get
()
;
authority
=
downstream_
hostport
;
}
}
if
(
downstream_
->
get_request_header
(
http2
::
HD_HOST
))
{
if
(
downstream_
->
get_request_header
(
http2
::
HD_HOST
))
{
host
=
downstream_
addr
.
hostport
.
get
()
;
host
=
downstream_
hostport
;
}
}
}
else
{
}
else
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
...
@@ -284,7 +285,7 @@ int Http2DownstreamConnection::push_request_headers() {
...
@@ -284,7 +285,7 @@ int Http2DownstreamConnection::push_request_headers() {
if
(
!
authority
&&
!
host
)
{
if
(
!
authority
&&
!
host
)
{
// upstream is HTTP/1.0. We use backend server's host
// upstream is HTTP/1.0. We use backend server's host
// nonetheless.
// nonetheless.
host
=
downstream_
addr
.
hostport
.
get
()
;
host
=
downstream_
hostport
;
}
}
if
(
authority
)
{
if
(
authority
)
{
...
...
src/shrpx_http_downstream_connection.cc
View file @
de0543f6
...
@@ -211,14 +211,17 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
...
@@ -211,14 +211,17 @@ int HttpDownstreamConnection::attach_downstream(Downstream *downstream) {
int
HttpDownstreamConnection
::
push_request_headers
()
{
int
HttpDownstreamConnection
::
push_request_headers
()
{
const
char
*
authority
=
nullptr
,
*
host
=
nullptr
;
const
char
*
authority
=
nullptr
,
*
host
=
nullptr
;
auto
downstream_hostport
=
get_config
()
->
downstream_addrs
[
addr_idx_
].
hostport
.
get
();
if
(
!
get_config
()
->
no_host_rewrite
&&
!
get_config
()
->
http2_proxy
&&
if
(
!
get_config
()
->
no_host_rewrite
&&
!
get_config
()
->
http2_proxy
&&
!
get_config
()
->
client_proxy
&&
!
get_config
()
->
client_proxy
&&
downstream_
->
get_request_method
()
!=
"CONNECT"
)
{
downstream_
->
get_request_method
()
!=
"CONNECT"
)
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
authority
=
get_config
()
->
downstream_addrs
[
addr_idx_
].
hostport
.
get
()
;
authority
=
downstream_hostport
;
}
}
if
(
downstream_
->
get_request_header
(
http2
::
HD_HOST
))
{
if
(
downstream_
->
get_request_header
(
http2
::
HD_HOST
))
{
host
=
get_config
()
->
downstream_addrs
[
addr_idx_
].
hostport
.
get
()
;
host
=
downstream_hostport
;
}
}
}
else
{
}
else
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
if
(
!
downstream_
->
get_request_http2_authority
().
empty
())
{
...
@@ -233,7 +236,7 @@ int HttpDownstreamConnection::push_request_headers() {
...
@@ -233,7 +236,7 @@ int HttpDownstreamConnection::push_request_headers() {
if
(
!
authority
&&
!
host
)
{
if
(
!
authority
&&
!
host
)
{
// upstream is HTTP/1.0. We use backend server's host
// upstream is HTTP/1.0. We use backend server's host
// nonetheless.
// nonetheless.
host
=
get_config
()
->
downstream_addrs
[
addr_idx_
].
hostport
.
get
()
;
host
=
downstream_hostport
;
}
}
if
(
authority
)
{
if
(
authority
)
{
...
...
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