final touches on dkim test harness
[citadel.git] / webcit / webcit.c
index 703bc99c7d63b9961e975c36240834d22883f17d..b24007f0938159d5771c0cd347bbab81c71e9bb1 100644 (file)
@@ -1,20 +1,19 @@
-/*
- * This is the main transaction loop of the web service.  It maintains a
- * persistent session to the Citadel server, handling HTTP WebCit requests as
- * they arrive and presenting a user interface.
- *
- * 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.
- */
+// This is the main transaction loop of the web service.  It maintains a
+// persistent session to the Citadel server, handling HTTP WebCit requests as
+// they arrive and presenting a user interface.
+//
+// Copyright (c) 1996-2021 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.
+
 
 #define SHOW_ME_VAPPEND_PRINTF
 #include <stdio.h>
 #include <stdarg.h>
 #include "webcit.h"
 #include "dav.h"
-#include "webserver.h"
+
 
 StrBuf *csslocal = NULL;
 HashList *HandlerHash = NULL;
@@ -391,15 +390,15 @@ void end_ajax_response(void) {
 /*
  * Wraps a Citadel server command in an AJAX transaction.
  */
-void ajax_servcmd(void)
-{
+void ajax_servcmd(void) {
        int Done = 0;
        StrBuf *Buf;
        char *junk;
        size_t len;
 
-       if (verbose)
+       if (verbose) {
                syslog(LOG_DEBUG, "ajax_servcmd() g_cmd=\"%s\"", bstr("g_cmd") );
+       }
        begin_ajax_response();
        Buf = NewStrBuf();
        serv_puts(bstr("g_cmd"));
@@ -540,7 +539,6 @@ void pop_destination(void) {
 
 
 int ReadPostData(void) {
-       TRACE;
        int rc;
        int urlencoded_post = 0;
        StrBuf *content = NULL;
@@ -643,15 +641,15 @@ void session_loop(void)
        }
 
        /* If there are variables in the URL, we must grab them now */
-       if (WC->Hdr->PlainArgs != NULL)
+       if (WC->Hdr->PlainArgs != NULL) {
                ParseURLParams(WC->Hdr->PlainArgs);
+       }
 
        /* If the client sent a nonce that is incorrect, kill the request. */
        if (havebstr("nonce")) {
-               if (verbose)
-                       syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d", 
-                              bstr("nonce"), WC->nonce
-                               );
+               if (verbose) {
+                       syslog(LOG_DEBUG, "Comparing supplied nonce %s to session nonce %d", bstr("nonce"), WC->nonce);
+               }
                if (ibstr("nonce") != WC->nonce) {
                        syslog(LOG_INFO, "Ignoring request with mismatched nonce.");
                        hprintf("HTTP/1.1 404 Security check failed\r\n");
@@ -704,9 +702,9 @@ void session_loop(void)
                        serv_printf("PASS %s", ChrPtr(WC->Hdr->c_password));
                        StrBuf_ServGetln(Buf);
                        if (GetServerStatus(Buf, NULL) == 2) {
-                               become_logged_in(WC->Hdr->c_username,
-                                                WC->Hdr->c_password, Buf);
-                       else {
+                               become_logged_in(WC->Hdr->c_username, WC->Hdr->c_password, Buf);
+                       }
+                       else {
                                /* Should only display when password is wrong */
                                WC->ImportantMsg = NewStrBufPlain(ChrPtr(Buf) + 4, StrLength(Buf) - 4);
                                authorization_required();