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.contentType = 'bin';
|
||||
this.url = '/';
|
||||
this.pathname = '';
|
||||
this.pathname = '/';
|
||||
this.path = [];
|
||||
this.trailing = false;
|
||||
this.query = Object.create(null);
|
||||
@ -1221,8 +1221,13 @@ Request.prototype.init = function init(req, res, url) {
|
||||
this.emit('end');
|
||||
});
|
||||
|
||||
if (url != null)
|
||||
this.parse(url);
|
||||
if (url != null) {
|
||||
try {
|
||||
this.parse(url);
|
||||
} catch (e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Request.prototype.parse = function parse(url) {
|
||||
@ -1245,6 +1250,7 @@ Request.prototype.parse = function parse(url) {
|
||||
}
|
||||
}
|
||||
|
||||
pathname = pathname.replace(/%2f/gi, '');
|
||||
pathname = unescape(pathname);
|
||||
} else {
|
||||
pathname = '/';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user