koa 2.16.3 → 2.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/request.js +11 -1
- package/package.json +9 -8
package/lib/request.js
CHANGED
|
@@ -257,7 +257,17 @@ module.exports = {
|
|
|
257
257
|
if (!host) host = this.get('Host');
|
|
258
258
|
}
|
|
259
259
|
if (!host) return '';
|
|
260
|
-
|
|
260
|
+
host = splitCommaSeparatedValues(host, 1)[0];
|
|
261
|
+
// Host header may contain userinfo (e.g., "user@host") which is invalid per RFC 7230.
|
|
262
|
+
// Use URL parser to correctly extract the host portion.
|
|
263
|
+
if (host.includes('@')) {
|
|
264
|
+
try {
|
|
265
|
+
host = new URL(`http://${host}`).host;
|
|
266
|
+
} catch (e) {
|
|
267
|
+
return '';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return host;
|
|
261
271
|
},
|
|
262
272
|
|
|
263
273
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koa",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"tag": "latest-2"
|
|
@@ -25,6 +25,13 @@
|
|
|
25
25
|
"./package": "./package.json",
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"test": "jest --forceExit",
|
|
30
|
+
"lint": "eslint --ignore-path .gitignore .",
|
|
31
|
+
"authors": "git log --format='%aN <%aE>' | sort -u > AUTHORS",
|
|
32
|
+
"build": "gen-esm-wrapper . ./dist/koa.mjs",
|
|
33
|
+
"prepare": "npm run build"
|
|
34
|
+
},
|
|
28
35
|
"repository": "koajs/koa",
|
|
29
36
|
"keywords": [
|
|
30
37
|
"web",
|
|
@@ -82,11 +89,5 @@
|
|
|
82
89
|
],
|
|
83
90
|
"jest": {
|
|
84
91
|
"testEnvironment": "node"
|
|
85
|
-
},
|
|
86
|
-
"scripts": {
|
|
87
|
-
"test": "jest --forceExit",
|
|
88
|
-
"lint": "eslint --ignore-path .gitignore .",
|
|
89
|
-
"authors": "git log --format='%aN <%aE>' | sort -u > AUTHORS",
|
|
90
|
-
"build": "gen-esm-wrapper . ./dist/koa.mjs"
|
|
91
92
|
}
|
|
92
|
-
}
|
|
93
|
+
}
|