- wo_clear(wcl, "text/html");
- wo_printf(wcl, "<HTML><TITLE>INDEX</TITLE>\n");
- strcpy(parms, wcl->wf_parms);
- argument = p = parms;
- while (*p && *p != '/')
- p++;
- if (*p == '/')
- *(p++) = '\0';
- gw_log (GW_LOG_DEBUG, mod, "command: %s", argument);
- wo_printf (wcl, "<BODY>hej - %s</BODY>\n", argument);
+ gw_log (GW_LOG_FATAL, mod, "Cannot determine shell type. prog=%s",
+ *argv);
+ exit (1);
+ }
+ w_interp_load_state (w_interp, NULL);
+ timeout = atoi (gw_res_get (shRes, "timeout", "120"));
+ if (timeout < 1)
+ timeout = 1;
+ while (1)
+ {
+ char *p;
+ int r;
+
+ r = wproto_process (wcl, timeout);
+ if (r <= 0)
+ {
+ gw_db = gw_db_open ("www.db", 0, 0);
+ if (gw_db)
+ break;
+ gw_log (GW_LOG_DEBUG, mod, "Cannot terminate - new request");
+ timeout = 10;
+ continue;
+ }
+ timeout = atoi (gw_res_get (shRes, "timeout", "120"));
+ if (timeout < 1)
+ timeout = 1;
+ wo_clear (wcl, NULL);
+ strcpy (parms_buf, wcl->wf_parms);
+ script = parms = parms_buf;
+ while (*parms && *parms != '/')
+ parms++;
+ if (*parms)
+ *parms++ = '\0';
+ if (*script)
+ {
+ 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])
+ wproto_cache (wcl, wcl->cache_level-atoi(p+1));
+ else
+ wproto_cache (wcl, wcl->cache_level-1);
+ *p = '\0';
+ break;
+ case '=':
+ if (isdigit(p[1]))
+ wproto_cache (wcl, atoi(p+1));
+ *p = '\0';
+ break;
+ case ';':
+ 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;
+ }
+ }
+ wo_printf (wcl, "Content-type: text/html\n\n");
+ for (p = parms; *p; p++)
+ if (*p == '+')
+ *p = ' ';
+ gw_log (GW_LOG_STAT, mod, "script: %s", script);
+ gw_log (GW_LOG_STAT, mod, "parms: %s", parms);
+ if (w_interp_exec (w_interp, script, parms))
+ {
+ wo_printf (wcl, "<html><head><title>wsh error</title></head>\n");
+ wo_printf (wcl, "<body>Couldn't execute script %s</body></html>",
+ script);
+ }