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
ae053333
Commit
ae053333
authored
Feb 01, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shrpx: Relay Connection: upgrade header field for HTTP/1.1 connections
parent
d9611e65
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+8
-2
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+8
-2
No files found.
src/shrpx_http_downstream_connection.cc
View file @
ae053333
...
...
@@ -118,14 +118,18 @@ int HttpDownstreamConnection::push_request_headers()
hdrs
+=
downstream_
->
get_request_path
();
hdrs
+=
" "
;
hdrs
+=
"HTTP/1.1
\r\n
"
;
bool
connection_upgrade
=
false
;
std
::
string
via_value
;
std
::
string
xff_value
;
const
Headers
&
request_headers
=
downstream_
->
get_request_headers
();
for
(
Headers
::
const_iterator
i
=
request_headers
.
begin
();
i
!=
request_headers
.
end
();
++
i
)
{
if
(
util
::
strieq
((
*
i
).
first
.
c_str
(),
"X-Forwarded-Proto"
)
||
if
(
util
::
strieq
((
*
i
).
first
.
c_str
(),
"connection"
))
{
if
(
util
::
strifind
((
*
i
).
second
.
c_str
(),
"upgrade"
))
{
connection_upgrade
=
true
;
}
}
else
if
(
util
::
strieq
((
*
i
).
first
.
c_str
(),
"X-Forwarded-Proto"
)
||
util
::
strieq
((
*
i
).
first
.
c_str
(),
"keep-alive"
)
||
util
::
strieq
((
*
i
).
first
.
c_str
(),
"connection"
)
||
util
::
strieq
((
*
i
).
first
.
c_str
(),
"proxy-connection"
))
{
continue
;
}
...
...
@@ -149,6 +153,8 @@ int HttpDownstreamConnection::push_request_headers()
}
if
(
downstream_
->
get_request_connection_close
())
{
hdrs
+=
"Connection: close
\r\n
"
;
}
else
if
(
connection_upgrade
)
{
hdrs
+=
"Connection: upgrade
\r\n
"
;
}
if
(
get_config
()
->
add_x_forwarded_for
)
{
hdrs
+=
"X-Forwarded-For: "
;
...
...
src/shrpx_https_upstream.cc
View file @
ae053333
...
...
@@ -594,6 +594,7 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream)
if
(
LOG_ENABLED
(
INFO
))
{
DLOG
(
INFO
,
downstream
)
<<
"HTTP response header completed"
;
}
bool
connection_upgrade
=
false
;
std
::
string
via_value
;
char
temp
[
16
];
snprintf
(
temp
,
sizeof
(
temp
),
"HTTP/%d.%d "
,
...
...
@@ -604,8 +605,11 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream)
hdrs
+=
"
\r\n
"
;
for
(
Headers
::
const_iterator
i
=
downstream
->
get_response_headers
().
begin
();
i
!=
downstream
->
get_response_headers
().
end
();
++
i
)
{
if
(
util
::
strieq
((
*
i
).
first
.
c_str
(),
"keep-alive"
)
||
// HTTP/1.0?
util
::
strieq
((
*
i
).
first
.
c_str
(),
"connection"
)
||
if
(
util
::
strieq
((
*
i
).
first
.
c_str
(),
"connection"
))
{
if
(
util
::
strifind
((
*
i
).
second
.
c_str
(),
"upgrade"
))
{
connection_upgrade
=
true
;
}
}
else
if
(
util
::
strieq
((
*
i
).
first
.
c_str
(),
"keep-alive"
)
||
// HTTP/1.0?
util
::
strieq
((
*
i
).
first
.
c_str
(),
"proxy-connection"
))
{
// These are ignored
}
else
if
(
!
get_config
()
->
no_via
&&
...
...
@@ -628,6 +632,8 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream)
downstream
->
get_request_minor
()
<=
0
)
{
// We add this header for HTTP/1.0 or HTTP/0.9 clients
hdrs
+=
"Connection: Keep-Alive
\r\n
"
;
}
else
if
(
connection_upgrade
)
{
hdrs
+=
"Connection: upgrade
\r\n
"
;
}
}
else
{
hdrs
+=
"Connection: close
\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