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
7c8cb3a0
Commit
7c8cb3a0
authored
Oct 04, 2018
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Improve CONNECT response status handling
parent
334c439c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
18 deletions
+10
-18
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+6
-14
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+1
-1
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+2
-2
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+1
-1
No files found.
src/shrpx_downstream.cc
View file @
7c8cb3a0
...
...
@@ -764,19 +764,11 @@ bool Downstream::validate_response_recv_body_length() const {
}
void
Downstream
::
check_upgrade_fulfilled_http2
()
{
if
(
req_
.
method
==
HTTP_CONNECT
)
{
// This handles nonzero req_.connect_proto as well.
upgraded_
=
200
<=
resp_
.
http_status
&&
resp_
.
http_status
<
300
;
return
;
}
if
(
req_
.
connect_proto
==
CONNECT_PROTO_WEBSOCKET
)
{
// h1 frontend requests WebSocket upgrade
upgraded_
=
resp_
.
http_status
==
200
;
return
;
}
// This handles nonzero req_.connect_proto and h1 frontend requests
// WebSocket upgrade.
upgraded_
=
(
req_
.
method
==
HTTP_CONNECT
||
req_
.
connect_proto
==
CONNECT_PROTO_WEBSOCKET
)
&&
resp_
.
http_status
/
100
==
2
;
}
void
Downstream
::
check_upgrade_fulfilled_http1
()
{
...
...
@@ -798,7 +790,7 @@ void Downstream::check_upgrade_fulfilled_http1() {
upgraded_
=
expected
!=
""
&&
expected
==
accept
->
value
;
}
else
{
upgraded_
=
200
<=
resp_
.
http_status
&&
resp_
.
http_status
<
300
;
upgraded_
=
resp_
.
http_status
/
100
==
2
;
}
return
;
...
...
src/shrpx_http2_session.cc
View file @
7c8cb3a0
...
...
@@ -620,7 +620,7 @@ int htp_hdrs_completecb(http_parser *htp) {
http_parser_pause
(
htp
,
1
);
// We just check status code here
if
(
htp
->
status_code
==
200
)
{
if
(
htp
->
status_code
/
100
==
2
)
{
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
http2session
)
<<
"Tunneling success"
;
}
...
...
src/shrpx_http_downstream_connection.cc
View file @
7c8cb3a0
...
...
@@ -938,7 +938,7 @@ int htp_hdrs_completecb(http_parser *htp) {
// Server MUST NOT send Transfer-Encoding with a status code 1xx or
// 204. Also server MUST NOT send Transfer-Encoding with a status
// code 2
00
to a CONNECT request. Same holds true with
// code 2
xx
to a CONNECT request. Same holds true with
// Content-Length.
if
(
resp
.
http_status
==
204
)
{
if
(
resp
.
fs
.
header
(
http2
::
HD_TRANSFER_ENCODING
))
{
...
...
@@ -960,7 +960,7 @@ int htp_hdrs_completecb(http_parser *htp) {
return
-
1
;
}
}
else
if
(
resp
.
http_status
/
100
==
1
||
(
resp
.
http_status
==
200
&&
req
.
method
==
HTTP_CONNECT
))
{
(
resp
.
http_status
/
100
==
2
&&
req
.
method
==
HTTP_CONNECT
))
{
if
(
resp
.
fs
.
header
(
http2
::
HD_CONTENT_LENGTH
)
||
resp
.
fs
.
header
(
http2
::
HD_TRANSFER_ENCODING
))
{
return
-
1
;
...
...
src/shrpx_https_upstream.cc
View file @
7c8cb3a0
...
...
@@ -1147,7 +1147,7 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) {
if
(
!
connect_method
&&
downstream
->
get_upgraded
())
{
if
(
req
.
connect_proto
==
CONNECT_PROTO_WEBSOCKET
&&
resp
.
http_status
==
200
)
{
resp
.
http_status
/
100
==
2
)
{
buf
->
append
(
"Upgrade: websocket
\r\n
Connection: Upgrade
\r\n
"
);
auto
key
=
req
.
fs
.
header
(
http2
::
HD_SEC_WEBSOCKET_KEY
);
if
(
!
key
||
key
->
value
.
size
()
!=
base64
::
encode_length
(
16
))
{
...
...
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