X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=www%2Fwshmain.c;h=a3120bdaeb8516e9a2cae8d0170bbd5374d782ff;hb=1140389ab96fc8ca7bc9c8dc642adbcec625f4a6;hp=74d96eed1779c97a958127b5ee24c2bd7a4bae60;hpb=cfd53e6da1790969cb800d187f81cc63c18859ce;p=egate.git diff --git a/www/wshmain.c b/www/wshmain.c index 74d96ee..a3120bd 100644 --- a/www/wshmain.c +++ b/www/wshmain.c @@ -41,6 +41,15 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wshmain.c,v $ + * Revision 1.6 1997/01/27 11:27:16 adam + * Implemented a new command, egw_clear, to clear http output cache. + * Changed prototype for function wo_clear. + * + * Revision 1.5 1997/01/24 13:13:12 adam + * Implemnted egw_source and added a "raw" option to the URL. + * Fixed a bug in the buffering system of wproto; the macro wo_putc could + * override memory if it was the first HTML generating function called. + * * Revision 1.4 1996/05/23 15:53:12 adam * Bug fix: egw_enc failed on 8-bit chars. * New command: egw_parms. @@ -120,6 +129,7 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) { char *p; int r; + int raw_mode = 0; r = wproto_process (wcl, timeout); if (r <= 0) @@ -134,7 +144,7 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) timeout = atoi (gw_res_get (shRes, "timeout", "120")); if (timeout < 1) timeout = 1; - wo_clear (wcl, NULL); + wo_clear (wcl); strcpy (parms_buf, wcl->wf_parms); parms = parms_buf; @@ -142,13 +152,13 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) if (*script) { +#if 0 p = script + strlen(script); while (*--p && p != script) switch (*p) { case '+': wproto_cache (wcl, wcl->cache_level+1); - *p = '\0'; break; case '-': if (p[1]) @@ -168,8 +178,53 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) *p = '\0'; break; } +#else + p = script; + while (*p) + { + if (*p == ';') /* ";" or ";" */ + { + wo_printf (wcl, "Expires: %s\n", p[1] ? p+1 : "0"); + gw_log (GW_LOG_DEBUG, mod, "Expires: %s", p[1] ?p+1:"0"); + *p = '\0'; + break; + } + else if (*p == '+') /* "+=" or "+" */ + { + const char *name1 = NULL; + const char *name2 = NULL; + const char *value1 = NULL; + const char *value2 = NULL; + int len; + *p = '\0'; + name1 = ++p; + while (*p && *p != ';' && *p != '+') + { + if (*p == '=') + { + name2 = p++; + value1 = p; + while (*p && *p != ';' && *p != '+') + p++; + value2 = p; + break; + } + p++; + } + if (!name2) + name2 = p; + len = name2 - name1; + if (len == 3 && !memcmp (name1, "raw", len)) + raw_mode = 1; + } + else + p++; + } + *p = '\0'; +#endif } - wo_printf (wcl, "Content-type: text/html\n\n"); + if (!raw_mode) + wo_printf (wcl, "Content-type: text/html\n\n"); for (p = parms; *p; p++) if (*p == '+') *p = ' '; @@ -177,6 +232,8 @@ void wshmain (int argc, char **argv, W_Interp_Type w_interp_type) gw_log (GW_LOG_STAT, mod, "parms: %s", parms); if (w_interp_exec (w_interp, script, parms)) { + if (raw_mode) + wo_printf (wcl, "Content-type: text/html\n\n"); wo_printf (wcl, "wsh error\n"); wo_printf (wcl, "Couldn't execute script %s", script);