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 is a problem found inrequest, in which I also post an issue, but after a few days tracking, we found that it is not an issue with request module itself, but _http_client.js or net.js, even tcp_wrap.cc. What is strange is the proxy server sent a FIN packet to me after a Connect response, and I cannot receive end event, but when there is an error on ClientRequest, I can receive a end event as expected.
Please see the code in _http_client.js:
in socketOnData funciton, the condition path related to Connect behavior. if there is listener of Connect or Upgrade, just emit, else destroy.
else if (parser.incoming && parser.incoming.upgrade) {
// Upgrade or CONNECT
var bytesParsed = ret;
var res = parser.incoming;
req.res = res;
socket.removeListener('data', socketOnData);
socket.removeListener('end', socketOnEnd);
parser.finish();
var bodyHead = d.slice(bytesParsed, d.length);
var eventName = req.method === 'CONNECT' ? 'connect' : 'upgrade';
if (req.listenerCount(eventName) > 0) {
req.upgradeOrConnect = true;
// detach the socket
socket.emit('agentRemove');
socket.removeListener('close', socketCloseListener);
socket.removeListener('error', socketErrorListener);
// TODO(isaacs): Need a way to reset a stream to fresh state
// IE, not flowing, and not explicitly paused.
socket._readableState.flowing = null;
req.emit(eventName, res, socket, bodyHead);
req.emit('close');
} else {
// Got Upgrade header or CONNECT method, but have no handler.
socket.destroy();
}
freeParser(parser, req, socket);
As I said above, in my script, I got Connect event correctly, but the server sent FIN packet to me after that, and I cannot get end event, why? follow is the document of net_event_end, Anybody can help?
Thanks very much.
The text was updated successfully, but these errors were encountered:
Can you post steps to reproduce or do you have a standalone (preferably minimal) test case we can try? It shouldn't use anything but core modules.
Also, did you search the bug tracker for similar reports? I remember there have been one or two but they turned out to be resource leaks in the application, not bugs in node.js.
This is a problem found in
request
, in which I also post an issue, but after a few days tracking, we found that it is not an issue with request module itself, but_http_client.js
ornet.js
, eventcp_wrap.cc
. What is strange is the proxy server sent a FIN packet to me after aConnect
response, and I cannot receiveend
event, but when there is an error on ClientRequest, I can receive aend
event as expected.Please see the code in
_http_client.js
:in
socketOnData
funciton, the condition path related toConnect
behavior. if there is listener of Connect or Upgrade, just emit, else destroy.As I said above, in my script, I got
Connect
event correctly, but the server sent FIN packet to me after that, and I cannot getend
event, why? follow is the document of net_event_end, Anybody can help?Thanks very much.
The text was updated successfully, but these errors were encountered: