Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
ab00b687
Commit
ab00b687
authored
Oct 27, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close idle HTTP connections on server drain.
Previously we only closed immediately after a response finished.
parent
97aad141
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
http.c++
c++/src/kj/compat/http.c++
+10
-4
No files found.
c++/src/kj/compat/http.c++
View file @
ab00b687
...
...
@@ -3295,8 +3295,9 @@ public:
if
(
!
firstRequest
)
{
// For requests after the first, require that the first byte arrive before the pipeline
// timeout, otherwise treat it like the connection was simply closed.
firstByte
=
firstByte
.
exclusiveJoin
(
server
.
timer
.
afterDelay
(
server
.
settings
.
pipelineTimeout
)
firstByte
=
firstByte
.
exclusiveJoin
(
server
.
timer
.
afterDelay
(
server
.
settings
.
pipelineTimeout
)
.
exclusiveJoin
(
server
.
onDrain
.
addBranch
())
.
then
([
this
]()
->
bool
{
timedOut
=
true
;
return
false
;
...
...
@@ -3328,8 +3329,9 @@ public:
if
(
firstRequest
)
{
// On the first request, the header timeout starts ticking immediately upon request opening.
receivedHeaders
=
receivedHeaders
.
exclusiveJoin
(
server
.
timer
.
afterDelay
(
server
.
settings
.
headerTimeout
)
receivedHeaders
=
receivedHeaders
.
exclusiveJoin
(
server
.
timer
.
afterDelay
(
server
.
settings
.
headerTimeout
)
.
exclusiveJoin
(
server
.
onDrain
.
addBranch
())
.
then
([
this
]()
->
kj
::
Maybe
<
HttpHeaders
::
Request
>
{
timedOut
=
true
;
return
nullptr
;
...
...
@@ -3352,6 +3354,10 @@ public:
// request is in-flight when we close... if it's a GET, the browser should retry. But if
// it's a POST, retrying may be dangerous. This is why 408 exists -- it unambiguously
// tells the client that it should retry.)
//
// Also note that if we ever decide to send 408 again, we might want to send some other
// error in the case that the server is draining, which also sets timedOut = true; see
// above.
return
httpOutput
.
flush
();
}
...
...
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