-
Notifications
You must be signed in to change notification settings - Fork 30k
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
https: Use secureProtocol in Agent#getName #9452
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments.
@@ -0,0 +1,67 @@ | |||
'use strict'; | |||
var assert = require('assert'); | |||
var common = require('../common'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use const
here and elsewhere where it makes sense?
secureProtocol: 'SSLv23_method' | ||
}, function(res) { | ||
res.resume(); | ||
globalAgent.once('free', function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style issue: can you drop the blank in function ()
. Same issue a few lines below.
var keys = Object.keys(globalAgent.freeSockets); | ||
assert.equal(keys.length, 2); | ||
assert.notEqual(keys[0].indexOf(':SSLv23_method'), -1); | ||
assert.notEqual(keys[1].indexOf(':TLSv1_method'), -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use assert.strictEqual
and assert.notStrictEqual
here? Also, instead of .indexOf() you can use .includes().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still unfixed.
}); | ||
}).on('error', function(e) { | ||
console.log(e.message); | ||
process.exit(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do this, just let the exception bubble up.
@bnoordhuis, thanks for taking a look! I believe I fixed the problems you pointed out now. |
var options = { | ||
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), | ||
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'), | ||
ca: fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit: there is an extra blank here.
var keys = Object.keys(globalAgent.freeSockets); | ||
assert.equal(keys.length, 2); | ||
assert.notEqual(keys[0].indexOf(':SSLv23_method'), -1); | ||
assert.notEqual(keys[1].indexOf(':TLSv1_method'), -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still unfixed.
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still a couple of places where you could s/var/const/.
2106fb8
to
43124ca
Compare
@bnoordhuis ... There, that should do it. For some reason I didn't notice that the test-https-agent-getname.js was also affected by this (due to the extra colons showing up in those keys). Fixed that as well and squashed+rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit: you might use |
As suggested by @bnoordhuis in nodejs#9324
43124ca
to
67965c9
Compare
@cjihrig Good point -- I added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this fell through the cracks. New CI: https://ci.nodejs.org/job/node-test-pull-request/5804/ |
Landed in a469f85 |
Refs: nodejs#9324 PR-URL: nodejs#9452 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Refs: nodejs#9324 PR-URL: nodejs#9452 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Refs: nodejs#9324 PR-URL: nodejs#9452 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Refs: nodejs#9324 PR-URL: nodejs#9452 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Is this something we want to backport? It seems like it changes some behavior... even if it does so to a more correct behavior |
hmmm.. I'd say maybe let it sit for a while longer before putting into v6.x-staging. Perhaps skip v4.x-staging |
It seems like this PR has baked long enough. Landing on v6.x |
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
https
Description of change
Fix oversight pointed out by @bnoordhuis in #9324. The value of the
secureProtocol
option should be used as a "discriminator" when determining whether an existing HTTPS connection can be reused.