Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0d08d5a

Browse filesBrowse files
committed
url: remove gopher from special schemes
Refs: #33315 Refs: whatwg/url@d589670 Refs: whatwg/url@7ae1c69 PR-URL: #33325 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent e0586d0 commit 0d08d5a
Copy full SHA for 0d08d5a

File tree

Expand file treeCollapse file tree

10 files changed

+53
-37
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

10 files changed

+53
-37
lines changed
Open diff view settings
Collapse file

‎doc/api/url.md‎

Copy file name to clipboardExpand all lines: doc/api/url.md
+20-2Lines changed: 20 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ If the value assigned to the `href` property is not a valid URL, a `TypeError`
242242
will be thrown.
243243

244244
#### `url.origin`
245+
<!-- YAML
246+
changes:
247+
- version: REPLACEME
248+
pr-url: https://github.com/nodejs/node/pull/33325
249+
description: The scheme "gopher" is no longer special and `url.origin` now
250+
returns `'null'` for it.
251+
-->
245252

246253
* {string}
247254

@@ -305,6 +312,12 @@ to percent-encode may vary somewhat from what the [`url.parse()`][] and
305312
[`url.format()`][] methods would produce.
306313

307314
#### `url.port`
315+
<!-- YAML
316+
changes:
317+
- version: REPLACEME
318+
pr-url: https://github.com/nodejs/node/pull/33325
319+
description: The scheme "gopher" is no longer special.
320+
-->
308321

309322
* {string}
310323

@@ -322,7 +335,6 @@ the protocol/scheme:
322335
| -------- | ---- |
323336
| "ftp" | 21 |
324337
| "file" | |
325-
| "gopher" | 70 |
326338
| "http" | 80 |
327339
| "https" | 443 |
328340
| "ws" | 80 |
@@ -407,6 +419,12 @@ console.log(myURL.href);
407419
Invalid URL protocol values assigned to the `protocol` property are ignored.
408420

409421
##### Special Schemes
422+
<!-- YAML
423+
changes:
424+
- version: REPLACEME
425+
pr-url: https://github.com/nodejs/node/pull/33325
426+
description: The scheme "gopher" is no longer special.
427+
-->
410428

