Added the ability to handle Base64-encoded URL's. We will use these, along with...
authorArt Cancro <ajc@citadel.org>
Fri, 3 Sep 2010 22:22:04 +0000 (18:22 -0400)
committerArt Cancro <ajc@citadel.org>
Fri, 3 Sep 2010 22:22:04 +0000 (18:22 -0400)
start_reading_at field, to tell search engines how to find the tops of message threads when we
eventually begin offering sitemaps.

webcit/context_loop.c
webcit/webcit.c

index c3e4e4fc9b3eb93dd15e763b3e2add0e28a2eaf3..ca72387d7d791c6af8d03121cafd98674cb8c366 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.*/
index b1d13076405ccb11eacfc35fa96ec1ae423d4d27..ab87150220ec4f9f2faee3b55ad2bef06e2ed210 100644 (file)
@@ -119,17 +119,17 @@ void wDumpContent(int print_standard_html_footer)
 /*
  * Output HTTP headers and leading HTML for a page
  */
-void output_headers(   int do_httpheaders,     /* 1 = output HTTP headers                          */
+void output_headers(   int do_httpheaders,     /* 1 = output HTTP headers                        */
                        int do_htmlhead,        /* 1 = output HTML <head> section and <body> opener */
 
-                       int do_room_banner,     /* 0=no, 1=yes,                                     
+                       int do_room_banner,     /* 0=no, 1=yes,                              
                                                 * 2 = I'm going to embed my own, so don't open the 
-                                                *     <div id="content"> either.                   
+                                                *     <div id="content"> either.                  
                                                 */
 
                        int unset_cookies,      /* 1 = session is terminating, so unset the cookies */
-                       int suppress_check,     /* 1 = suppress check for instant messages          */
-                       int cache               /* 1 = allow browser to cache this page             */
+                       int suppress_check,     /* 1 = suppress check for instant messages        */
+                       int cache               /* 1 = allow browser to cache this page      */
 ) {
        wcsession *WCC = WC;
        char httpnow[128];
@@ -363,21 +363,21 @@ void begin_ajax_response(void) {
        wcsession *WCC = WC;
 
        FlushStrBuf(WCC->HBuf);
-        output_headers(0, 0, 0, 0, 0, 0);
+       output_headers(0, 0, 0, 0, 0, 0);
 
-        hprintf("Content-type: text/html; charset=UTF-8\r\n"
-                "Server: %s\r\n"
-                "Connection: close\r\n"
+       hprintf("Content-type: text/html; charset=UTF-8\r\n"
+               "Server: %s\r\n"
+               "Connection: close\r\n"
                ,
-                PACKAGE_STRING);
-        begin_burst();
+               PACKAGE_STRING);
+       begin_burst();
 }
 
 /*
  * print ajax response footer 
  */
 void end_ajax_response(void) {
-        wDumpContent(0);
+       wDumpContent(0);
 }
 
 
@@ -624,6 +624,14 @@ void session_loop(void)
        Buf = NewStrBuf();
        WCC->trailing_javascript = NewStrBuf();
 
+       /* Convert base64-encoded URL's back to plain text */
+       if (!strncmp(ChrPtr(WCC->Hdr->this_page), "/B64", 4)) {
+               StrBufCutLeft(WCC->Hdr->this_page, 4);
+               StrBufDecodeBase64(WCC->Hdr->this_page);
+               http_redirect(ChrPtr(WCC->Hdr->this_page));
+               goto SKIP_ALL_THIS_CRAP;
+       }
+
        /* If there are variables in the URL, we must grab them now */
        if (WCC->Hdr->PlainArgs != NULL)
                ParseURLParams(WCC->Hdr->PlainArgs);