]> code.citadel.org Git - citadel.git/blobdiff - webcit/context_loop.c
* When the "begin_burst() / end_burst()" semantics are in use, perform
[citadel.git] / webcit / context_loop.c
index 12a641e1aa8a8768c08ee14ea4fd1decbb4bed28..fdd97a819a10c60c240c82b0b4ebf07e598e9700 100644 (file)
@@ -113,7 +113,7 @@ void do_housekeeping(void)
                pthread_mutex_unlock(&sessions_to_kill->SessionMutex);
                sptr = sessions_to_kill->next;
                free(sessions_to_kill);
-               sessions_to_kill = sessions_to_kill->next;
+               sessions_to_kill = sptr;
                --num_sessions;
        }
 
@@ -267,6 +267,7 @@ void context_loop(int sock)
        char buf[SIZ], hold[SIZ];
        int desired_session = 0;
        int got_cookie = 0;
+       int gzip_ok = 0;
        struct wcsession *TheSession, *sptr;
        char httpauth_string[SIZ];
        char httpauth_user[SIZ];
@@ -283,6 +284,15 @@ void context_loop(int sock)
        do {
                if (req_gets(sock, buf, hold) < 0) return;
 
+               /*
+                * Can we compress?
+                */
+               if (!strncasecmp(buf, "Accept-encoding:", 16)) {
+                       if (strstr(&buf[16], "gzip")) {
+                               gzip_ok = 1;
+                       }
+               }
+
                /*
                 * Browser-based sessions use cookies for session authentication
                 */
@@ -416,6 +426,7 @@ void context_loop(int sock)
        pthread_setspecific(MyConKey, (void *)TheSession);
        TheSession->http_sock = sock;
        TheSession->lastreq = time(NULL);                       /* log */
+       TheSession->gzip_ok = gzip_ok;
        session_loop(req);                              /* do transaction */
        pthread_mutex_unlock(&TheSession->SessionMutex);        /* unbind */