koa 3.1.1 → 3.1.2

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.
Files changed (2) hide show
  1. package/lib/request.js +11 -1
  2. package/package.json +2 -2
package/lib/request.js CHANGED
@@ -256,7 +256,17 @@ module.exports = {
256
256
  if (!host) host = this.get('Host')
257
257
  }
258
258
  if (!host) return ''
259
- return splitCommaSeparatedValues(host, 1)[0]
259
+ host = splitCommaSeparatedValues(host, 1)[0]
260
+ // Host header may contain userinfo (e.g., "user@host") which is invalid per RFC 7230.
261
+ // Use URL parser to correctly extract the host portion.
262
+ if (host.includes('@')) {
263
+ try {
264
+ host = new URL(`http://${host}`).host
265
+ } catch (e) {
266
+ return ''
267
+ }
268
+ }
269
+ return host
260
270
  },
261
271
 
262
272
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koa",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Koa web app framework",
5
5
  "main": "lib/application.js",
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "license": "MIT",
38
38
  "dependencies": {
39
39
  "accepts": "^1.3.8",
40
- "content-disposition": "~0.5.4",
40
+ "content-disposition": "~1.0.1",
41
41
  "content-type": "^1.0.5",
42
42
  "cookies": "~0.9.1",
43
43
  "delegates": "^1.0.0",