Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for chunked transfers #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

derjust
Copy link

@derjust derjust commented Jan 8, 2016

Chunked transfers are not handled properly and time out while the transfer is still ongoing.

With this patchset, each messageChunk is considered a heart beat and resetting the timeout scheduler.

@@ -55,7 +56,27 @@ class RequestAccessLogger(ctx: RequestContext, accessLogger: AccessLogger,
accessLogger.logAccess(request, response, timeStampCalculator(Unit))
forwardMsgAndStop(response)
}
case Confirmed(ChunkedResponseStart(response), sentAck) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it safe to assume these will always be Confirmed?

ie sent via responder ! MessageChunk.withAck(sentAck)?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could re-write this case as:

case confirmed@Confirmed(ChunkResponseStart(response), _) => {
chunkedResponse = response
responder forward confirmed
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed & covers now also un-ACKed

@derjust
Copy link
Author

derjust commented Jan 8, 2016

Added withAck() and case-handling for non-acked usage

Chunked transfers are not handled properly and time out while the
transfer is still ongoing.
With this patchset, each messageChunk is considered a heart beat and
resetting the timeout scheduler.
case confirmed@Confirmed(ChunkedResponseStart(response), _) => handleChunkedResponseStart(confirmed, response)
case unconfirmed@ChunkedResponseStart(response) => handleChunkedResponseStart(unconfirmed, response)

case confirmed@(Confirmed(MessageChunk(_,_), _) | MessageChunk) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice pattern match

@kristomasette
Copy link

FWIW I'm 👍

derjust added 2 commits March 13, 2016 17:46
This commit adds a connection abort in case of a timeout happens
during a chunked transfer:
A reasonable tear down and/or sending any content to the client is
impossible as we have already started to transmit data.
Thus it is impossible to predict how a client would treat any 'appened'
error message to the stream anyway - and trailing headers are not
supported by any reasonable HTTP client library out there.

Therefore the connection is just aborted to get back to a "definied
state".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants