* USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Log: wshmain.c,v $
+ * 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.
{
char *p;
int r;
+ int raw_mode = 0;
r = wproto_process (wcl, timeout);
if (r <= 0)
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])
*p = '\0';
break;
}
+#else
+ p = script;
+ while (*p)
+ {
+ if (*p == ';') /* ";" or ";<date>" */
+ {
+ 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 == '+') /* "+<name>=<value>" or "+<name>" */
+ {
+ 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 = ' ';
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, "<html><head><title>wsh error</title></head>\n");
wo_printf (wcl, "<body>Couldn't execute script %s</body></html>",
script);