Fix socket.destroySoon() problem with http module. #5

Merged
merged 1 commit into from Dec 13, 2012

Projects

None yet

3 participants

@hayeah
hayeah commented Dec 13, 2012

Problems:

If http request is not keepAlive, upon responseEnd, destroySoon
is used to close the response stream. destroySoon does not exist
for SocksClientSocket.

For the above condition, the http.js code expects the socket
to be not writable after returning from destroySoon.

Fixes:

Add destroySoon method to SocksClientSocket
destroySoon sets writable to false.

@hayeah hayeah Fix socket.destroySoon() problem with http module.
Problems:

If http request is not keepAlive, upon responseEnd, destroySoon
is used to close the response stream. destroySoon does not exist
for SocksClientSocket.

For the above condition, the http.js code expects the socket
to be not writable after returning from destroySoon.

Fixes:

Add destroySoon method to SocksClientSocket
destroySoon sets writable to false.
25d668b
@hayeah
hayeah commented Dec 13, 2012

I am not sure what the http module is doing. See the relevant code here:

https://github.com/joyent/node/blob/0506d294dc5a51556e935a50a754aa7cbd7a7977/lib/http.js#L1497

This change shims our custom socket to behave as the http expects it.

@vially vially merged commit 2a91396 into vially:master Dec 13, 2012
@vially
Owner
vially commented Dec 13, 2012

Merged.

Cheers!
Valentin

@gebrits
gebrits commented Jun 20, 2013

Is this in NPM? I'm getting the same error: Object # has no method 'destroySoon'
(Node 0.8.22 FWIW)

@vially
Owner
vially commented Jun 20, 2013

Nope. It's not on NPM yet. I'll try to push a new version over the next couple of days.

@gebrits
gebrits commented Jun 20, 2013

cool cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment