added redirect function

This commit is contained in:
coderaiser 2013-03-10 06:48:23 -04:00
parent e8edb83d14
commit b21c2b15f4
4 changed files with 81 additions and 62 deletions

View file

@ -233,8 +233,10 @@
lRet = main.sendFile( pParams );
}
else if( Util.isContainStr(p.name, FS) || Util.strCmp( p.name, '/') ){
if( Util.isContainStr(p.name, 'no-js/') )
return noJSTMPRedirection(pParams);
if( Util.isContainStr(p.name, 'no-js/') ){
var lURL = Util.removeStr(pParams.name, 'no-js/');
return main.redirect(pParams, lURL);
}
lRet = sendCommanderContent(p);
}
@ -303,16 +305,6 @@
}
}
function noJSTMPRedirection(pParams){
var MOVED_PERMANENTLY = 301,
lPath = Util.removeStr(pParams.name, 'no-js/');
pParams.response.writeHead(MOVED_PERMANENTLY, {'Location': lPath});
pParams.response.end();
return true;
}
/* function sets stdout to file log.txt */
function writeLogsToFile(){