diff options
author | Anatoli Papirovski <apapirovski@mac.com> | 2017-10-20 14:38:15 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2017-10-24 00:35:53 +0300 |
commit | 9aa5d494e64e27dcb6e73774b8134d92338d1f91 (patch) | |
tree | 8a512cd16ecc699d9f0007435796c74ff2c0628d /test | |
parent | ce73ee5f3613b70884641d3d3a7c4ffefdca47b9 (diff) |
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.
PR-URL: https://github.com/nodejs/node/pull/16337
Fixes: https://github.com/nodejs/node/issues/14304
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-http2-client-port-80.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parallel/test-http2-client-port-80.js b/test/parallel/test-http2-client-port-80.js new file mode 100644 index 00000000000..a9d19eb5b9f --- /dev/null +++ b/test/parallel/test-http2-client-port-80.js @@ -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(); |