$Log$
+Revision 211.17 2000/05/07 23:46:55 ajc
+* added Date: and Last-Modified: headers to HTTP output
+* masquerade room/host screen now runs in wholist window, and returns to it
+
Revision 211.16 2000/05/02 17:32:06 ajc
* Font related changes to html
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
#include "webcit.h"
+char *ascmonths[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
+char *ascdays[] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
char *safestrncpy(char *dest, const char *src, size_t n)
void fmt_date(char *buf, time_t thetime) {
struct tm *tm;
- char *ascmonths[] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
-
strcpy(buf, "");
tm = localtime(&thetime);
( (tm->tm_hour > 12) ? "pm" : "am" )
);
}
+
+
+
+
+/*
+ * Format a date/time stamp to the format used in HTTP headers
+ */
+void httpdate(char *buf, time_t thetime) {
+ struct tm *tm;
+
+ strcpy(buf, "");
+ tm = localtime(&thetime);
+
+ sprintf(buf, "%s, %02d %s %4d %02d:%02d:%02d",
+ ascdays[tm->tm_wday],
+ tm->tm_mday,
+ ascmonths[tm->tm_mon],
+ tm->tm_year + 1900,
+ tm->tm_hour,
+ tm->tm_min,
+ tm->tm_sec
+ );
+}
+
+
+
+
+
+
+
+
char cookie[256];
int print_standard_html_head = 0;
int refresh30 = 0;
+ char httpnow[256];
print_standard_html_head = controlcode & 0x03;
refresh30 = ((controlcode & 0x04) >> 2);
wprintf("HTTP/1.0 200 OK\n");
+ httpdate(httpnow, time(NULL));
+
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("Date: %s\n"
+ "Last-modified: %s\n", httpnow, httpnow);
}
stuff_to_cookie(cookie, WC->wc_session, WC->wc_username,
WC->wc_password, WC->wc_roomname);
void output_static(char *what)
{
char buf[4096];
+ char datebuf[256];
long thisblock;
FILE *fp;
struct stat statbuf;
bytes = statbuf.st_size;
fprintf(stderr, "Static: %s, %ld bytes\n", what, bytes);
wprintf("Content-length: %ld\n", (long) bytes);
+
+ httpdate(datebuf, time(NULL));
+ wprintf("Date: %s\n", datebuf);
+
+ httpdate(datebuf, statbuf.st_mtime);
+ wprintf("Last-modified: %s\n", datebuf);
+
wprintf("\n");
while (bytes > 0) {
thisblock = sizeof(buf);
void *cbcontent, char *cbtype, size_t cblength)
);
void fmt_date(char *buf, time_t thetime);
+void httpdate(char *buf, time_t thetime);
void end_webcit_session(void);
}
if (wlist->sessionnum == serv_info.serv_pid) {
wprintf(" <A HREF=\"/edit_me\" "
- "TARGET=\"_parent\">(edit)</A>");
+ ">(edit)</A>");
}
/* username */
wprintf("</TD>\n\t<TD>");
wprintf("<TABLE BORDER=0 BGCOLOR=\"#003399\">\n<TR><TD ALIGN=center VALIGN=center CELLPADING=20>\n");
wprintf("<B><A HREF=\"javascript:window.close();\">Close window</A></B>\n");
wprintf("</TD></TR>\n</TABLE></FONT>\n</CENTER>");
+
wDumpContent(1);
}
whobbs();
} else {
- output_headers(1);
+ output_headers(3);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"><B>");