mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 15:35:41 +00:00

This switches the url parser from `url.parse()` to the WHATWG URL parser while keeping `url.parse()` as fallback. Also add tests for invalid url deprecations and correct hostname checks. PR-URL: https://github.com/nodejs/node/pull/20270 Fixes: https://github.com/nodejs/node/issues/19468 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
34 lines
908 B
JavaScript
34 lines
908 B
JavaScript
/* eslint-disable node-core/crypto-check */
|
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const http = require('http');
|
|
const modules = { http };
|
|
|
|
const deprecations = [
|
|
['The provided URL http://[www.nodejs.org] is not a valid URL, and is supported ' +
|
|
'in the http module solely for compatibility.',
|
|
'DEP0109'],
|
|
];
|
|
|
|
if (common.hasCrypto) {
|
|
const https = require('https');
|
|
modules.https = https;
|
|
deprecations.push(
|
|
['The provided URL https://[www.nodejs.org] is not a valid URL, and is supported ' +
|
|
'in the https module solely for compatibility.',
|
|
'DEP0109'],
|
|
);
|
|
}
|
|
|
|
common.expectWarning('DeprecationWarning', deprecations);
|
|
|
|
Object.keys(modules).forEach((module) => {
|
|
const doNotCall = common.mustNotCall(
|
|
`${module}.request should not connect to ${module}://[www.nodejs.org]`
|
|
);
|
|
modules[module].request(`${module}://[www.nodejs.org]`, doNotCall).abort();
|
|
});
|