增加url元字符

v1 1.2.7
yutent 2022-07-04 19:08:04 +08:00
parent 92ef27b06a
commit efe2c384d8
2 changed files with 10 additions and 3 deletions

View File

@ -60,7 +60,7 @@ export default class Request {
_url = decode(_url) _url = decode(_url)
// URL上不允许有非法字符 // URL上不允许有非法字符
if (/[^\w\-\/\.]/.test(_url)) { if (/[^\w-/.@~!$&:+'=]/.test(_url)) {
this.origin.res.rendered = true this.origin.res.rendered = true
this.origin.res.writeHead(400, { this.origin.res.writeHead(400, {
'X-debug': `url [/${encode(_url)}] contains invalid characters` 'X-debug': `url [/${encode(_url)}] contains invalid characters`

View File

@ -1,11 +1,18 @@
{ {
"name": "@gm5/request", "name": "@gm5/request",
"version": "1.2.6", "version": "1.2.7",
"description": "对Http的request进一步封装, 提供常用的API", "description": "对Http的request进一步封装, 提供常用的API",
"main": "index.js", "main": "index.js",
"author": "yutent", "author": "yutent",
"type": "module", "type": "module",
"keywords": ["five", "node-five", "five.js", "fivejs", "request", "http"], "keywords": [
"five",
"node-five",
"five.js",
"fivejs",
"request",
"http"
],
"dependencies": { "dependencies": {
"es.shim": "^2.0.1", "es.shim": "^2.0.1",
"iofs": "^1.5.0" "iofs": "^1.5.0"