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
4a0dba08
Commit
4a0dba08
authored
Jan 22, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Set Connection: close after graceful shutdown in HTTP/1 upstream
parent
b6857476
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
3 deletions
+49
-3
integration-tests/nghttpx_test.go
integration-tests/nghttpx_test.go
+38
-0
integration-tests/server_tester.go
integration-tests/server_tester.go
+5
-3
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+6
-0
No files found.
integration-tests/nghttpx_test.go
View file @
4a0dba08
...
...
@@ -96,6 +96,44 @@ func TestH1H1ConnectFailure(t *testing.T) {
}
}
func
TestH1H1GracefulShutdown
(
t
*
testing
.
T
)
{
st
:=
newServerTester
(
nil
,
t
,
noopHandler
)
defer
st
.
Close
()
res
,
err
:=
st
.
http1
(
requestParam
{
name
:
"TestH1H1GracefulShutdown-1"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http1() = %v"
,
err
)
}
if
got
,
want
:=
res
.
status
,
200
;
got
!=
want
{
t
.
Errorf
(
"status: %v; want %v"
,
got
,
want
)
}
st
.
cmd
.
Process
.
Signal
(
syscall
.
SIGQUIT
)
res
,
err
=
st
.
http1
(
requestParam
{
name
:
"TestH1H1GracefulShutdown-2"
,
})
if
err
!=
nil
{
t
.
Fatalf
(
"Error st.http1() = %v"
,
err
)
}
if
got
,
want
:=
res
.
status
,
200
;
got
!=
want
{
t
.
Errorf
(
"status: %v; want %v"
,
got
,
want
)
}
if
got
,
want
:=
res
.
connClose
,
true
;
got
!=
want
{
t
.
Errorf
(
"res.connClose: %v; want %v"
,
got
,
want
)
}
want
:=
io
.
EOF
if
_
,
err
:=
st
.
conn
.
Read
(
nil
);
err
==
nil
||
err
!=
want
{
t
.
Errorf
(
"st.conn.Read(): %v; want %v"
,
err
,
want
)
}
}
func
TestH1H2ConnectFailure
(
t
*
testing
.
T
)
{
st
:=
newServerTester
([]
string
{
"--http2-bridge"
},
t
,
noopHandler
)
defer
st
.
Close
()
...
...
integration-tests/server_tester.go
View file @
4a0dba08
...
...
@@ -275,9 +275,10 @@ func (st *serverTester) http1(rp requestParam) (*serverResponse, error) {
resp
.
Body
.
Close
()
res
:=
&
serverResponse
{
status
:
resp
.
StatusCode
,
header
:
resp
.
Header
,
body
:
respBody
,
status
:
resp
.
StatusCode
,
header
:
resp
.
Header
,
body
:
respBody
,
connClose
:
resp
.
Close
,
}
return
res
,
nil
...
...
@@ -534,6 +535,7 @@ type serverResponse struct {
connErr
bool
// true if HTTP/2 connection error
spdyGoAwayErrCode
spdy
.
GoAwayStatus
// status code received in SPDY RST_STREAM
spdyRstErrCode
spdy
.
RstStreamStatus
// status code received in SPDY GOAWAY
connClose
bool
// Conection: close is included in response header in HTTP/1 test
}
func
cloneHeader
(
h
http
.
Header
)
http
.
Header
{
...
...
src/shrpx_https_upstream.cc
View file @
4a0dba08
...
...
@@ -664,6 +664,12 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) {
return
0
;
}
// after graceful shutdown commenced, add connection: close header
// field.
if
(
worker_config
->
graceful_shutdown
)
{
downstream
->
set_response_connection_close
(
true
);
}
// We check downstream->get_response_connection_close() in case when
// the Content-Length is not available.
if
(
!
downstream
->
get_request_connection_close
()
&&
...
...
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