svn commit: samba r6989 - in branches/SAMBA_4_0: source/script source/web_server source/web_server/esp swat/esptest swat/scripting

tridge at samba.org tridge at samba.org
Thu May 26 03:22:38 GMT 2005


Author: tridge
Date: 2005-05-26 03:22:38 +0000 (Thu, 26 May 2005)
New Revision: 6989

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6989

Log:
- added support for esp style includes (which include a esp file, instead of a ejs file)

- added a test of esp style includes to the esptest html



Added:
   branches/SAMBA_4_0/swat/scripting/test.esp
Modified:
   branches/SAMBA_4_0/source/script/installswat.sh
   branches/SAMBA_4_0/source/web_server/esp/esp.h
   branches/SAMBA_4_0/source/web_server/http.c
   branches/SAMBA_4_0/swat/esptest/include.html


Changeset:
Modified: branches/SAMBA_4_0/source/script/installswat.sh
===================================================================
--- branches/SAMBA_4_0/source/script/installswat.sh	2005-05-26 03:07:38 UTC (rev 6988)
+++ branches/SAMBA_4_0/source/script/installswat.sh	2005-05-26 03:22:38 UTC (rev 6989)
@@ -22,6 +22,7 @@
 installdir esptest html
 installdir images png
 installdir scripting ejs
+installdir scripting esp
 
 cat << EOF
 ======================================================================

Modified: branches/SAMBA_4_0/source/web_server/esp/esp.h
===================================================================
--- branches/SAMBA_4_0/source/web_server/esp/esp.h	2005-05-26 03:07:38 UTC (rev 6988)
+++ branches/SAMBA_4_0/source/web_server/esp/esp.h	2005-05-26 03:22:38 UTC (rev 6989)
@@ -97,7 +97,7 @@
 	void	(*createSession)(EspHandle handle, int timeout);
 	void	(*destroySession)(EspHandle handle);
 	char	*(*getSessionId)(EspHandle handle);
-	int		(*mapToStorage)(EspHandle handle, char *path, int len, char *uri,
+	int		(*mapToStorage)(EspHandle handle, char *path, int len, const char *uri,
 				int flags);
 	int		(*readFile)(EspHandle handle, char **buf, int *len, const char *path);
 	void	(*redirect)(EspHandle handle, int code, char *url);

Modified: branches/SAMBA_4_0/source/web_server/http.c
===================================================================
--- branches/SAMBA_4_0/source/web_server/http.c	2005-05-26 03:07:38 UTC (rev 6988)
+++ branches/SAMBA_4_0/source/web_server/http.c	2005-05-26 03:22:38 UTC (rev 6989)
@@ -158,6 +158,16 @@
 }
 
 /*
+  called when esp wants to find the real path of a file
+*/
+static int http_mapToStorage(EspHandle handle, char *path, int len, const char *uri, int flags)
+{
+	if (uri == NULL || strlen(uri) >= len) return -1;
+	strncpy(path, uri, len);
+	return 0;
+}
+
+/*
   called when esp wants to output something
 */
 static int http_writeBlock(EspHandle handle, char *buf, int size)
@@ -253,7 +263,8 @@
 	.setHeader       = http_setHeader,
 	.redirect        = http_redirect,
 	.setResponseCode = http_setResponseCode,
-	.readFile        = http_readFile
+	.readFile        = http_readFile,
+	.mapToStorage    = http_mapToStorage
 };
 
 

Modified: branches/SAMBA_4_0/swat/esptest/include.html
===================================================================
--- branches/SAMBA_4_0/swat/esptest/include.html	2005-05-26 03:07:38 UTC (rev 6988)
+++ branches/SAMBA_4_0/swat/esptest/include.html	2005-05-26 03:22:38 UTC (rev 6989)
@@ -8,6 +8,12 @@
 calling a function from test.ejs ...<p>
 <% showArray("request", request); %>
 
+including /scripting/test.esp<p>
+<% include /scripting/test.esp %>
+calling a function from test.esp ...<p>
+<% res = testfn('foo'); %>
+result is: @@res
+
 <form name="Cancel" method="POST" action="index.html"> 
     <input name="submit" type="submit" value="Cancel"><br>
 </form>

Added: branches/SAMBA_4_0/swat/scripting/test.esp
===================================================================
--- branches/SAMBA_4_0/swat/scripting/test.esp	2005-05-26 03:07:38 UTC (rev 6988)
+++ branches/SAMBA_4_0/swat/scripting/test.esp	2005-05-26 03:22:38 UTC (rev 6989)
@@ -0,0 +1,6 @@
+<h3>A esp include file</h3>
+<%
+	function testfn(test) {
+		 return "the argument was " + test;
+	}
+%>



More information about the samba-cvs mailing list