* USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Log: wcgi.c,v $
- * Revision 1.12 1996/01/09 10:46:49 adam
+ * Revision 1.13 1996/01/12 10:05:17 adam
+ * If script name ends with ';' HTTP/GET/Expires will be defined.
+ * The cgi interface only reads final handshake if response from
+ * server (shell) was zero-terminated [If it isn't it probably died].
+ *
+ * Revision 1.12 1996/01/09 10:46:49 adam
* New defines: LOGDIR/EGWDIR/CGIDIR set in Makefile.
*
* Revision 1.11 1996/01/08 08:42:19 adam
}
gw_log (GW_LOG_DEBUG, prog, "Reading response");
-#if 1
while ((data = read(linein, combuf, COMBUF)) > 0)
{
gw_log (GW_LOG_DEBUG, prog, "Got %d bytes", data);
gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, prog, "write");
exit (1);
}
+ gw_log (GW_LOG_DEBUG, prog, "writing ack");
+ if (write(lineout, "OK", 2) < 2)
+ gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, prog, "write");
}
-#else
-# if 1
- fcntl (linein, F_SETFL, O_NONBLOCK);
-# endif
- while (1)
- {
- fd_set s_input;
- struct timeval t;
- int r, eof_flag = 0;
-
- t.tv_sec = 10;
- t.tv_usec = 0;
- FD_ZERO(&s_input);
- FD_SET(linein, &s_input);
-# if 0
- FD_SET(1, &s_input);
-# endif
- gw_log (GW_LOG_DEBUG, prog, "select");
- r = select (linein + 1, &s_input, NULL, NULL, &t);
- if (r < 0)
- {
- gw_log (GW_LOG_ERRNO|GW_LOG_FATAL, prog, "select");
- exit(1);
- }
- if (r == 0 || FD_ISSET (linein, &s_input))
- {
- if (r == 0)
- gw_log (GW_LOG_DEBUG, prog, "poll");
- if ((data = read (linein, combuf, COMBUF)) > 0)
- {
- if (combuf[data-1] == '\0')
- {
- --data;
- eof_flag = 1;
- }
- gw_log (GW_LOG_DEBUG, prog, "Got %d bytes", data);
- if (data > 0 && write(1, combuf, data) < data)
- {
- gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, prog, "write");
- exit (1);
- }
- }
- else if (data == -1)
- {
- if (r > 0)
- {
- gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, prog, "read");
- exit (1);
- }
- gw_log (GW_LOG_DEBUG, prog, "poll read");
- }
- else
- break;
- }
- if (eof_flag)
- break;
- if (r > 0 && FD_ISSET (1, &s_input))
- {
- data = read (1, combuf, COMBUF);
- if (data == -1)
- {
- gw_log (GW_LOG_DEBUG|GW_LOG_ERRNO, prog, "stdout closed");
- break;
- }
- if (data == 0)
- {
- gw_log (GW_LOG_DEBUG, prog, "stdout closed");
- break;
- }
- gw_log (GW_LOG_DEBUG, prog, "stdout got %d bytes", data);
- }
- }
-#endif
-
-#if 1
- gw_log (GW_LOG_DEBUG, prog, "writing ack");
- if (write(lineout, "OK", 2) < 2)
- gw_log (GW_LOG_FATAL|GW_LOG_ERRNO, prog, "write");
-#endif
gw_log (GW_LOG_DEBUG, prog, "Cleaning up.");
close(linein);
unlink(serverp);
* USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Log: wirtcl.c,v $
- * Revision 1.11 1996/01/09 16:16:49 adam
+ * Revision 1.12 1996/01/12 10:05:18 adam
+ * If script name ends with ';' HTTP/GET/Expires will be defined.
+ * The cgi interface only reads final handshake if response from
+ * server (shell) was zero-terminated [If it isn't it probably died].
+ *
+ * Revision 1.11 1996/01/09 16:16:49 adam
* Port to OSF/1. Gif references moved from /gif/ to /egwgif/.
*
* Revision 1.10 1996/01/09 10:46:50 adam
{
if (FD_ISSET (i, &fdset_tcl_r))
{
- if (callback_table[i].r_handle);
+ if (callback_table[i].r_handle)
(*callback_table[i].r_handle) (callback_table[i].obj);
}
if (FD_ISSET (i, &fdset_tcl_w))
* USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Log: wproto.c,v $
- * Revision 1.12 1996/01/05 16:35:02 adam
+ * Revision 1.13 1996/01/12 10:05:20 adam
+ * If script name ends with ';' HTTP/GET/Expires will be defined.
+ * The cgi interface only reads final handshake if response from
+ * server (shell) was zero-terminated [If it isn't it probably died].
+ *
+ * Revision 1.12 1996/01/05 16:35:02 adam
* Minor changes.
*
* Revision 1.11 1996/01/05 16:21:21 adam
va_end(ap);
}
-void wo_clear (WCLIENT wc, char *type)
+void wo_clear (WCLIENT wc, const char *type)
{
if (!wc->outbuffer)
wc->outbuffer = malloc(wc->outbuffer_size = OUTBUFFER_CHUNK);
wc->outbuffer_offset = 0;
-#if 0
- wo_printf(wc, "Expires: 0\nContent-type: %s\n\n", type);
-#else
- wo_printf(wc, "Content-type: %s\n\n", type);
-#endif
+ if (type)
+ wo_printf(wc, "Content-type: %s\n\n", type);
}
int wo_puthtml (WCLIENT wc, char *name)
* USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Log: wproto.h,v $
- * Revision 1.4 1995/11/06 10:51:18 adam
+ * Revision 1.5 1996/01/12 10:05:21 adam
+ * If script name ends with ';' HTTP/GET/Expires will be defined.
+ * The cgi interface only reads final handshake if response from
+ * server (shell) was zero-terminated [If it isn't it probably died].
+ *
+ * Revision 1.4 1995/11/06 10:51:18 adam
* End of response marker in response from wsh/wproto to wcgi.
* Shells are respawned when necessary.
*
int wproto_process(WCLIENT wc, int timeout);
WCLIENT wproto_init(void);
void wo_printf(WCLIENT wc, const char *fmt, ...);
-void wo_clear(WCLIENT wc, char *type);
+void wo_clear(WCLIENT wc, const char *type);
int wo_finish(WCLIENT wc);
int wo_flush(WCLIENT wc);
int wo_overflow(WCLIENT wc, char ch);
* USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $Log: wsh.c,v $
- * Revision 1.9 1996/01/09 10:46:51 adam
+ * Revision 1.10 1996/01/12 10:05:22 adam
+ * If script name ends with ';' HTTP/GET/Expires will be defined.
+ * The cgi interface only reads final handshake if response from
+ * server (shell) was zero-terminated [If it isn't it probably died].
+ *
+ * Revision 1.9 1996/01/09 10:46:51 adam
* New defines: LOGDIR/EGWDIR/CGIDIR set in Makefile.
*
* Revision 1.8 1995/12/20 16:31:33 adam
continue;
}
timeout = TIMEOUT;
- wo_clear (wcl, "text/html");
+ wo_clear (wcl, NULL);
strcpy (parms_buf, wcl->wf_parms);
script = parms = parms_buf;
while (*parms && *parms != '/')
*parms++ = '\0';
if (*script)
{
- p = script + strlen(script) - 1;
- while (*p && p != script)
+ p = script + strlen(script);
+ while (*--p && p != script)
switch (*p)
{
case '+':
wproto_cache (wcl, atoi(p+1));
*p = '\0';
break;
- default:
- --p;
+ 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 = ' ';