Renderers cleanup part 1
[citadel.git] / webcit / webcit.c
index 91fc47e26424c64bf0d85a0ec173554fed1cb5ec..4108ecb38c3971355b6f5ad650ed7cbd02c9b133 100644 (file)
@@ -3,7 +3,7 @@
  * persistent session to the Citadel server, handling HTTP WebCit requests as
  * they arrive and presenting a user interface.
  *
- * Copyright (c) 1996-2013 by the citadel.org team
+ * Copyright (c) 1996-2018 by the citadel.org team
  *
  * This program is open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.
@@ -141,7 +141,9 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers                        */
        wcsession *WCC = WC;
        char httpnow[128];
 
-       if (WCC->Hdr->HaveRange > 1)
+       if (WCC->isFailure) 
+               hprintf("HTTP/2.2 500 Internal Server Error");
+       else if (WCC->Hdr->HaveRange > 1)
                hprintf("HTTP/1.1 206 Partial Content\r\n");
        else
                hprintf("HTTP/1.1 200 OK\r\n");
@@ -502,7 +504,7 @@ void push_destination(void) {
        }
 
        FreeStrBuf(&WCC->PushedDestination);
-       WCC->PushedDestination = NewStrBufDup(SBSTR("url"));
+       WCC->PushedDestination = NewStrBufDup(sbstr("url"));
        if (verbose)
                syslog(LOG_DEBUG, "Push: %s", ChrPtr(WCC->PushedDestination));
        wc_printf("OK");
@@ -906,7 +908,7 @@ void tmplput_importantmessage(StrBuf *Target, WCTemplputParams *TP)
        
        if (WCC != NULL) {
                if (StrLength(WCC->ImportantMsg) > 0) {
-                       StrEscAppend(Target, WCC->ImportantMsg, NULL, 0, 0);
+                       StrBufAppendTemplate(Target, TP, WCC->ImportantMsg, 0);
                }
        }
 }
@@ -954,7 +956,7 @@ InitModule_WEBCIT
        RegisterConditional("COND:IS_HTTPS", 0, Conditional_IS_HTTPS, CTX_NONE);
 
        RegisterNamespace("CSSLOCAL", 0, 0, tmplput_csslocal, NULL, CTX_NONE);
-       RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage, NULL, CTX_NONE);
+       RegisterNamespace("IMPORTANTMESSAGE", 0, 1, tmplput_importantmessage, NULL, CTX_NONE);
        RegisterNamespace("TRAILING_JAVASCRIPT", 0, 0, tmplput_trailing_javascript, NULL, CTX_NONE);
        RegisterNamespace("URL:DISPLAYNAME", 0, 1, tmplput_HANDLER_DISPLAYNAME, NULL, CTX_NONE);
        RegisterNamespace("PACKAGESTRING", 0, 1, tmplput_packagestring, NULL, CTX_NONE);