-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
pause() on response of http.request() causes 'aborted' event, and ClientRequest.abort() resumes the response. #10961
Comments
You get that 'aborted' event because the server closes the connection while paused on your end, not because you call
Can you explain why you expect that? Why shouldn't |
No, the server didn't close the connection prematurely. As I said above, Wireshark showed that the complete response was received without problem, regardless the 'aborted' event. Do you think 'aborted' event should be fired in this case? I don't think so.
Just run the test code above and you'll see the problem always.
Yeah, the request should have died (but seemed not according to Wireshark), but |
I didn't use the word 'prematurely.'
No strong opinion. If you want to see it changed, you should present a compelling reason why. Keep in mind there is probably code out there that depends on the current behavior. |
'Abort', by defination, is premature. No? If you don't think so, please explain what is aborted in this case, exactly? The problem is, l can't tell the difference between premature and normal closing of the connection if pause() is called. lf this behavior can't be changed, l'd ask to add a new event to act as what 'aborted' should do. |
P.S., l am still not sure about the exact behavior of 'aborted' event. No matter it can be changed or not, it need to be documented in detail. |
@nodejs/http |
This was fixed in 1980a36#diff-e3bc37430eb078ccbafe3aa3b570c91a |
Test case:
Actual result (stdout):
Note that "on aborted" happens almost immediately after
res.pause()
.Expected result:
No "aborted" event is fired if the response is not acutally aborted, and
ClientRequest.abort()
shouldn't resume the response.I use Wireshark to monitor the traffic, and there is nothing wrong with the response, even if I don't call
req.abort()
.The text was updated successfully, but these errors were encountered: