$Log$
+Revision 400.3 2002/09/13 20:40:53 ajc
+* Detect when the client browser is capable of gzip encoding
+ (actual encoding is not implemented yet)
+
Revision 400.2 2002/09/13 15:54:40 ajc
* Reversed the above change because I broke it somehow
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
AC_CANONICAL_HOST
+AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present])
+
dnl Set some system-specific variables which are OK to set before compiler
dnl checks:
PTHREAD_DEFS=-D_REENTRANT
dnl AC_CHECK_FUNCS(strerror)
AC_REPLACE_FUNCS(snprintf)
+dnl Checks for the zlib compression library.
+if test "x$with_zlib" != xno ; then
+ AC_CHECK_HEADERS(zlib.h,
+ [AC_CHECK_LIB(z, zlibVersion,
+ [ok_zlib=yes],,
+ )])
+fi
+
+if test "x$ok_zlib" != xno ; then
+ LIBS="-lz $LIBS"
+ CFLAGS="-DWITH_ZLIB $CFLAGS"
+ AC_DEFINE(HAVE_ZLIB)
+fi
+
AC_OUTPUT(Makefile)
#include <stdarg.h>
#include <pthread.h>
#include <signal.h>
+
+#ifdef WITH_ZLIB
+#include <zlib.h>
+#endif
+
#include "webcit.h"
#include "webserver.h"
return(0);
}
}
+
return(0);
}
int desired_session = 0;
int got_cookie = 0;
struct wcsession *TheSession, *sptr;
+ char enc[SIZ];
+ char encodings[SIZ];
+ int gzip = 0;
+ int i;
/*
* Find out what it is that the web browser is asking for
memset(hold, 0, sizeof(hold));
do {
if (req_gets(sock, buf, hold) < 0) return;
+
if (!strncasecmp(buf, "Cookie: webcit=", 15)) {
cookie_to_stuff(&buf[15], &desired_session,
NULL, NULL, NULL);
got_cookie = 1;
}
+ if (!strncasecmp(buf, "Accept-encoding: ", 17)) {
+ extract_token(encodings, &buf[17], 0, ';');
+ for (i=0; i<num_tokens(encodings, ','); ++i) {
+ extract_token(enc, encodings, i, ',');
+ if (!strcasecmp(enc, "gzip")) {
+ gzip = 1;
+ }
+ }
+ }
+
hptr = (struct httprequest *)
malloc(sizeof(struct httprequest));
if (req == NULL)
pthread_setspecific(MyConKey, (void *)TheSession);
TheSession->http_sock = sock;
TheSession->lastreq = time(NULL); /* log */
- session_loop(req); /* perform the requested transaction */
+ session_loop(req, gzip); /* perform the requested transaction */
pthread_mutex_unlock(&TheSession->SessionMutex); /* unbind */
/* Free the request buffer */
void embed_room_banner(char *);
void smart_goto(char *);
void worker_entry(void);
-void session_loop(struct httprequest *);
+void session_loop(struct httprequest *, int gzip);
void fmt_date(char *buf, time_t thetime);
void httpdate(char *buf, time_t thetime);
void end_webcit_session(void);