| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9dd232c commit 68fd6d5
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1477,6 +1477,9 @@ void URL::Parse(const char* input, | |||
| 1477 | 1477 | if (ch != '/') { | |
| 1478 | 1478 | continue; | |
| 1479 | 1479 | } | |
| 1480 | + } else if (has_state_override && !(url->flags & URL_FLAGS_HAS_HOST)) { | ||
| 1481 | + url->flags |= URL_FLAGS_HAS_PATH; | ||
| 1482 | + url->path.emplace_back(""); | ||
| 1480 | 1483 | } | |
| 1481 | 1484 | break; | |
| 1482 | 1485 | case kPath: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ Last update: | |||
| 22 | 22 | - interfaces: https://github.com/web-platform-tests/wpt/tree/fcb671ed8b/interfaces | |
| 23 | 23 | - resources: https://github.com/web-platform-tests/wpt/tree/972ca5b669/resources | |
| 24 | 24 | - streams: https://github.com/web-platform-tests/wpt/tree/8f60d94439/streams | |
| 25 | - - url: https://github.com/web-platform-tests/wpt/tree/1fcb39223d/url | ||
| 25 | + - url: https://github.com/web-platform-tests/wpt/tree/77d54aa9e0/url | ||
| 26 | 26 | ||
| 27 | 27 | [Web Platform Tests]: https://github.com/web-platform-tests/wpt | |
| 28 | 28 | [`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/main/docs/git-node.md#git-node-wpt | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -990,6 +990,26 @@ | |||
| 990 | 990 | "hostname": "test", | |
| 991 | 991 | "port": "12" | |
| 992 | 992 | } | |
| 993 | + }, | ||
| 994 | + { | ||
| 995 | + "comment": "Leading / is not stripped", | ||
| 996 | + "href": "http://example.com/", | ||
| 997 | + "new_value": "///bad.com", | ||
| 998 | + "expected": { | ||
| 999 | + "href": "http://example.com/", | ||
| 1000 | + "host": "example.com", | ||
| 1001 | + "hostname": "example.com" | ||
| 1002 | + } | ||
| 1003 | + }, | ||
| 1004 | + { | ||
| 1005 | + "comment": "Leading / is not stripped", | ||
| 1006 | + "href": "sc://example.com/", | ||
| 1007 | + "new_value": "///bad.com", | ||
| 1008 | + "expected": { | ||
| 1009 | + "href": "sc:///", | ||
| 1010 | + "host": "", | ||
| 1011 | + "hostname": "" | ||
| 1012 | + } | ||
| 993 | 1013 | } | |
| 994 | 1014 | ], | |
| 995 | 1015 | "hostname": [ | |
@@ -1345,6 +1365,26 @@ | |||
| 1345 | 1365 | "hostname": "", | |
| 1346 | 1366 | "pathname": "//p" | |
| 1347 | 1367 | } | |
| 1368 | + }, | ||
| 1369 | + { | ||
| 1370 | + "comment": "Leading / is not stripped", | ||
| 1371 | + "href": "http://example.com/", | ||
| 1372 | + "new_value": "///bad.com", | ||
| 1373 | + "expected": { | ||
| 1374 | + "href": "http://example.com/", | ||
| 1375 | + "host": "example.com", | ||
| 1376 | + "hostname": "example.com" | ||
| 1377 | + } | ||
| 1378 | + }, | ||
| 1379 | + { | ||
| 1380 | + "comment": "Leading / is not stripped", | ||
| 1381 | + "href": "sc://example.com/", | ||
| 1382 | + "new_value": "///bad.com", | ||
| 1383 | + "expected": { | ||
| 1384 | + "href": "sc:///", | ||
| 1385 | + "host": "", | ||
| 1386 | + "hostname": "" | ||
| 1387 | + } | ||
| 1348 | 1388 | } | |
| 1349 | 1389 | ], | |
| 1350 | 1390 | "port": [ | |
@@ -1571,6 +1611,51 @@ | |||
| 1571 | 1611 | "pathname": "me@example.net" | |
| 1572 | 1612 | } | |
| 1573 | 1613 | }, | |
| 1614 | + { | ||
| 1615 | + "comment": "Special URLs cannot have their paths erased", | ||
| 1616 | + "href": "file:///some/path", | ||
| 1617 | + "new_value": "", | ||
| 1618 | + "expected": { | ||
| 1619 | + "href": "file:///", | ||
| 1620 | + "pathname": "/" | ||
| 1621 | + } | ||
| 1622 | + }, | ||
| 1623 | + { | ||
| 1624 | + "comment": "Non-special URLs can have their paths erased", | ||
| 1625 | + "href": "foo://somehost/some/path", | ||
| 1626 | + "new_value": "", | ||
| 1627 | + "expected": { | ||
| 1628 | + "href": "foo://somehost", | ||
| 1629 | + "pathname": "" | ||
| 1630 | + } | ||
| 1631 | + }, | ||
| 1632 | + { | ||
| 1633 | + "comment": "Non-special URLs with an empty host can have their paths erased", | ||
| 1634 | + "href": "foo:///some/path", | ||
| 1635 | + "new_value": "", | ||
| 1636 | + "expected": { | ||
| 1637 | + "href": "foo://", | ||
| 1638 | + "pathname": "" | ||
| 1639 | + } | ||
| 1640 | + }, | ||
| 1641 | + { | ||
| 1642 | + "comment": "Path-only URLs cannot have their paths erased", | ||
| 1643 | + "href": "foo:/some/path", | ||
| 1644 | + "new_value": "", | ||
| 1645 | + "expected": { | ||
| 1646 | + "href": "foo:/", | ||
| 1647 | + "pathname": "/" | ||
| 1648 | + } | ||
| 1649 | + }, | ||
| 1650 | + { | ||
| 1651 | + "comment": "Path-only URLs always have an initial slash", | ||
| 1652 | + "href": "foo:/some/path", | ||
| 1653 | + "new_value": "test", | ||
| 1654 | + "expected": { | ||
| 1655 | + "href": "foo:/test", | ||
| 1656 | + "pathname": "/test" | ||
| 1657 | + } | ||
| 1658 | + }, | ||
| 1574 | 1659 | { | |
| 1575 | 1660 | "href": "unix:/run/foo.socket?timeout=10", | |
| 1576 | 1661 | "new_value": "/var/log/../run/bar.socket", | |
@@ -1667,6 +1752,24 @@ | |||
| 1667 | 1752 | "pathname": "/%23" | |
| 1668 | 1753 | } | |
| 1669 | 1754 | }, | |
| 1755 | + { | ||
| 1756 | + "comment": "? doesn't mess up encoding", | ||
| 1757 | + "href": "http://example.net", | ||
| 1758 | + "new_value": "/?é", | ||
| 1759 | + "expected": { | ||
| 1760 | + "href": "http://example.net/%3F%C3%A9", | ||
| 1761 | + "pathname": "/%3F%C3%A9" | ||
| 1762 | + } | ||
| 1763 | + }, | ||
| 1764 | + { | ||
| 1765 | + "comment": "# doesn't mess up encoding", | ||
| 1766 | + "href": "http://example.net", | ||
| 1767 | + "new_value": "/#é", | ||
| 1768 | + "expected": { | ||
| 1769 | + "href": "http://example.net/%23%C3%A9", | ||
| 1770 | + "pathname": "/%23%C3%A9" | ||
| 1771 | + } | ||
| 1772 | + }, | ||
| 1670 | 1773 | { | |
| 1671 | 1774 | "comment": "File URLs and (back)slashes", | |
| 1672 | 1775 | "href": "file://monkey/", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments