daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Mar 21st, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function serveFile(){
  2.  
  3. }
  4.  
  5. function serveCGI(){
  6.  
  7. }
  8.  
  9. function pullandsendFile(){
  10.  
  11. }
  12.  
  13. function pullandsendOutput(){
  14.  
  15. }
  16.  
  17. function getURL(req, res){
  18.     console.log("inside geturl");
  19.     var localF = "LOCALFILE";
  20.     var remoteF = "REMOTEFILE";
  21.     var localE = "LOCALEXEC";
  22.     var remoteE = "REMOTEEXEC";
  23.     var validExtensions;
  24.     for (var i = 0; i < XelkReq.VALIDTEXT.length; i++){
  25.         validExtensions = validExtensions + "\." + XelkReq.VALIDTEXT[i][0];
  26.         if (i < XelkReq.VALIDTEXT.length - 1){
  27.             validExtensions = validExtensions + "|";
  28.         }
  29.     }
  30.     var regExLocalF = new RegExp("\\/" + localF + "\\/[a-zA-Z0-9~\\/]+" + validExtensions);
  31.     var regExRemoteF = new RegExp("\\/" + remoteF + "\\/[a-zA-Z0-9\\.]+" + "\\/[a-zA-Z0-9~\\/]" + validExtensions);
  32.     var regExLocalE = new RegExp("\\/" + localE + "[a-zA-Z0-9\\/]+\.cgi");
  33.     var regExRemoteE = new RegExp("\\/" + remoteE + "\\/[a-zA-Z0-9\\.]+" + "[a-zA-Z0-9\\/]+\.cgi");
  34.     var finalRegEx = new RegExp(regExLocalF + "|" + regExRemoteF + "|" + regExLocalE + "|" + regExRemoteE);
  35.     var urlRegEx = new RegExp("\\/[a-zA-Z0-9\\.]+");
  36.     if(urlRegEx.test(req)){
  37.         console.log("smd");
  38.     }
  39. }
  40.  
  41. var http = require('http');
  42. var XelkReq = require('/homes/paul/HTML/CS316/P3_Req.js');
  43.  
  44. console.log("hello");
  45.  
  46. const server = http.createServer(getURL);
  47. server.listen(8080);
  48. console.log("hellopart2");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top