$Log$
+Revision 301.6 2001/08/22 16:38:06 ajc
+* Added the "-c" command line option to generate optional cookies indicating
+ the host name of the server. This makes it easy to put a cluster of WebCit
+ servers behind (for example) an Arrowpoint load balancer.
+
Revision 301.5 2001/08/21 04:02:56 ajc
* Added some more meta-tags to (hopefully) prevent the "lame goto" caused by
unwanted page caching
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
Several command-line options are also available. Here's the usage for
the "webserver" program:
- webserver [-p localport] [-t tracefile] [remotehost [remoteport]]
+ webserver [-p localport] [-t tracefile] [-c] [remotehost [remoteport]]
*or*
- webserver [-p localport] [-t tracefile] uds /your/citadel/directory
+ webserver [-p localport] [-t tracefile] [-c] uds /your/citadel/directory
Explained:
-> tracefile: where you want WebCit to log to. This can be a file, a
virtual console, or /dev/null to suppress logging altogether.
+ -> The "-c" option causes WebCit to output an extra cookie containing the
+ identity of the WebCit server. The cookie will look like this:
+ Set-cookie: wcserver=your.host.name
+ This is useful if you have a cluster of WebCit servers sitting behind a
+ load balancer, and the load balancer has the ability to use cookies to
+ keep track of which server to send HTTP requests to.
+
-> remotehost: the name or IP address of the host on which your Citadel/UX
server is running. The default is "localhost". (NOTE: if you run
WebCit and the Citadel/UX server on different hosts, the real-time chat
wprintf("Set-cookie: webcit=%s\n", unset);
} else {
wprintf("Set-cookie: webcit=%s\n", cookie);
+ if (server_cookie != NULL) {
+ wprintf("%s\n", server_cookie);
+ }
}
if (print_standard_html_head > 0) {
wprintf("</TITLE>\n"
"<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n"
"<META HTTP-EQUIV=\"expired\" CONTENT=\"28-May-1971 18:10:00 GMT\">\n"
- "<meta name=\"MSSmartTagsPreventParsing\" content=\"TRUE\">\n");
+ "<META NAME=\"MSSmartTagsPreventParsing\" CONTENT=\"TRUE\">\n");
if (refresh30) wprintf(
"<META HTTP-EQUIV=\"refresh\" CONTENT=\"30\">\n");
else wprintf(
extern char floorlist[128][256];
extern char *axdefs[];
extern char *defaulthost, *defaultport;
+extern char *server_cookie;
extern struct wcsubst *global_subst;
extern pthread_key_t MyConKey;
-
+char *server_cookie = NULL;
char *defaulthost = DEFAULT_HOST;
char tracefile[PATH_MAX];
/* Parse command line */
- while ((a = getopt(argc, argv, "hp:t:")) != EOF)
+ while ((a = getopt(argc, argv, "hp:t:c")) != EOF)
switch (a) {
case 'p':
port = atoi(optarg);
freopen(tracefile, "w", stderr);
freopen(tracefile, "r", stdin);
break;
+ case 'c':
+ server_cookie = malloc(256);
+ if (server_cookie != NULL) {
+ strcpy(server_cookie, "Set-cookie: wcserver=");
+ if (gethostname(
+ &server_cookie[strlen(server_cookie)],
+ 200) != 0) {
+ fprintf(stderr, "gethostname: %s\n",
+ strerror(errno));
+ free(server_cookie);
+ }
+ }
+ break;
default:
fprintf(stderr, "usage: webserver [-p localport] "
- "[-t tracefile] "
+ "[-t tracefile] [-c] "
"[remotehost [remoteport]]\n");
return 1;
}