feature(main) add getPathName

This commit is contained in:
coderaiser 2014-02-10 06:09:30 -05:00
parent 42ef8ae29f
commit 6281248304
2 changed files with 18 additions and 8 deletions

View file

@ -167,16 +167,16 @@
lConfig = main.config,
lParsedUrl = URL.parse(pReq.url),
lQuery = lParsedUrl.search || '',
lPath = lParsedUrl.pathname;
path = main.getPathName(pReq);
/* added supporting of Russian language in directory names */
lPath = Querystring.unescape(lPath);
path = Querystring.unescape(path);
if (!expressApp)
Util.log(pReq.method + ' ' + lPath + lQuery);
Util.log(pReq.method + ' ' + path + lQuery);
data = {
name : lPath,
name : path,
request : pReq,
response : pRes
};
@ -237,9 +237,7 @@
dir = DIR,
gzip = zlib.createGzip(),
isGzip = main.isGZIP(request),
parsedUrl = URL.parse(request.url),
path = parsedUrl.pathname,
path = main.getPathName(request),
isJoin = CloudFunc.isJoinURL(path),
readPipe = function() {

View file

@ -61,6 +61,7 @@
exports.generateHeaders = generateHeaders,
exports.getQuery = getQuery,
exports.getPathName = getPathName,
exports.isGZIP = isGZIP,
exports.mainSetHeader = mainSetHeader,
@ -416,10 +417,21 @@
parsed = url.parse(req.url);
query = parsed.query;
}
return query;
}
function getPathName(req) {
var pathname, parsed;
if (req) {
parsed = url.parse(req.url);
pathname = parsed.pathname;
}
return pathname;
}
function isGZIP(pReq) {
var lEnc, lGZIP;
if (pReq) {