Skip to content

Commit

Permalink
Fix test for invalid host header
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasholmlund committed Oct 26, 2017
1 parent 7470239 commit 7efec2e
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions test/test-https-ipv6.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,17 @@ describe('test/test-ipv6.test.js', () => {
assert(Object.keys(httpsAgent.sockets).length === 1);
});

it('should not crash with invalid hostname', done => {
// The url is invalid and the https-module
// will default to localhost and port 443.
const req = https.get({
it('should not crash with invalid host-header', done => {
https.get({
agent: httpsAgent,
url: 'https://[::1:80/',
// TODO: Uncomment this line and remove rejectUnauthorized
// when https://github.com/nodejs/node/issues/14736 is
// resolved and included in the current release of node.
// ca: fs.readFileSync(__dirname + '/fixtures/ca.pem'),
hostname: '::1',
port,
path: '/',
headers: {
host: '[::1:80',
},
rejectUnauthorized: false,
}, () => {
// There happened to be something listening
// on localhost port 443
done();
});
req.on('error', () => {
done();
});
});
Expand Down

0 comments on commit 7efec2e

Please sign in to comment.