411429
The [WHATWG URL Standard][] considers a handful of URL protocol schemes to be
412430
_special_ in terms of how they are parsed and serialized. When a URL is
@@ -444,7 +462,7 @@ console.log(u.href);
444462
```
445463

446464
According to the WHATWG URL Standard, special protocol schemes are `ftp`,
447-
`file`, `gopher`, `http`, `https`, `ws`, and `wss`.
465+
`file`, `http`, `https`, `ws`, and `wss`.
448466

449467
#### `url.search`
450468

Collapse file

‎lib/internal/url.js‎

Copy file name to clipboardExpand all lines: lib/internal/url.js
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ ObjectDefineProperties(URL.prototype, {
472472
}
473473
return kOpaqueOrigin;
474474
case 'ftp:':
475-
case 'gopher:':
476475
case 'http:':
477476
case 'https:':
478477
case 'ws:':
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ constexpr size_t kFsStatsBufferLength =
371371
V(unknown_string, "<unknown>") \
372372
V(url_special_ftp_string, "ftp:") \
373373
V(url_special_file_string, "file:") \
374-
V(url_special_gopher_string, "gopher:") \
375374
V(url_special_http_string, "http:") \
376375
V(url_special_https_string, "https:") \
377376
V(url_special_ws_string, "ws:") \
Collapse file

‎src/node_url.cc‎

Copy file name to clipboardExpand all lines: src/node_url.cc
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ std::string PercentDecode(const char* input, size_t len) {
726726
#define SPECIALS(XX) \
727727
XX(ftp, 21, "ftp:") \
728728
XX(file, -1, "file:") \
729-
XX(gopher, 70, "gopher:") \
730729
XX(http, 80, "http:") \
731730
XX(https, 443, "https:") \
732731
XX(ws, 80, "ws:") \
Collapse file

‎test/fixtures/wpt/README.md‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Last update:
1212

1313
- console: https://github.com/web-platform-tests/wpt/tree/9786a4b131/console
1414
- encoding: https://github.com/web-platform-tests/wpt/tree/5059d2c777/encoding
15-
- url: https://github.com/web-platform-tests/wpt/tree/418f7fabeb/url
15+
- url: https://github.com/web-platform-tests/wpt/tree/43feb7f612/url
1616
- resources: https://github.com/web-platform-tests/wpt/tree/e1fddfbf80/resources
1717
- interfaces: https://github.com/web-platform-tests/wpt/tree/8ada332aea/interfaces
1818
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/0c3bed38df/html/webappapis/microtask-queuing
Collapse file

‎test/fixtures/wpt/url/failure.html‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/url/failure.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!doctype html>
22
<meta charset=utf-8>
33
<title>Test URL parser failure consistency</title>
4+
<meta name=timeout content=long>
45
<script src=/resources/testharness.js></script>
56
<script src=/resources/testharnessreport.js></script>
67
<div id=log></div>
Collapse file

‎test/fixtures/wpt/url/resources/setters_tests.json‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/url/resources/setters_tests.json
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"href": "gopher://example.net:1234",
123123
"new_value": "file",
124124
"expected": {
125-
"href": "gopher://example.net:1234/",
125+
"href": "gopher://example.net:1234",
126126
"protocol": "gopher:"
127127
}
128128
},
@@ -212,7 +212,7 @@
212212
},
213213
{
214214
"href": "ssh://me@example.net",
215-
"new_value": "gopher",
215+
"new_value": "https",
216216
"expected": {
217217
"href": "ssh://me@example.net",
218218
"protocol": "ssh:"
@@ -597,7 +597,7 @@
597597
}
598598
},
599599
{
600-
"comment": "Cannot-be-a-base means no password",
600+
"comment": "Cannot-be-a-base means no host",
601601
"href": "data:text/plain,Stuff",
602602
"new_value": "example.net",
603603
"expected": {
@@ -1074,7 +1074,7 @@
10741074
}
10751075
},
10761076
{
1077-
"comment": "Cannot-be-a-base means no password",
1077+
"comment": "Cannot-be-a-base means no host",
10781078
"href": "data:text/plain,Stuff",
10791079
"new_value": "example.net",
10801080
"expected": {
Collapse file

‎test/fixtures/wpt/url/resources/urltestdata.json‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/url/resources/urltestdata.json
+25-25Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,15 +1076,15 @@
10761076
{
10771077
"input": "gopher:/example.com/",
10781078
"base": "http://example.org/foo/bar",
1079-
"href": "gopher://example.com/",
1080-
"origin": "gopher://example.com",
1079+
"href": "gopher:/example.com/",
1080+
"origin": "null",
10811081
"protocol": "gopher:",
10821082
"username": "",
10831083
"password": "",
1084-
"host": "example.com",
1085-
"hostname": "example.com",
1084+
"host": "",
1085+
"hostname": "",
10861086
"port": "",
1087-
"pathname": "/",
1087+
"pathname": "/example.com/",
10881088
"search": "",
10891089
"hash": ""
10901090
},
@@ -1241,15 +1241,15 @@
12411241
{
12421242
"input": "gopher:example.com/",
12431243
"base": "http://example.org/foo/bar",
1244-
"href": "gopher://example.com/",
1245-
"origin": "gopher://example.com",
1244+
"href": "gopher:example.com/",
1245+
"origin": "null",
12461246
"protocol": "gopher:",
12471247
"username": "",
12481248
"password": "",
1249-
"host": "example.com",
1250-
"hostname": "example.com",
1249+
"host": "",
1250+
"hostname": "",
12511251
"port": "",
1252-
"pathname": "/",
1252+
"pathname": "example.com/",
12531253
"search": "",
12541254
"hash": ""
12551255
},
@@ -2511,14 +2511,14 @@
25112511
{
25122512
"input": "gopher://foo:70/",
25132513
"base": "about:blank",
2514-
"href": "gopher://foo/",
2515-
"origin": "gopher://foo",
2514+
"href": "gopher://foo:70/",
2515+
"origin": "null",
25162516
"protocol": "gopher:",
25172517
"username": "",
25182518
"password": "",
2519-
"host": "foo",
2519+
"host": "foo:70",
25202520
"hostname": "foo",
2521-
"port": "",
2521+
"port": "70",
25222522
"pathname": "/",
25232523
"search": "",
25242524
"hash": ""
@@ -2527,7 +2527,7 @@
25272527
"input": "gopher://foo:443/",
25282528
"base": "about:blank",
25292529
"href": "gopher://foo:443/",
2530-
"origin": "gopher://foo:443",
2530+
"origin": "null",
25312531
"protocol": "gopher:",
25322532
"username": "",
25332533
"password": "",
@@ -2750,15 +2750,15 @@
27502750
{
27512751
"input": "gopher:/example.com/",
27522752
"base": "about:blank",
2753-
"href": "gopher://example.com/",
2754-
"origin": "gopher://example.com",
2753+
"href": "gopher:/example.com/",
2754+
"origin": "null",
27552755
"protocol": "gopher:",
27562756
"username": "",
27572757
"password": "",
2758-
"host": "example.com",
2759-
"hostname": "example.com",
2758+
"host": "",
2759+
"hostname": "",
27602760
"port": "",
2761-
"pathname": "/",
2761+
"pathname": "/example.com/",
27622762
"search": "",
27632763
"hash": ""
27642764
},
@@ -2915,15 +2915,15 @@
29152915
{
29162916
"input": "gopher:example.com/",
29172917
"base": "about:blank",
2918-
"href": "gopher://example.com/",
2919-
"origin": "gopher://example.com",
2918+
"href": "gopher:example.com/",
2919+
"origin": "null",
29202920
"protocol": "gopher:",
29212921
"username": "",
29222922
"password": "",
2923-
"host": "example.com",
2924-
"hostname": "example.com",
2923+
"host": "",
2924+
"hostname": "",
29252925
"port": "",
2926-
"pathname": "/",
2926+
"pathname": "example.com/",
29272927
"search": "",
29282928
"hash": ""
29292929
},
Collapse file

‎test/fixtures/wpt/versions.json‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/versions.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"path": "encoding"
99
},
1010
"url": {
11-
"commit": "418f7fabebeeb642e79e05b48ffde1a601c7e058",
11+
"commit": "43feb7f612fe9160639e09a47933a29834904d69",
1212
"path": "url"
1313
},
1414
"resources": {
Collapse file

‎test/parallel/test-whatwg-url-custom-properties.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-url-custom-properties.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ assert.strictEqual(url.searchParams, oldParams);
171171
{ expected: 'https://whatwg.org',
172172
url: 'blob:https://whatwg.org/d0360e2f-caee-469f-9a2f-87d5b0456f6f' },
173173
{ expected: 'ftp://example.org', url: 'ftp://example.org/foo' },
174-
{ expected: 'gopher://gopher.quux.org', url: 'gopher://gopher.quux.org/1/' },
175174
{ expected: 'http://example.org', url: 'http://example.org/foo' },
176175
{ expected: 'https://example.org', url: 'https://example.org/foo' },
177176
{ expected: 'ws://example.org', url: 'ws://example.org/foo' },
178177
{ expected: 'wss://example.org', url: 'wss://example.org/foo' },
178+
{ expected: 'null', url: 'gopher://gopher.quux.org/1/' },
179179
{ expected: 'null', url: 'file:///tmp/mock/path' },
180180
{ expected: 'null', url: 'npm://nodejs/rules' }
181181
].forEach((test) => {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.