whatwg-url
Advanced tools
Comparing version 8.4.0 to 8.5.0
@@ -53,7 +53,7 @@ "use strict"; | ||
function containsForbiddenHostCodePoint(string) { | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|<|>|\?|@|\[|\\|\]|\^/) !== -1; | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/) !== -1; | ||
} | ||
function containsForbiddenHostCodePointExcludingPercent(string) { | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^/) !== -1; | ||
return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|<|>|\?|@|\[|\\|\]|\^|\|/) !== -1; | ||
} | ||
@@ -1037,3 +1037,3 @@ | ||
URLStateMachine.prototype["parse query"] = function parseQuery(c) { | ||
URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { | ||
if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { | ||
@@ -1043,5 +1043,12 @@ this.encodingOverride = "utf-8"; | ||
if (!this.stateOverride & c === 35) { | ||
this.url.fragment = ""; | ||
this.state = "fragment"; | ||
if ((!this.stateOverride && c === 35) || isNaN(c)) { | ||
const queryPercentEncodePredicate = isSpecial(this.url) ? isSpecialQueryPercentEncode : isQueryPercentEncode; | ||
this.url.query += utf8PercentEncodeString(this.buffer, queryPercentEncodePredicate); | ||
this.buffer = ""; | ||
if (c === 35) { | ||
this.url.fragment = ""; | ||
this.state = "fragment"; | ||
} | ||
} else if (!isNaN(c)) { | ||
@@ -1056,5 +1063,3 @@ // TODO: If c is not a URL code point and not "%", parse error. | ||
const queryPercentEncodePredicate = isSpecial(this.url) ? isSpecialQueryPercentEncode : isQueryPercentEncode; | ||
// TODO: use "percent-encode after encoding" passing in this.encodingOverride | ||
this.url.query += utf8PercentEncodeCodePoint(c, queryPercentEncodePredicate); | ||
this.buffer += cStr; | ||
} | ||
@@ -1061,0 +1066,0 @@ |
"use strict"; | ||
const stableSortBy = require("lodash.sortby"); | ||
const stableSortBy = require("lodash/sortBy"); | ||
const urlencoded = require("./urlencoded"); | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "whatwg-url", | ||
"version": "8.4.0", | ||
"version": "8.5.0", | ||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"lodash.sortby": "^4.7.0", | ||
"lodash": "^4.7.0", | ||
"tr46": "^2.0.2", | ||
@@ -21,9 +21,9 @@ "webidl-conversions": "^6.1.0" | ||
"devDependencies": { | ||
"browserify": "^16.5.2", | ||
"browserify": "^17.0.0", | ||
"domexception": "^2.0.1", | ||
"eslint": "^7.7.0", | ||
"eslint": "^7.20.0", | ||
"glob": "^7.1.6", | ||
"got": "^11.5.2", | ||
"jest": "^26.4.2", | ||
"recast": "^0.20.2", | ||
"got": "^11.8.1", | ||
"jest": "^26.6.3", | ||
"recast": "^0.20.4", | ||
"webidl2js": "^16.2.0" | ||
@@ -30,0 +30,0 @@ }, |
@@ -7,6 +7,8 @@ # whatwg-url | ||
whatwg-url is currently up to date with the URL spec up to commit [a19495e](https://github.com/whatwg/url/commit/a19495e27ad95154543b46f751d1a1bf25553808). | ||
whatwg-url is currently up to date with the URL spec up to commit [0915d88](https://github.com/whatwg/url/commit/0915d886bbf409331857f56e6d2bfd0cb5e01de7). | ||
For `file:` URLs, whose [origin is left unspecified](https://url.spec.whatwg.org/#concept-url-origin), whatwg-url chooses to use a new opaque origin (which serializes to `"null"`). | ||
whatwg-url does not yet implement any encoding handling beyond UTF-8. That is, the _encoding override_ parameter does not exist in our API. | ||
## API | ||
@@ -22,4 +24,4 @@ | ||
- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL, encodingOverride })` | ||
- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, encodingOverride, url, stateOverride })` | ||
- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL })` | ||
- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, url, stateOverride })` | ||
- [URL serializer](https://url.spec.whatwg.org/#concept-url-serializer): `serializeURL(urlRecord, excludeFragment)` | ||
@@ -26,0 +28,0 @@ - [Host serializer](https://url.spec.whatwg.org/#concept-host-serializer): `serializeHost(hostFromURLRecord)` |
90633
2473
105
+ Addedlodash@^4.7.0
+ Addedlodash@4.17.21(transitive)
- Removedlodash.sortby@^4.7.0
- Removedlodash.sortby@4.7.0(transitive)