svn commit: samba r7086 - in
branches/SAMBA_4_0/source/web_server/esp: .
tridge at samba.org
tridge at samba.org
Mon May 30 06:07:27 GMT 2005
Author: tridge
Date: 2005-05-30 06:07:23 +0000 (Mon, 30 May 2005)
New Revision: 7086
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7086
Log:
make include() recognise the ".esp" extension and include the file as
an esp script instead of as a ejs script
Modified:
branches/SAMBA_4_0/source/web_server/esp/espProcs.c
Changeset:
Modified: branches/SAMBA_4_0/source/web_server/esp/espProcs.c
===================================================================
--- branches/SAMBA_4_0/source/web_server/esp/espProcs.c 2005-05-30 06:06:27 UTC (rev 7085)
+++ branches/SAMBA_4_0/source/web_server/esp/espProcs.c 2005-05-30 06:07:23 UTC (rev 7086)
@@ -71,12 +71,14 @@
{
const Esp *esp;
char path[MPR_MAX_FNAME], dir[MPR_MAX_FNAME];
- char *emsg, *buf;
+ char *emsg=NULL, *buf;
int size, i;
esp = ep->esp;
mprAssert(argv);
for (i = 0; i < argc; i++) {
+ const char *extension;
+
if (argv[i][0] != '/') {
mprGetDirName(dir, sizeof(dir), ep->docPath);
mprSprintf(path, sizeof(path), "%s/%s", dir, argv[i]);
@@ -90,10 +92,20 @@
}
buf[size] = '\0';
- if (ejsEvalScript(espGetScriptHandle(ep), buf, 0, &emsg) < 0) {
- espError(ep, "Cant evaluate script");
- mprFree(buf);
- return -1;
+ extension = strrchr(argv[i], '.');
+ /* this makes handling include files in esp scripts much more convenient */
+ if (extension && strcasecmp(extension, ".esp") == 0) {
+ if (espProcessRequest(ep, path, buf, &emsg) != 0) {
+ espError(ep, "Cant evaluate script - %s", emsg?emsg:"");
+ mprFree(buf);
+ return -1;
+ }
+ } else {
+ if (ejsEvalScript(espGetScriptHandle(ep), buf, 0, &emsg) < 0) {
+ espError(ep, "Cant evaluate script - %s", emsg?emsg:"");
+ mprFree(buf);
+ return -1;
+ }
}
mprFree(buf);
}
More information about the samba-cvs
mailing list