forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http2: allow port 80 in http2.connect
Due to how WHATWG-URL parser works, port numbers are omitted if they are the default port for a scheme. This meant that http2.connect could not accept connections on port 80 with http scheme. Fix this bug by detecting http: scheme and setting port to 80. Fixes: nodejs#14304
- Loading branch information
1 parent
ba4a0a6
commit e756215
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
const assert = require('assert'); | ||
const http2 = require('http2'); | ||
const net = require('net'); | ||
|
||
// Verifies that port 80 gets set as expected | ||
|
||
const connect = net.connect; | ||
net.connect = common.mustCall((...args) => { | ||
assert.strictEqual(args[0], '80'); | ||
return connect(...args); | ||
}); | ||
|
||
const client = http2.connect('http://localhost:80'); | ||
client.destroy(); |