http: safer path parsing.
This commit is contained in:
parent
1860064da0
commit
b570769eed
@ -1181,7 +1181,7 @@ function Request(req, res, url) {
|
|||||||
this.headers = Object.create(null);
|
this.headers = Object.create(null);
|
||||||
this.contentType = 'bin';
|
this.contentType = 'bin';
|
||||||
this.url = '/';
|
this.url = '/';
|
||||||
this.pathname = '';
|
this.pathname = '/';
|
||||||
this.path = [];
|
this.path = [];
|
||||||
this.trailing = false;
|
this.trailing = false;
|
||||||
this.query = Object.create(null);
|
this.query = Object.create(null);
|
||||||
@ -1221,8 +1221,13 @@ Request.prototype.init = function init(req, res, url) {
|
|||||||
this.emit('end');
|
this.emit('end');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (url != null)
|
if (url != null) {
|
||||||
this.parse(url);
|
try {
|
||||||
|
this.parse(url);
|
||||||
|
} catch (e) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Request.prototype.parse = function parse(url) {
|
Request.prototype.parse = function parse(url) {
|
||||||
@ -1245,6 +1250,7 @@ Request.prototype.parse = function parse(url) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pathname = pathname.replace(/%2f/gi, '');
|
||||||
pathname = unescape(pathname);
|
pathname = unescape(pathname);
|
||||||
} else {
|
} else {
|
||||||
pathname = '/';
|
pathname = '/';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user