Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

V0.3

  • Loading branch information...
commit 8faa7e5bba9ff4943a4f1933bf4ee01c5540d528 1 parent 1b58438
Ohad authored August 20, 2010
BIN  AlligatorV03.tar.gz
Binary file not shown
54  WWW/hello.js
... ...
@@ -1,38 +1,20 @@
1  
-(function(log,lib,application,request,responseHead,writeEscapedText,forward,sendRedirect,write,session) {writeEscapedText("%3CHTML%3E%0A");
2  
-writeEscapedText("%09%09");write("<head><title>nodeJS and antiNode+</title></head>");
3  
-writeEscapedText("%09%3CBODY%3E%0A");
4  
-writeEscapedText("%09%09");
5  
-			var counter = 1;
6  
-			application.get("counter",function(value){
7  
-				log.debug("HELLO.JSSP, value - " +value);
8  
-				if(value == undefined)	
9  
-					application.set("counter",1);
10  
-				else{
11  
-					counter = value+1;
12  
-					application.set("counter",counter);			
13  
-				}
14  
-			});				
  1
+(function(log,lib,application,request,responseHead,commands,session) {commands.writeEscapedText("%3CHTML%3E%0A");
  2
+commands.writeEscapedText("%09%09");commands.write("<head><title>nodeJS and antiNode+</title></head>");
  3
+commands.writeEscapedText("%09%3CBODY%3E%0A");
  4
+commands.writeEscapedText("%09%09HELLO%20WORLD%3Cbr/%3E%0A");
  5
+commands.writeEscapedText("%09%09%3Cbr/%3Erequest.parameters.night%3A%20");commands.write(request.parameters.night);commands.writeEscapedText("%3C/br%3E%0A");
  6
+commands.writeEscapedText("%09%09");	if(request.parameters.night != undefined && request.parameters.night=="1"){
15 7
 		
16  
-writeEscapedText("%09%09HELLO%20WORLD%3Cbr/%3E%0A");
17  
-writeEscapedText("%09%09Number%20of%20users%3A%0A");
18  
-writeEscapedText("%09%09"); 
19  
-			write(counter+"<br/>");	
20  
-		
21  
-writeEscapedText("%09%09%09%3Cbr/%3Erequest.parameters.night%3A%20");write(request.parameters.night);writeEscapedText("%3C/br%3E%0A");
22  
-writeEscapedText("%09%09");	if(request.parameters.night != undefined && request.parameters.night=="1"){
23  
-		
24  
-writeEscapedText("%09%09Good%20night%21%20%0A");
25  
-writeEscapedText("%09%09");}else{
26  
-writeEscapedText("%09%09Good%20Day%21%0A");
27  
-writeEscapedText("%09%09");}
28  
-writeEscapedText("%09%09%3Cbr/%3E%0A");
29  
-writeEscapedText("%09%09");for (index=0;index<5;index++){ write(index);writeEscapedText("%3B"); }
30  
-writeEscapedText("%09%09%3Cbr/%3E%0A");
31  
-writeEscapedText("%09%09Testing%20the%20lib%3A%09%09%3Cbr/%3E%0A");
32  
-writeEscapedText("%09%09Request%20headers%3A%20");write(lib.test.arrayToString(request.headers));writeEscapedText("%3C/br%3E%0A");
33  
-writeEscapedText("%09%09%3Cbr/%3E%0A");
34  
-writeEscapedText("%09%09Setting%20a%20cookie%20a%3Db%20using%3A%20responseHead.headers%5B%22Set-cookie%22%5D%20%3D%20%22a%3Db%22%3B%3Cbr/%3E%0A");
35  
-writeEscapedText("%09%09");responseHead.headers["Set-cookie"] = "a=b";
36  
-writeEscapedText("%09%3C/BODY%3E%0A");
37  
-writeEscapedText("%3C/HTML%3E%0A");
  8
+commands.writeEscapedText("%09%09Good%20night%21%20%0A");
  9
+commands.writeEscapedText("%09%09");}else{
  10
+commands.writeEscapedText("%09%09Good%20Day%21%0A");
  11
+commands.writeEscapedText("%09%09");}
  12
+commands.writeEscapedText("%09%09%3Cbr/%3E%0A");
  13
+commands.writeEscapedText("%09%09");for (index=0;index<5;index++){ commands.write(index);commands.writeEscapedText("%3B"); }
  14
+commands.writeEscapedText("%09%09%3Cbr/%3E%0A");
  15
+commands.writeEscapedText("%09%09Testing%20the%20lib%3A%09%09%3Cbr/%3E%0A");
  16
+commands.writeEscapedText("%09%09Request%20headers%3A%20");commands.write(lib.test.arrayToString(request.headers));commands.writeEscapedText("%3C/br%3E%0A");
  17
+commands.writeEscapedText("%09%09%3Cbr/%3E%0A");
  18
+commands.writeEscapedText("%09%3C/BODY%3E%0A");
  19
+commands.writeEscapedText("%3C/HTML%3E%0A");
38 20
 })
22  WWW/hello.jssp
... ...
@@ -1,24 +1,10 @@
1 1
 <HTML>
2 2
 		<?="<head><title>nodeJS and antiNode+</title></head>"?>
3 3
 	<BODY>
4  
-		<?
5  
-			var counter = 1;
6  
-			application.get("counter",function(value){
7  
-				log.debug("HELLO.JSSP, value - " +value);
8  
-				if(value == undefined)	
9  
-					application.set("counter",1);
10  
-				else{
11  
-					counter = value+1;
12  
-					application.set("counter",counter);			
13  
-				}
14  
-			});				
15  
-		?>
  4
+
16 5
 		HELLO WORLD<br/>
17  
-		Number of users:
18  
-		<? 
19  
-			write(counter+"<br/>");	
20  
-		?>
21  
-			<br/>request.parameters.night: <?=request.parameters.night?></br>
  6
+
  7
+		<br/>request.parameters.night: <?=request.parameters.night?></br>
22 8
 		<?	if(request.parameters.night != undefined && request.parameters.night=="1"){
23 9
 		?>
24 10
 		Good night! 
@@ -31,8 +17,6 @@
31 17
 		Testing the lib:		<br/>
32 18
 		Request headers: <?=lib.test.arrayToString(request.headers)?></br>
33 19
 		<br/>
34  
-		Setting a cookie a=b using: responseHead.headers["Set-cookie"] = "a=b";<br/>
35  
-		<?responseHead.headers["Set-cookie"] = "a=b";?>
36 20
 
37 21
 	</BODY>
38 22
 </HTML>
1  WWW/index.html
... ...
@@ -0,0 +1 @@
  1
+Hello World
8  lib/jssp.js
@@ -101,11 +101,11 @@ function handleRequest(req,res,cleanPathname,newSessionId){
101 101
 			    }
102 102
 			    return fileNotFound(req,res,path);
103 103
 			}
104  
-			if (!stats.isFile()) 
  104
+			if (!stats.isFile() && !stats.isDirectory()) 
105 105
 			    return fileNotFound(req,res,path);
106 106
 			else{
107 107
 				if (stats.isDirectory()) 
108  
-					path.join(path, "index.html");
  108
+					path = pathlib.join(path, "index.html");
109 109
 				var cookie = req.headers["cookie"];
110 110
 				var sessionId = utils.getSessionId(cookie);
111 111
 				if(newSessionId!=undefined)//forward
@@ -135,8 +135,8 @@ function handleRequest(req,res,cleanPathname,newSessionId){
135 135
 						req.connection.addListener('timeout', function() {
136 136
 						    /* dont destroy it when the fd's already closed */
137 137
 						    if (readStream.readable) {
138  
-							log.debug('timed out. destroying file read stream');
139  
-							readStream.destroy();
  138
+						    	log.debug('timed out. destroying file read stream');
  139
+								readStream.destroy();
140 140
 						    }
141 141
 						});
142 142
 

0 notes on commit 8faa7e5

Please sign in to comment.
Something went wrong with that request. Please try again.