Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

https2 breaks compatibility with https1 #1531

Closed
mmalecki opened this issue Aug 14, 2011 · 10 comments
Closed

https2 breaks compatibility with https1 #1531

mmalecki opened this issue Aug 14, 2011 · 10 comments
Labels

Comments

@mmalecki
Copy link

This bug was originally spotted in npm, issue isaacs/npm#1198.

When using new https2, callback from line https://github.com/isaacs/npm/blob/master/lib/utils/fetch.js#L87 doesn't get executed, because of set agent parameter.

https2 checks only for undefined agent value (https://github.com/joyent/node/blob/master/lib/https2.js#L69 ), while https1 checked for false (https://github.com/joyent/node/blob/master/lib/https.js#L96 ) as well.
(Spotted by @thejh)

Test case is here: https://gist.github.com/1145067
When node is running with --use-http1, everything works fine.

Also, I was told to @mikeal as he wrote https2.

@thejh
Copy link

thejh commented Aug 14, 2011

The failing test case does create a connection to the registry, but it doesn't use TLS, it just sends a plain http request, which the server doesn't respond to, therefore nothing happens. My suggestion is to set a useTLS flag or so in https2:request if agent===false and then, in http2.js, to use something like this on line 1041:

self.onSocket((useHttps?tls.connect:net.createConnection)(options.port, options.host))

@koichik
Copy link

koichik commented Aug 15, 2011

another way is here.
https://gist.github.com/1145963

@mikeal
Copy link

mikeal commented Aug 15, 2011

i'll get to this today, it's not a very difficult fix.

@mikeal
Copy link

mikeal commented Aug 15, 2011

please review @bnoordhuis or @isaacs or @ry

@ry
Copy link

ry commented Aug 16, 2011

@mmalecki - we would like to take your code but we require a contributor agreement, which can be signed electronically at http://nodejs.org/cla.html , before we can pull it into the repository.

Be sure to integrate the test and assert that @mikeal's fix does indeed fix it.

@mikeal
Copy link

mikeal commented Aug 17, 2011

@ry just wait a minute, i have a better fix. it's all my code so don't worry abou @mmalecki getting a CLA in

@mmalecki you should sign the CLA anyway for next time :)

@mikeal
Copy link

mikeal commented Aug 17, 2011

ok, much better fix now.

in all conditions we get the options object to tls and http.js doesn't require() tls, ever.

using net.connect() didn't work for me because, i think it's only there with a non-default configure option.

also, @bnoordhuis yes, one line is 84 chars long, it looks way uglier if i break it up, there is a long line already in the file 20 lines up :)

@mmalecki
Copy link
Author

@mikeal, @ry
I've signed it few hours ago, so feel free to use my code.
I'm writing the test right now, I will do a pull request when I'm done (few moments).

@mikeal
Copy link

mikeal commented Aug 17, 2011

the test looks good. +1

@ry ry closed this as completed Aug 22, 2011
ry pushed a commit that referenced this issue Aug 22, 2011
@ry
Copy link

ry commented Aug 22, 2011

sorry that was confusing because i landed it originally in a different branch.

test 94963ab
fix 103990b

thanks everyone

bnoordhuis pushed a commit to bnoordhuis/node that referenced this issue Aug 23, 2011
bnoordhuis referenced this issue Jan 31, 2013
Let ECONNRESET network errors bubble up so clients can detect them.

Commit c4454d2 suppressed and turned them into regular end-of-stream
events to fix the then-failing simple/test-regress-GH-1531 test. See
also issue #1571 for (scant) details.

It turns out that special handling is no longer necessary. Remove the
special casing and let the error bubble up naturally.

pummel/test-https-ci-reneg-attack and pummel/test-tls-ci-reneg-attack
are updated because they expected an EPIPE error code that is now an
ECONNRESET. Suppression of the ECONNRESET prevented the test from
detecting that the connection has been severed whereupon the next
write would fail with an EPIPE.

Fixes #1776.
isaacs referenced this issue in isaacs/node-v0.x-archive Feb 3, 2013
Let ECONNRESET network errors bubble up so clients can detect them.

Commit c4454d2 suppressed and turned them into regular end-of-stream
events to fix the then-failing simple/test-regress-GH-1531 test. See
also issue nodejs#1571 for (scant) details.

It turns out that special handling is no longer necessary. Remove the
special casing and let the error bubble up naturally.

pummel/test-https-ci-reneg-attack and pummel/test-tls-ci-reneg-attack
are updated because they expected an EPIPE error code that is now an
ECONNRESET. Suppression of the ECONNRESET prevented the test from
detecting that the connection has been severed whereupon the next
write would fail with an EPIPE.

Fixes nodejs#1776.
bnoordhuis referenced this issue Feb 11, 2013
Let ECONNRESET network errors bubble up so clients can detect them.

Commit c4454d2 suppressed and turned them into regular end-of-stream
events to fix the then-failing simple/test-regress-GH-1531 test. See
also issue #1571 for (scant) details.

It turns out that special handling is no longer necessary. Remove the
special casing and let the error bubble up naturally.

pummel/test-https-ci-reneg-attack and pummel/test-tls-ci-reneg-attack
are updated because they expected an EPIPE error code that is now an
ECONNRESET. Suppression of the ECONNRESET prevented the test from
detecting that the connection has been severed whereupon the next
write would fail with an EPIPE.

Fixes #1776.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants