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
cee22df0
Commit
cee22df0
authored
Jan 21, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Always close connection in HttpsUpstream::error_reply
parent
e219d6a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+6
-12
No files found.
src/shrpx_https_upstream.cc
View file @
cee22df0
...
...
@@ -306,7 +306,6 @@ int HttpsUpstream::on_read() {
assert
(
downstream
);
if
(
downstream
->
get_request_state
()
==
Downstream
::
CONNECT_FAIL
)
{
handler
->
set_should_close_after_write
(
true
);
// Following paues_read is needed to avoid reading next data.
pause_read
(
SHRPX_MSG_BLOCK
);
error_reply
(
503
);
...
...
@@ -349,7 +348,6 @@ int HttpsUpstream::on_read() {
<<
http_errno_description
(
htperr
);
}
handler
->
set_should_close_after_write
(
true
);
pause_read
(
SHRPX_MSG_BLOCK
);
unsigned
int
status_code
;
...
...
@@ -465,7 +463,6 @@ int HttpsUpstream::downstream_read(DownstreamConnection *dconn) {
}
if
(
downstream
->
get_response_state
()
==
Downstream
::
MSG_BAD_HEADER
)
{
handler_
->
set_should_close_after_write
(
true
);
error_reply
(
502
);
downstream
->
pop_downstream_connection
();
goto
end
;
...
...
@@ -532,7 +529,6 @@ int HttpsUpstream::downstream_eof(DownstreamConnection *dconn) {
if
(
LOG_ENABLED
(
INFO
))
{
DCLOG
(
INFO
,
dconn
)
<<
"Return error reply"
;
}
handler_
->
set_should_close_after_write
(
true
);
error_reply
(
502
);
downstream
->
pop_downstream_connection
();
goto
end
;
...
...
@@ -560,8 +556,6 @@ int HttpsUpstream::downstream_error(DownstreamConnection *dconn, int events) {
return
-
1
;
}
handler_
->
set_should_close_after_write
(
true
);
unsigned
int
status
;
if
(
events
&
Downstream
::
EVENT_TIMEOUT
)
{
status
=
504
;
...
...
@@ -586,6 +580,10 @@ void HttpsUpstream::error_reply(unsigned int status_code) {
}
downstream
->
set_response_http_status
(
status_code
);
// we are going to close connection for both frontend and backend in
// error condition. This is safest option.
downstream
->
set_response_connection_close
(
true
);
handler_
->
set_should_close_after_write
(
true
);
auto
output
=
downstream
->
get_response_buf
();
...
...
@@ -597,11 +595,8 @@ void HttpsUpstream::error_reply(unsigned int status_code) {
output
->
append_cstr
(
"
\r\n
Content-Length: "
);
auto
cl
=
util
::
utos
(
html
.
size
());
output
->
append
(
cl
.
c_str
(),
cl
.
size
());
output
->
append_cstr
(
"
\r\n
Content-Type: text/html; charset=UTF-8
\r\n
"
);
if
(
get_client_handler
()
->
get_should_close_after_write
())
{
output
->
append_cstr
(
"Connection: close
\r\n
"
);
}
output
->
append_cstr
(
"
\r\n
"
);
output
->
append_cstr
(
"
\r\n
Content-Type: text/html; "
"charset=UTF-8
\r\n
Connection: close
\r\n\r\n
"
);
output
->
append
(
html
.
c_str
(),
html
.
size
());
downstream
->
add_response_sent_bodylen
(
html
.
size
());
...
...
@@ -797,7 +792,6 @@ int HttpsUpstream::on_downstream_body_complete(Downstream *downstream) {
int
HttpsUpstream
::
on_downstream_abort_request
(
Downstream
*
downstream
,
unsigned
int
status_code
)
{
handler_
->
set_should_close_after_write
(
true
);
error_reply
(
status_code
);
handler_
->
signal_write
();
return
0
;
...
...
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