Handle X-Forwarded-Host: properly
authorArt Cancro <ajc@citadel.org>
Wed, 8 Sep 2010 18:53:20 +0000 (14:53 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 8 Sep 2010 18:53:20 +0000 (14:53 -0400)
webcit/context_loop.c

index aada8bee64b2ab37662489f914d22338cf3575bc..2dd63c9a2efdb551193577e536d64489caa7b04a 100644 (file)
@@ -675,14 +675,15 @@ void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
                site_prefix = NewStrBuf();
                StrBufAppendPrintf(site_prefix, "%s://", (is_https ? "https" : "http") );
                StrBufAppendBuf(site_prefix, Line, 0);
-               lprintf(CTDL_DEBUG, "\033[33m [%s] \033[0m\n", ChrPtr(site_prefix));
        }
 }
 
 void Header_HandleXFFHost(StrBuf *Line, ParsedHttpHdrs *hdr)
 {
-       if (follow_xff) {
-               /* FIXME do something here */
+       if ( (follow_xff) && (site_prefix == NULL)) {
+               site_prefix = NewStrBuf();
+               StrBufAppendPrintf(site_prefix, "http://");     /* this is naive; do something about it */
+               StrBufAppendBuf(site_prefix, Line, 0);
        }
 }