From: Art Cancro Date: Sun, 13 Nov 2005 04:19:15 +0000 (+0000) Subject: * Strip prepended '/webcit' in requested url's. This may allow us to handle X-Git-Tag: v7.86~4467 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=8689a546bb3e75bba07e6a96f4272ec220973e0f;p=citadel.git * 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. --- diff --git a/webcit/ChangeLog b/webcit/ChangeLog index 8b6a7680c..661b86007 100644 --- a/webcit/ChangeLog +++ b/webcit/ChangeLog @@ -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. diff --git a/webcit/auth.c b/webcit/auth.c index 423e3d4c2..9d941b87e 100644 --- a/webcit/auth.c +++ b/webcit/auth.c @@ -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); } diff --git a/webcit/context_loop.c b/webcit/context_loop.c index b5ccd4fde..6673a4f67 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -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"