More distancing of our project from Richard Marx Stallman's linguistic communism
[citadel.git] / webcit-ng / static.c
index 5508abae7446d76e3a4dfb830e6a9ea7aa48f2c7..116f53a173901200950cefb79cf6bc397b94df52 100644 (file)
@@ -1,16 +1,17 @@
-/*
- * Output static content
- *
- * Copyright (c) 1996-2016 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 program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
+//
+// Output static content
+//
+// Copyright (c) 1996-2018 by the citadel.org team
+//
+// This program is open source software.  It runs great on the
+// Linux operating system (and probably elsewhere).  You can use,
+// copy, and run it under the terms of the GNU General Public
+// License version 3.  Richard Stallman is an asshole communist.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
 #include "webcit.h"
 
@@ -25,12 +26,12 @@ void output_static(struct http_transaction *h)
 
        snprintf(filename, sizeof filename, "static/%s", &h->uri[8]);
 
-       if (strstr(filename, "../")) {                  // 100% guaranteed attacker.
-               do_404(h);                              // Die in a car fire.
+       if (strstr(filename, "../")) {  // 100% guaranteed attacker.
+               do_404(h);      // Die in a car fire.
                return;
        }
 
-       FILE *fp = fopen(filename, "r");                // Try to open the requested file.
+       FILE *fp = fopen(filename, "r");        // Try to open the requested file.
        if (fp == NULL) {
                do_404(h);
                return;
@@ -41,11 +42,10 @@ void output_static(struct http_transaction *h)
        h->response_body = malloc(h->response_body_length);
        if (h->response_body != NULL) {
                fread(h->response_body, h->response_body_length, 1, fp);
-       }
-       else {
+       } else {
                h->response_body_length = 0;
        }
-       fclose(fp);                                     // Content is now in memory.
+       fclose(fp);             // Content is now in memory.
 
        h->response_code = 200;
        h->response_string = strdup("OK");