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
7be0217b
Commit
7be0217b
authored
Jan 16, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Simplify xff handling
parent
e4816c5b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
src/shrpx_http2_downstream_connection.cc
src/shrpx_http2_downstream_connection.cc
+6
-3
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 @
7be0217b
...
@@ -366,15 +366,18 @@ int Http2DownstreamConnection::push_request_headers() {
...
@@ -366,15 +366,18 @@ int Http2DownstreamConnection::push_request_headers() {
}
}
std
::
string
xff_value
;
std
::
string
xff_value
;
auto
xff
=
req
.
fs
.
header
(
http2
::
HD_X_FORWARDED_FOR
);
auto
xff
=
get_config
()
->
strip_incoming_x_forwarded_for
?
nullptr
:
req
.
fs
.
header
(
http2
::
HD_X_FORWARDED_FOR
);
if
(
get_config
()
->
add_x_forwarded_for
)
{
if
(
get_config
()
->
add_x_forwarded_for
)
{
if
(
xff
&&
!
get_config
()
->
strip_incoming_x_forwarded_for
)
{
if
(
xff
)
{
xff_value
=
(
*
xff
).
value
;
xff_value
=
(
*
xff
).
value
;
xff_value
+=
", "
;
xff_value
+=
", "
;
}
}
xff_value
+=
upstream
->
get_client_handler
()
->
get_ipaddr
();
xff_value
+=
upstream
->
get_client_handler
()
->
get_ipaddr
();
nva
.
push_back
(
http2
::
make_nv_ls
(
"x-forwarded-for"
,
xff_value
));
nva
.
push_back
(
http2
::
make_nv_ls
(
"x-forwarded-for"
,
xff_value
));
}
else
if
(
xff
&&
!
get_config
()
->
strip_incoming_x_forwarded_for
)
{
}
else
if
(
xff
)
{
nva
.
push_back
(
http2
::
make_nv_ls_nocopy
(
"x-forwarded-for"
,
(
*
xff
).
value
));
nva
.
push_back
(
http2
::
make_nv_ls_nocopy
(
"x-forwarded-for"
,
(
*
xff
).
value
));
}
}
...
...
src/shrpx_http_downstream_connection.cc
View file @
7be0217b
...
@@ -331,16 +331,19 @@ int HttpDownstreamConnection::push_request_headers() {
...
@@ -331,16 +331,19 @@ int HttpDownstreamConnection::push_request_headers() {
buf
->
append
(
"
\r\n
"
);
buf
->
append
(
"
\r\n
"
);
}
}
auto
xff
=
req
.
fs
.
header
(
http2
::
HD_X_FORWARDED_FOR
);
auto
xff
=
get_config
()
->
strip_incoming_x_forwarded_for
?
nullptr
:
req
.
fs
.
header
(
http2
::
HD_X_FORWARDED_FOR
);
if
(
get_config
()
->
add_x_forwarded_for
)
{
if
(
get_config
()
->
add_x_forwarded_for
)
{
buf
->
append
(
"X-Forwarded-For: "
);
buf
->
append
(
"X-Forwarded-For: "
);
if
(
xff
&&
!
get_config
()
->
strip_incoming_x_forwarded_for
)
{
if
(
xff
)
{
buf
->
append
((
*
xff
).
value
);
buf
->
append
((
*
xff
).
value
);
buf
->
append
(
", "
);
buf
->
append
(
", "
);
}
}
buf
->
append
(
client_handler_
->
get_ipaddr
());
buf
->
append
(
client_handler_
->
get_ipaddr
());
buf
->
append
(
"
\r\n
"
);
buf
->
append
(
"
\r\n
"
);
}
else
if
(
xff
&&
!
get_config
()
->
strip_incoming_x_forwarded_for
)
{
}
else
if
(
xff
)
{
buf
->
append
(
"X-Forwarded-For: "
);
buf
->
append
(
"X-Forwarded-For: "
);
buf
->
append
((
*
xff
).
value
);
buf
->
append
((
*
xff
).
value
);
buf
->
append
(
"
\r\n
"
);
buf
->
append
(
"
\r\n
"
);
...
...
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