You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will fail because the case of calling req.abort()before'socket' will actually result in no error. Whether we get an error or not is a question of timing.
The current semantics are:
If abort() before req.'socket', emit req.'close'.
If abort() after req.'socket' but before req.'response', emit req.'error'.
If abort() after req.'response', emit req.'close' & res.'aborted'.
My main concern (which breaks the above assumption) is the first scenario here. However, I noticed that fixing this will cause lots of other tests to fail.
What can/should we do about this? At a minimum I'd like to clarify the docs.
My main concern (which breaks the above assumption) is the first scenario here. However, I noticed that fixing this will cause lots of other tests to fail.
// test/parallel/test-http-abort-before-end.js'use strict';constcommon=require('../common');consthttp=require('http');constserver=http.createServer(common.mustNotCall());server.listen(0,common.mustCall(()=>{constreq=http.request({method: 'GET',host: '127.0.0.1',port: server.address().port});req.on('abort',common.mustCall(()=>{server.close();}));// This should error?req.on('error',common.mustNotCall());req.abort();req.end();}));
I actually think the current behavior is fine and it's the assumption that is incorrect. Aborting before the socket is created should not be considered an error condition.
Activity
[-]ClientRequest abort() and ECONNRESET[/-][+]ClientRequest `.abort()` and `ECONNRESET`[/+]ronag commentedon Mar 12, 2020
@nodejs/http @mcollina @lpinca
mcollina commentedon Mar 12, 2020
Which test will fail?
ronag commentedon Mar 13, 2020
e.g.
Full list here https://gist.github.com/ronag/379a377e01eb2dfe43c62d54c0220c1a
jasnell commentedon Mar 13, 2020
I actually think the current behavior is fine and it's the assumption that is incorrect. Aborting before the socket is created should not be considered an error condition.
ronag commentedon Mar 13, 2020
@jasnell: What is your opinion on
abort()anddestroy()behaving differently in this regards? i.e. withdestroy()it is an error condition.http: doc deprecate abort and improve docs
http: doc deprecate abort and improve docs
http: doc deprecate abort and improve docs
http: doc deprecate abort and improve docs
http: doc deprecate abort and improve docs