* Strip prepended '/webcit' in requested url's. This may allow us to handle
authorArt Cancro <ajc@citadel.org>
Sun, 13 Nov 2005 04:19:15 +0000 (04:19 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 13 Nov 2005 04:19:15 +0000 (04:19 +0000)
  incoming proxy requests from a front end web server.
* Don't require a session cookie for static content.

webcit/ChangeLog
webcit/auth.c
webcit/context_loop.c

index 8b6a7680c215f8ef27886b8c236424f7f6baebc4..661b86007a12c56e91fe5157f1141d1a873f22e4 100644 (file)
@@ -1,5 +1,9 @@
 $Id$
 
+* Strip prepended '/webcit' in requested url's.  This may allow us to handle
+  incoming proxy requests from a front end web server.
+* Don't require a session cookie for static content.
+
 Thu Nov 10 17:37:32 EST 2005 ajc
 * Completed the implementation of a simple drop target for messages.  Right
   now it just drops to trash.  Need to do a folder list drop now.
index 423e3d4c2203491392976374c16959017b03bb46..9d941b87ee739e8a446c0f675f83af9bfb4adca4 100644 (file)
@@ -198,6 +198,9 @@ void do_welcome(void)
                safestrncpy(buf, "dotskip&room=_BASEROOM_", sizeof buf);
                set_preference("startpage", buf, 1);
        }
+       if (buf[0] == '/') {
+               strcpy(buf, &buf[1]);
+       }
        http_redirect(buf);
 }
 
index b5ccd4fde3e8c903521348f8648b4cb3efad4d18..6673a4f679e9e20c81c323aa3bb49b9b5a65b707 100644 (file)
@@ -246,6 +246,7 @@ void context_loop(int sock)
        char httpauth_string[SIZ];
        char httpauth_user[SIZ];
        char httpauth_pass[SIZ];
+       char *ptr = NULL;
 
        strcpy(httpauth_string, "");
        strcpy(httpauth_user, DEFAULT_HTTPAUTH_USER);
@@ -305,6 +306,24 @@ void context_loop(int sock)
 
        } while (strlen(buf) > 0);
 
+       /*
+        * If the request is prefixed by "/webcit" then chop that off.  This
+        * allows a front end web server to forward all /webcit requests to us
+        * while still using the same web server port for other things.
+        */
+       
+       ptr = strstr(req->line, " /webcit ");   /* Handle "/webcit" */
+       if (ptr != NULL) {
+               strcpy(ptr+2, ptr+8);
+       }
+
+       ptr = strstr(req->line, " /webcit");    /* Handle "/webcit/" */
+       if (ptr != NULL) {
+               strcpy(ptr+1, ptr+8);
+       }
+
+       /* Begin parsing the request. */
+
        safestrncpy(buf, req->line, sizeof buf);
        lprintf(5, "HTTP: %s\n", buf);
 
@@ -312,9 +331,7 @@ void context_loop(int sock)
        if (is_bogus(buf)) goto bail;
 
        /*
-        * If requesting a non-root page, there should already be a cookie
-        * set.  If there isn't, the client browser has cookies turned off
-        * (or doesn't support them) and we have to barf & bail.
+        * Strip out the method, leaving the URL up front...
         */
        remove_token(buf, 0, ' ');
        if (buf[1]==' ') buf[1]=0;
@@ -341,6 +358,7 @@ void context_loop(int sock)
                && (strncasecmp(buf, "/freebusy", 9))
                && (strncasecmp(buf, "/do_logout", 10))
                && (strncasecmp(buf, "/groupdav", 9))
+               && (strncasecmp(buf, "/static", 7))
                && (strncasecmp(buf, "/rss", 4))
                && (got_cookie == 0)) {
                strcpy(req->line, "GET /static/nocookies.html"