$Log$
+Revision 1.113 1999/12/04 22:16:05 ajc
+* Moved all diagnostic output to stderr
+* Moved "HTTP/1.0 200 OK" output to output_headers()
+
Revision 1.112 1999/12/04 21:56:59 ajc
* Finished the overhaul. Now to tune...
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
{
char buf[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(3);
/* Da banner */
strcpy(WC->wc_password, "");
strcpy(WC->wc_roomname, "");
- wprintf("HTTP/1.0 200 OK\n");
output_headers(2); /* note "2" causes cookies to be unset */
wprintf("<CENTER>");
char buf[256];
int a;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
strcpy(buf, bstr("user"));
char buf[256];
int a;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
{
char buf[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
* Create a new session if we have to
*/
if (TheSession == NULL) {
- printf("Creating a new session\n");
+ fprintf(stderr, "Creating a new session\n");
TheSession = (struct wcsession *)
malloc(sizeof(struct wcsession));
memset(TheSession, 0, sizeof(struct wcsession));
display_error(&buf[4]);
return;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
{
int a;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
*/
void display_main_menu(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
embed_main_menu();
wDumpContent(2);
void display_advanced_menu(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
embed_advanced_menu();
embed_main_menu();
*/
void display_generic(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770077><TR><TD>");
return;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
serv_printf("%s", bstr("g_cmd"));
char buf[256];
if (as_single_page) {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(0);
wprintf("<HTML>\n"
"<HEAD>\n"
int a;
int nummsgs;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\"><CENTER><B>%s - ", WC->wc_roomname);
char buf[256];
static long dont_post = (-1L);
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\">");
long now;
struct tm *tm;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<FACE=\"Arial,Helvetica,sans-serif\">");
msgid = atol(bstr("msgid"));
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
msgid = atol(bstr("msgid"));
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
if (!strcasecmp(bstr("yesno"), "Yes")) {
msgid = atol(bstr("msgid"));
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
msgid = atol(bstr("msgid"));
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
if (!strcasecmp(bstr("yesno"), "Move")) {
strcpy(node, bstr("node"));
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
char buf[256];
char node[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
char node[256];
char sroom[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
{
char node[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
serv_puts(buf);
serv_gets(buf);
if (buf[0] == '1') {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
server_to_text();
wprintf("<A HREF=\"/display_netconf\">Back to menu</A>\n");
serv_puts(buf);
serv_gets(buf);
if (buf[0] == '1') {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
server_to_text();
wprintf("<A HREF=\"/display_netconf\">Back to menu</A>\n");
void display_add_node(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
serv_puts(buf);
serv_gets(buf);
if (buf[0] == '1') {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
server_to_text();
wprintf("<A HREF=\"/display_netconf\">Back to menu</A>\n");
strcpy(node, bstr("node"));
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
serv_puts(buf);
serv_gets(buf);
if (buf[0] == '1') {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
server_to_text();
wprintf("<A HREF=\"/display_netconf\">Back to menu</A>\n");
char buf[256];
char user[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
char sc[256];
char buf[256];
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
strcpy(recp, bstr("recp"));
void do_chat(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
load_floorlist();
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE width=100% border><TR><TH>Floor</TH>");
*/
void zapped_list(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"");
if (display_name) {
- wprintf("HTTP/1.0 200 OK\n");
- printf("Pragma: no-cache\n");
- printf("Cache-Control: no-store\n");
output_headers(0);
+ wprintf("Pragma: no-cache\n");
+ wprintf("Cache-Control: no-store\n");
wprintf("<HTML><HEAD>\n"
"<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
er_floor = extract_int(&buf[4], 4);
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
display_error(&buf[4]);
return;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");
void display_private(char *rname, int req_pass)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
display_private(bstr("gr_name"), 1);
return;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("%s\n", &buf[4]);
wDumpContent(1);
*/
void display_zap(void)
{
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
display_error(&buf[4]);
return;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT SIZE=+1 COLOR=\"FFFFFF\"");
char buf[256];
int i;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
serv_printf("CONF get");
display_error(&buf[4]);
return;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
char buf[256];
if (strcmp(bstr("sc"), "Save")) {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("Cancelled. %s was not saved.<BR>\n", description);
wDumpContent(1);
if (regoto) {
smart_goto(WC->wc_roomname);
} else {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("%s has been saved.\n", description);
wDumpContent(1);
strcpy(bptr->name, buf);
bio = bptr;
}
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
serv_puts("LIST");
char buf[256];
int have_pic;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
static char *unset = "; expires=28-May-1971 18:10:00 GMT";
char cookie[256];
+ wprintf("HTTP/1.0 200 OK\n");
+
if (print_standard_html_head > 0) {
wprintf("Content-type: text/html\n");
wprintf("Server: %s\n", SERVER);
wprintf("\n");
wprintf("Cannot open %s: %s\n", what, strerror(errno));
} else {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(0);
if (!strncasecmp(&what[strlen(what) - 4], ".gif", 4))
serv_gets(buf);
if (buf[0] == '2') {
bytes = extract_long(&buf[4], 0);
- wprintf("HTTP/1.0 200 OK\n");
output_headers(0);
wprintf("Content-type: image/gif\n");
wprintf("Content-length: %ld\n", (long) bytes);
} else if (!strcasecmp(action, "display_menubar")) {
display_menubar(1);
} else if (!strcasecmp(action, "diagnostics")) {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("You're in session %d<HR>\n", WC->wc_session);
sin.sin_addr.s_addr = INADDR_ANY;
if (port_number == 0) {
- printf("webcit: Cannot start: no port number specified.\n");
+ fprintf(stderr,
+ "webcit: Cannot start: no port number specified.\n");
exit(1);
}
sin.sin_port = htons((u_short) port_number);
s = socket(PF_INET, SOCK_STREAM, (getprotobyname("tcp")->p_proto));
if (s < 0) {
- printf("webcit: Can't create a socket: %s\n",
+ fprintf(stderr, "webcit: Can't create a socket: %s\n",
strerror(errno));
exit(errno);
}
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &i, sizeof(i));
if (bind(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
- printf("webcit: Can't bind: %s\n", strerror(errno));
+ fprintf(stderr, "webcit: Can't bind: %s\n", strerror(errno));
exit(errno);
}
if (listen(s, queue_len) < 0) {
- printf("webcit: Can't listen: %s\n", strerror(errno));
+ fprintf(stderr, "webcit: Can't listen: %s\n", strerror(errno));
exit(errno);
}
return (s);
retval = write(sock, &buf[bytes_written],
nbytes - bytes_written);
if (retval < 1) {
- printf("client_write() failed: %s\n",
+ fprintf(stderr, "client_write() failed: %s\n",
strerror(errno));
- pthread_exit(NULL);
}
bytes_written = bytes_written + retval;
}
}
rlen = read(sock, &buf[len], bytes - len);
if (rlen < 1) {
- printf("client_read() failed: %s\n",
+ fprintf(stderr, "client_read() failed: %s\n",
strerror(errno));
- pthread_exit(NULL);
}
len = len + rlen;
}
* There is no need to check for errors, because ig_tcp_server()
* exits if it doesn't succeed.
*/
- printf("Attempting to bind to port %d...\n", port);
+ fprintf(stderr, "Attempting to bind to port %d...\n", port);
msock = ig_tcp_server(port, 5);
- printf("Listening on socket %d\n", msock);
+ fprintf(stderr, "Listening on socket %d\n", msock);
signal(SIGPIPE, SIG_IGN);
pthread_mutex_init(&SessionListMutex, NULL);
if (pthread_create(&SessThread, &attr,
(void *(*)(void *)) worker_entry, NULL)
!= 0) {
- printf("webcit: can't create thread: %s\n",
+ fprintf(stderr, "webcit: can't create thread: %s\n",
strerror(errno));
}
}
ssock = accept(msock, (struct sockaddr *) &fsin, &alen);
pthread_mutex_unlock(&AcceptQueue);
- printf("New connection on socket %d\n", ssock);
if (ssock < 0) {
- printf("webcit: accept() failed: %s\n",
+ fprintf(stderr, "webcit: accept() failed: %s\n",
strerror(errno));
} else {
/* Set the SO_REUSEADDR socket option */
char buf[256], sess, user[256], room[256], host[256];
int foundit;
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=007700><TR><TD>");
display_error(&buf[4]);
}
} else {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=770000><TR><TD>");
wprintf("<FONT FACE=\"Arial,Helvetica,sans-serif\" SIZE=+1 COLOR=\"FFFFFF\"<B>Confirm session termination");
whobbs();
} else {
- wprintf("HTTP/1.0 200 OK\n");
output_headers(1);
wprintf("<TABLE WIDTH=100% BORDER=0 BGCOLOR=000077><TR><TD>");