mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
r6989: - 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 (This used to be commit af3de9468ee5ba490c991901b7a4aa260c839876)
This commit is contained in:
parent
98046f0372
commit
74dda39226
@ -22,6 +22,7 @@ installdir . html
|
||||
installdir esptest html
|
||||
installdir images png
|
||||
installdir scripting ejs
|
||||
installdir scripting esp
|
||||
|
||||
cat << EOF
|
||||
======================================================================
|
||||
|
@ -97,7 +97,7 @@ typedef struct Esp {
|
||||
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);
|
||||
|
@ -157,6 +157,16 @@ failed:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
*/
|
||||
@ -253,7 +263,8 @@ static const struct Esp esp_control = {
|
||||
.setHeader = http_setHeader,
|
||||
.redirect = http_redirect,
|
||||
.setResponseCode = http_setResponseCode,
|
||||
.readFile = http_readFile
|
||||
.readFile = http_readFile,
|
||||
.mapToStorage = http_mapToStorage
|
||||
};
|
||||
|
||||
|
||||
|
@ -8,6 +8,12 @@ including /scripting/test.ejs<p>
|
||||
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>
|
||||
|
6
swat/scripting/test.esp
Normal file
6
swat/scripting/test.esp
Normal file
@ -0,0 +1,6 @@
|
||||
<h3>A esp include file</h3>
|
||||
<%
|
||||
function testfn(test) {
|
||||
return "the argument was " + test;
|
||||
}
|
||||
%>
|
Loading…
x
Reference in New Issue
Block a user