Information about the issue and the suggested solution in this comment.
Changes
Clean code about "baking" requests. Now, each request is handling its own response.
Add close event to the input stream, in order to do the cleaning tasks even if the output stream is closed without reading anything (the end event is not triggered). For example, when a 304 response is obtained by the client.
Add a random value to the temporal file name to avoid problems with concurrent requests.
Resources
Context
Changes
close
event to the input stream, in order to do the cleaning tasks even if the output stream is closed without reading anything (theend
event is not triggered). For example, when a 304 response is obtained by the client.