diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-09-01 10:57:21 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-09-01 10:57:21 +0000 |
commit | a6b4c0df5f74d1238337f41d1d13f4f168ad01f1 (patch) | |
tree | ae171319a76a707e9f3aa638b7c690e40c9f5d5e /cpukit/httpd/asp.c | |
parent | 2000-08-31 Ralf Corsepius <corsepiu@faw.uni-ulm.de> (diff) | |
download | rtems-a6b4c0df5f74d1238337f41d1d13f4f168ad01f1.tar.bz2 |
2000-08-30 Joel Sherrill <joel@OARcorp.com>
* Merged version 2.1 of GoAhead webserver. This update
was submitted by Antti P Miettinen <antti.p.miettinen@nokia.com>.
* NOTES, base64.c, ejIntrn.h, emfdb.c, emfdb.h, md5.h, md5c.c,
um.c, um.h: New files.
* wbase64.c: Removed.
* Makefile.am, asp.c, balloc.c, default.c, ej.h, ejlex.c, ejparse.c,
form.c, h.c, handler.c, mime.c, misc.c, ringq.c, rom.c, security.c,
socket.c, sym.c, uemf.c, uemf.h, url.c, value.c, webcomp.c, webmain.c,
webpage.c, webrom.c, webs.c, webs.h, websuemf.c, wsIntrn.h: Modified.
Diffstat (limited to 'cpukit/httpd/asp.c')
-rw-r--r-- | cpukit/httpd/asp.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/cpukit/httpd/asp.c b/cpukit/httpd/asp.c index 4611a8f422..9b37523e02 100644 --- a/cpukit/httpd/asp.c +++ b/cpukit/httpd/asp.c @@ -1,7 +1,7 @@ /* * asp.c -- Active Server Page Support * - * Copyright (c) Go Ahead Software Inc., 1995-1999. All Rights Reserved. + * Copyright (c) GoAhead Software Inc., 1995-2000. All Rights Reserved. * * See the file "license.txt" for usage and redistribution license requirements */ @@ -20,11 +20,12 @@ /********************************** Locals ************************************/ -static sym_fd_t websAspFunctions = -1; /* Symbol table of functions */ +static sym_fd_t websAspFunctions = -1; /* Symbol table of functions */ +static int aspOpenCount = 0; /* count of apps using this module */ /***************************** Forward Declarations ***************************/ -static char_t *strtokcmp(char_t* s1, char_t* s2); +static char_t *strtokcmp(char_t *s1, char_t *s2); static char_t *skipWhite(char_t *s); /************************************* Code ***********************************/ @@ -34,15 +35,17 @@ static char_t *skipWhite(char_t *s); int websAspOpen() { + if (++aspOpenCount == 1) { /* * Create the table for ASP functions */ - websAspFunctions = symOpen(128); + websAspFunctions = symOpen(WEBS_SYM_INIT * 2); /* * Create standard ASP commands */ - websAspDefine(T("write"), websAspWrite); + websAspDefine(T("write"), websAspWrite); + } return 0; } @@ -53,8 +56,11 @@ int websAspOpen() void websAspClose() { - if (websAspFunctions != -1) { - symClose(websAspFunctions, NULL); + if (--aspOpenCount <= 0) { + if (websAspFunctions != -1) { + symClose(websAspFunctions); + websAspFunctions = -1; + } } } @@ -65,7 +71,7 @@ void websAspClose() * documents, it is better to make them plain HTML files rather than ASPs. */ -int websAspRequest(webs_t wp, char_t* lpath) +int websAspRequest(webs_t wp, char_t *lpath) { websStatType sbuf; char *rbuf; @@ -84,7 +90,7 @@ int websAspRequest(webs_t wp, char_t* lpath) path = websGetRequestPath(wp); /* - * Create Ejscript instance incase it is needed + * Create Ejscript instance in case it is needed */ ejid = ejOpenEngine(wp->cgiVars, websAspFunctions); if (ejid < 0) { @@ -112,12 +118,12 @@ int websAspRequest(webs_t wp, char_t* lpath) websError(wp, 200, T("Cant read %s"), lpath); goto done; } - websCloseFileHandle(wp); + websPageClose(wp); /* * Convert to UNICODE if necessary. */ - if ((buf = ballocAscToUni(rbuf)) == NULL) { + if ((buf = ballocAscToUni(rbuf, len)) == NULL) { websError(wp, 200, T("Can't get memory")); goto done; } @@ -220,7 +226,7 @@ int websAspRequest(webs_t wp, char_t* lpath) */ done: if (websValid(wp)) { - websCloseFileHandle(wp); + websPageClose(wp); if (ejid >= 0) { ejCloseEngine(ejid); } @@ -252,9 +258,9 @@ int websAspWrite(int ejid, webs_t wp, int argc, char_t **argv) int i; a_assert(websValid(wp)); - a_assert(argv); - + for (i = 0; i < argc; ) { + a_assert(argv); if (websWriteBlock(wp, argv[i], gstrlen(argv[i])) < 0) { return -1; } @@ -273,7 +279,7 @@ int websAspWrite(int ejid, webs_t wp, int argc, char_t **argv) * Return a pointer to the location in s1 after s2 ends. */ -static char_t* strtokcmp(char_t* s1, char_t* s2) +static char_t *strtokcmp(char_t *s1, char_t *s2) { int len; @@ -310,4 +316,4 @@ static char_t *skipWhite(char_t *s) return s; } -/******************************************************************************/
\ No newline at end of file +/******************************************************************************/ |