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
db8de490
Commit
db8de490
authored
Jan 19, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Omit Forwarded for and by parameter if UNIX domain socket is used
parent
acb38b72
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
13 deletions
+32
-13
src/shrpx_client_handler.cc
src/shrpx_client_handler.cc
+12
-1
src/shrpx_client_handler.h
src/shrpx_client_handler.h
+2
-0
src/shrpx_config.cc
src/shrpx_config.cc
+2
-0
src/shrpx_config.h
src/shrpx_config.h
+4
-0
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+1
-5
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+11
-7
No files found.
src/shrpx_client_handler.cc
View file @
db8de490
...
...
@@ -1133,6 +1133,13 @@ const std::string &ClientHandler::get_forwarded_by() {
return
local_hostport_
;
}
auto
&
listenerconf
=
get_config
()
->
conn
.
listener
;
// For UNIX domain socket listener, just return empty string.
if
(
listenerconf
.
host_unix
)
{
return
local_hostport_
;
}
int
rv
;
sockaddr_union
su
;
socklen_t
addrlen
=
sizeof
(
su
);
...
...
@@ -1158,7 +1165,7 @@ const std::string &ClientHandler::get_forwarded_by() {
local_hostport_
+=
':'
;
}
local_hostport_
+=
util
::
utos
(
get_config
()
->
conn
.
listener
.
port
);
local_hostport_
+=
util
::
utos
(
listenerconf
.
port
);
return
local_hostport_
;
}
...
...
@@ -1168,6 +1175,10 @@ const std::string &ClientHandler::get_forwarded_for() const {
return
forwarded_for_obfuscated_
;
}
if
(
get_config
()
->
conn
.
listener
.
host_unix
)
{
return
EMPTY_STRING
;
}
return
ipaddr_
;
}
...
...
src/shrpx_client_handler.h
View file @
db8de490
...
...
@@ -146,6 +146,8 @@ private:
ev_timer
reneg_shutdown_timer_
;
std
::
unique_ptr
<
Upstream
>
upstream_
;
std
::
unique_ptr
<
std
::
vector
<
ssize_t
>>
pinned_http2sessions_
;
// IP address of client. If UNIX domain socket is used, this is
// "localhost".
std
::
string
ipaddr_
;
std
::
string
port_
;
// The ALPN identifier negotiated for this connection.
...
...
src/shrpx_config.cc
View file @
db8de490
...
...
@@ -71,6 +71,8 @@ Config *mod_config() { return config; }
void
create_config
()
{
config
=
new
Config
();
}
std
::
string
EMPTY_STRING
;
TicketKeys
::~
TicketKeys
()
{
/* Erase keys from memory */
for
(
auto
&
key
:
keys
)
{
...
...
src/shrpx_config.h
View file @
db8de490
...
...
@@ -227,6 +227,10 @@ enum shrpx_forwarded_node_type {
FORWARDED_NODE_IP
,
};
// Used inside function if it has to return const reference to empty
// string without defining empty string each time.
extern
std
::
string
EMPTY_STRING
;
struct
AltSvc
{
AltSvc
()
:
port
(
0
)
{}
...
...
src/shrpx_downstream.cc
View file @
db8de490
...
...
@@ -698,14 +698,10 @@ bool Downstream::get_http2_upgrade_request() const {
response_state_
==
INITIAL
;
}
namespace
{
const
std
::
string
EMPTY
;
}
// namespace
const
std
::
string
&
Downstream
::
get_http2_settings
()
const
{
auto
http2_settings
=
req_
.
fs
.
header
(
http2
::
HD_HTTP2_SETTINGS
);
if
(
!
http2_settings
)
{
return
EMPTY
;
return
EMPTY
_STRING
;
}
return
http2_settings
->
value
;
}
...
...
src/shrpx_ssl.cc
View file @
db8de490
...
...
@@ -751,15 +751,19 @@ ClientHandler *accept_connection(Worker *worker, int fd, sockaddr *addr,
char
host
[
NI_MAXHOST
];
char
service
[
NI_MAXSERV
];
int
rv
;
rv
=
getnameinfo
(
addr
,
addrlen
,
host
,
sizeof
(
host
),
service
,
sizeof
(
service
),
NI_NUMERICHOST
|
NI_NUMERICSERV
);
if
(
rv
!=
0
)
{
LOG
(
ERROR
)
<<
"getnameinfo() failed: "
<<
gai_strerror
(
rv
);
return
nullptr
;
}
if
(
addr
->
sa_family
==
AF_UNIX
)
{
std
::
copy_n
(
"localhost"
,
sizeof
(
"localhost"
),
host
);
service
[
0
]
=
'\0'
;
}
else
{
rv
=
getnameinfo
(
addr
,
addrlen
,
host
,
sizeof
(
host
),
service
,
sizeof
(
service
),
NI_NUMERICHOST
|
NI_NUMERICSERV
);
if
(
rv
!=
0
)
{
LOG
(
ERROR
)
<<
"getnameinfo() failed: "
<<
gai_strerror
(
rv
);
return
nullptr
;
}
if
(
addr
->
sa_family
!=
AF_UNIX
)
{
rv
=
util
::
make_socket_nodelay
(
fd
);
if
(
rv
==
-
1
)
{
LOG
(
WARN
)
<<
"Setting option TCP_NODELAY failed: errno="
<<
errno
;
...
...
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