]> code.citadel.org Git - citadel.git/blobdiff - webcit/context_loop.c
New global variable 'site_prefix' which replaces the often-repeated code which constr...
[citadel.git] / webcit / context_loop.c
index c3e4e4fc9b3eb93dd15e763b3e2add0e28a2eaf3..a358545e989c36ccbc46ce5be28f495cf4aa46a1 100644 (file)
@@ -306,6 +306,7 @@ int ReadHttpSubject(ParsedHttpHdrs *Hdr, StrBuf *Line, StrBuf *Buf)
        }
 
        StrBufAppendBuf(Hdr->this_page, Hdr->HR.ReqLine, 0);
+
        /* chop Filename / query arguments */
        Args = strchr(ChrPtr(Hdr->HR.ReqLine), '?');
        if (Args == NULL) /* whe're not that picky about params... TODO: this will spoil '&' in filenames.*/
@@ -670,10 +671,18 @@ void Header_HandleUserAgent(StrBuf *Line, ParsedHttpHdrs *hdr)
 
 void Header_HandleHost(StrBuf *Line, ParsedHttpHdrs *hdr)
 {
-       if ((follow_xff) && (hdr->HR.http_host != NULL))
+       if ((follow_xff) && (hdr->HR.http_host != NULL)) {
                return;
-       else
+       }
+       else {
                hdr->HR.http_host = Line;
+               if (site_prefix == NULL) {
+                       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)