$Log$
+Revision 1.110 1999/12/03 16:37:46 ajc
+* Repaired HTTP output for image transfers and static content
+
Revision 1.109 1999/12/03 05:09:54 ajc
* Rewrote the HTTP engine and application coupling to run in a worker thread
model and to run as a single multithreaded program (eliminated helper
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
static char *unset = "; expires=28-May-1971 18:10:00 GMT";
char cookie[256];
- wprintf("Content-type: text/html\n");
- wprintf("Server: %s\n", SERVER);
- wprintf("Connection: close\n");
-
if (print_standard_html_head > 0) {
+ wprintf("Content-type: text/html\n");
+ wprintf("Server: %s\n", SERVER);
+ wprintf("Connection: close\n");
wprintf("Pragma: no-cache\n");
wprintf("Cache-Control: no-store\n");
}
wprintf("Set-cookie: webcit=%s\n", cookie);
}
- wprintf("\n");
-
if (print_standard_html_head > 0) {
+ wprintf("\n");
wprintf("<HTML><HEAD><TITLE>");
escputs(serv_info.serv_humannode);
wprintf("</TITLE>\n"
void output_static(char *what)
{
- char buf[256];
+ char buf[4096];
+ long thisblock;
FILE *fp;
struct stat statbuf;
off_t bytes;
fstat(fileno(fp), &statbuf);
bytes = statbuf.st_size;
+ fprintf(stderr, "Static: %s, %ld bytes\n", what, bytes);
wprintf("Content-length: %ld\n", (long) bytes);
- printf("\n");
- while (bytes--) {
- wprintf("%c", getc(fp) );
+ wprintf("\n");
+ while (bytes > 0) {
+ thisblock = sizeof(buf);
+ if (thisblock > bytes) thisblock = bytes;
+ fread(buf, thisblock, 1, fp);
+ write(WC->http_sock, buf, thisblock);
+ bytes = bytes - thisblock;
}
fclose(fp);
}
}
+/*
+ * When the browser requests an image file from the Citadel server,
+ * this function is called to transmit it.
+ */
void output_image()
{
char buf[256];
bytes = bytes - thisblock;
accomplished = accomplished + thisblock;
}
- fflush(stdout);
serv_puts("CLOS");
serv_gets(buf);
} else {
}
}
- ++TransactionCount;
+ ++TransactionCount; /* FIX ... make session-specific OR remove */
if (ContentLength > 0) {
content = malloc(ContentLength + 1);