Jelajahi Sumber

Update year in copyright header

bel2125 7 tahun lalu
induk
melakukan
a5c237895e

+ 1 - 1
src/civetweb.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017 the Civetweb developers
+/* Copyright (c) 2013-2018 the Civetweb developers
  * Copyright (c) 2004-2013 Sergey Lyubka
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy

+ 1 - 1
src/handle_form.inl

@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017 the Civetweb developers
+/* Copyright (c) 2016-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
src/main.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2017 the Civetweb developers
+/* Copyright (c) 2013-2018 the Civetweb developers
  * Copyright (c) 2004-2013 Sergey Lyubka
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy

+ 1 - 1
src/mod_duktape.inl

@@ -1,6 +1,6 @@
 /* This file is part of the CivetWeb web server.
  * See https://github.com/civetweb/civetweb/
- * (C) 2015-2017 by the CivetWeb authors, MIT license.
+ * (C) 2015-2018 by the CivetWeb authors, MIT license.
  */
 
 #include "duktape.h"

+ 2 - 1
src/mod_lua.inl

@@ -639,7 +639,8 @@ lsp_include(lua_State *L)
 
 			if (handle_lsp_request(conn, file_name_path, &file, L)) {
 				/* handle_lsp_request returned an error code, meaning an error
-				* occurred in the included page and mg.onerror returned non-zero.
+				* occurred in the included page and mg.onerror returned
+				* non-zero.
 				* Stop processing.
 				*/
 

+ 1 - 1
src/timer.inl

@@ -1,6 +1,6 @@
 /* This file is part of the CivetWeb web server.
  * See https://github.com/civetweb/civetweb/
- * (C) 2014-2017 by the CivetWeb authors, MIT license.
+ * (C) 2014-2018 by the CivetWeb authors, MIT license.
  */
 
 #if !defined(MAX_TIMERS)

+ 1 - 1
unittest/civetweb_check.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 0 - 182
unittest/embed.c

@@ -1,182 +0,0 @@
-// Copyright (c) 2004-2009 Sergey Lyubka
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-// Unit test for the civetweb web server. Tests embedded API.
-
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
-#include "civetweb.h"
-
-#if !defined(LISTENING_PORT)
-#define LISTENING_PORT "23456"
-#endif
-
-static const char *standard_reply = "HTTP/1.1 200 OK\r\n"
-  "Content-Type: text/plain\r\n"
-  "Connection: close\r\n\r\n";
-
-static void test_get_var(struct mg_connection *conn,
-                         const struct mg_request_info *ri) {
-  char *var, *buf;
-  size_t buf_len;
-  const char *cl;
-  int var_len;
-
-  mg_printf(conn, "%s", standard_reply);
-
-  buf_len = 0;
-  var = buf = NULL;
-  cl = mg_get_header(conn, "Content-Length");
-  mg_printf(conn, "cl: %p\n", cl);
-  if ((!strcmp(ri->request_method, "POST") ||
-       !strcmp(ri->request_method, "PUT"))
-      && cl != NULL) {
-    buf_len = atoi(cl);
-    buf = malloc(buf_len);
-    /* Read in two pieces, to test continuation */
-    if (buf_len > 2) {
-      mg_read(conn, buf, 2);
-      mg_read(conn, buf + 2, buf_len - 2);
-    } else {
-      mg_read(conn, buf, buf_len);
-    }
-  } else if (ri->query_string != NULL) {
-    buf_len = strlen(ri->query_string);
-    buf = malloc(buf_len + 1);
-    strcpy(buf, ri->query_string);
-  }
-  var = malloc(buf_len + 1);
-  var_len = mg_get_var(buf, buf_len, "my_var", var, buf_len + 1);
-  mg_printf(conn, "Value: [%s]\n", var);
-  mg_printf(conn, "Value size: [%d]\n", var_len);
-  free(buf);
-  free(var);
-}
-
-static void test_get_header(struct mg_connection *conn,
-                            const struct mg_request_info *ri) {
-  const char *value;
-  int i;
-
-  mg_printf(conn, "%s", standard_reply);
-  printf("HTTP headers: %d\n", ri->num_headers);
-  for (i = 0; i < ri->num_headers; i++) {
-    printf("[%s]: [%s]\n", ri->http_headers[i].name, ri->http_headers[i].value);
-  }
-
-  value = mg_get_header(conn, "Host");
-  if (value != NULL) {
-    mg_printf(conn, "Value: [%s]", value);
-  }
-}
-
-static void test_get_request_info(struct mg_connection *conn,
-                                  const struct mg_request_info *ri) {
-  int i;
-
-  mg_printf(conn, "%s", standard_reply);
-
-  mg_printf(conn, "Method: [%s]\n", ri->request_method);
-  mg_printf(conn, "URI: [%s]\n", ri->uri);
-  mg_printf(conn, "HTTP version: [%s]\n", ri->http_version);
-
-  for (i = 0; i < ri->num_headers; i++) {
-    mg_printf(conn, "HTTP header [%s]: [%s]\n",
-              ri->http_headers[i].name,
-              ri->http_headers[i].value);
-  }
-
-  mg_printf(conn, "Query string: [%s]\n",
-            ri->query_string ? ri->query_string: "");
-  mg_printf(conn, "Remote IP: [%lu]\n", ri->remote_ip);
-  mg_printf(conn, "Remote port: [%d]\n", ri->remote_port);
-  mg_printf(conn, "Remote user: [%s]\n",
-            ri->remote_user ? ri->remote_user : "");
-}
-
-static void test_error(struct mg_connection *conn,
-                       const struct mg_request_info *ri) {
-  int status = (int) ri->ev_data;
-  mg_printf(conn, "HTTP/1.1 %d XX\r\n"
-            "Conntection: close\r\n\r\n", status);
-  mg_printf(conn, "Error: [%d]", status);
-}
-
-static void test_post(struct mg_connection *conn,
-                      const struct mg_request_info *ri) {
-  const char *cl;
-  char *buf;
-  int len;
-
-  mg_printf(conn, "%s", standard_reply);
-  if (strcmp(ri->request_method, "POST") == 0 &&
-      (cl = mg_get_header(conn, "Content-Length")) != NULL) {
-    len = atoi(cl);
-    if ((buf = malloc(len)) != NULL) {
-      mg_write(conn, buf, len);
-      free(buf);
-    }
-  }
-}
-
-static const struct test_config {
-  enum mg_event event;
-  const char *uri;
-  void (*func)(struct mg_connection *, const struct mg_request_info *);
-} test_config[] = {
-  {MG_NEW_REQUEST, "/test_get_header", &test_get_header},
-  {MG_NEW_REQUEST, "/test_get_var", &test_get_var},
-  {MG_NEW_REQUEST, "/test_get_request_info", &test_get_request_info},
-  {MG_NEW_REQUEST, "/test_post", &test_post},
-  {MG_HTTP_ERROR, "", &test_error},
-  {0, NULL, NULL}
-};
-
-static void *callback(enum mg_event event,
-                      struct mg_connection *conn) {
-  const struct mg_request_info *request_info = mg_get_request_info(conn);
-  int i;
-
-  for (i = 0; test_config[i].uri != NULL; i++) {
-    if (event == test_config[i].event &&
-        (event == MG_HTTP_ERROR ||
-         !strcmp(request_info->uri, test_config[i].uri))) {
-      test_config[i].func(conn, request_info);
-      return "processed";
-    }
-  }
-
-  return NULL;
-}
-
-int main(void) {
-  struct mg_context *ctx;
-  const char *options[] = {"listening_ports", LISTENING_PORT, NULL};
-
-  ctx = mg_start(callback, NULL, options);
-  pause();
-  return 0;
-}

+ 1 - 1
unittest/main.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/private.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/private.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/private_exe.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/private_exe.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/public_func.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/public_func.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/public_server.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/public_server.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/shared.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/shared.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2017 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/timertest.c

@@ -1,4 +1,4 @@
-/* Copyright (c) 2016-2017 the Civetweb developers
+/* Copyright (c) 2016-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

+ 1 - 1
unittest/timertest.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2015 the Civetweb developers
+/* Copyright (c) 2015-2018 the Civetweb developers
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal