diff --git a/example/helloworld.c b/example/helloworld.c index 5e6350c..606b856 100755 --- a/example/helloworld.c +++ b/example/helloworld.c @@ -15,7 +15,11 @@ * along with this program. If not, see . */ +#include +#include +#include #include +#include static void hello_action(struct uh_client *cl) { @@ -72,7 +76,7 @@ int main(int argc, char **argv) if (!verbose) ulog_threshold(LOG_ERR); - uh_log_debug("libuhttpd version: %s", UHTTPD_VERSION_STRING); + ULOG_INFO("libuhttpd version: %s\n", UHTTPD_VERSION_STRING); uloop_init(); @@ -82,13 +86,13 @@ int main(int argc, char **argv) #if (!UHTTPD_SSL_SUPPORT) if (ssl) - uh_log_debug("SSl is not compiled in"); + ULOG_ERR("SSl is not compiled in\n"); #else if (ssl && srv->ssl_init(srv, "server-key.pem", "server-cert.pem") < 0) goto done; #endif - uh_log_debug("Listen on: %s *:%d", srv->ssl ? "https" : "http", port); + ULOG_INFO("Listen on: %s *:%d\n", srv->ssl ? "https" : "http", port); srv->add_action(srv, "/hello", hello_action); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d52df77..653e80a 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,9 +34,7 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h ${CMAKE_CURRENT_SOURCE_DIR}/uhttpd.h - ${CMAKE_CURRENT_SOURCE_DIR}/log.h ${CMAKE_CURRENT_SOURCE_DIR}/client.h - ${CMAKE_CURRENT_SOURCE_DIR}/common.h ${CMAKE_CURRENT_SOURCE_DIR}/action.h DESTINATION include/uhttpd diff --git a/src/action.c b/src/action.c index d25a102..41d0016 100755 --- a/src/action.c +++ b/src/action.c @@ -19,8 +19,11 @@ * along with this program. If not, see . */ +#include + #include "action.h" #include "uhttpd.h" +#include "log.h" #define UH_ACTION_DATA_BUF_SIZE 1024 #define UH_ACTION_MAX_POST_SIZE 4096 diff --git a/src/client.c b/src/client.c index 4594009..4c1e4a9 100755 --- a/src/client.c +++ b/src/client.c @@ -15,11 +15,18 @@ * along with this program. If not, see . */ +#include +#include +#include +#include +#include + #include "uhttpd.h" #include "client.h" #include "file.h" #include "utils.h" #include "uh_ssl.h" +#include "log.h" const char *const http_versions[] = { [UH_HTTP_VER_0_9] = "HTTP/0.9", diff --git a/src/client.h b/src/client.h index 456cc7a..b46a184 100755 --- a/src/client.h +++ b/src/client.h @@ -18,7 +18,11 @@ #ifndef _CLIENT_H_ #define _CLIENT_H_ -#include "common.h" +#include +#include +#include + +#include "config.h" #if (UHTTPD_SSL_SUPPORT) #include diff --git a/src/common.h b/src/common.h deleted file mode 100755 index d99fd71..0000000 --- a/src/common.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2017 Jianhui Zhao - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef _COMMON_H -#define _COMMON_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "config.h" -#include "log.h" - -#endif diff --git a/src/file.c b/src/file.c index c124975..f66eecb 100755 --- a/src/file.c +++ b/src/file.c @@ -15,11 +15,17 @@ * along with this program. If not, see . */ +#include +#include #include +#include +#include +#include #include "file.h" #include "utils.h" #include "uhttpd.h" +#include "log.h" static const struct mimetype uh_mime_types[] = { { "txt", "text/plain" }, diff --git a/src/file.h b/src/file.h index a2de221..146e914 100755 --- a/src/file.h +++ b/src/file.h @@ -18,6 +18,8 @@ #ifndef _FILE_H #define _FILE_H +#include + #include "client.h" struct path_info { diff --git a/src/log.c b/src/log.c index 551388d..6cf8691 100755 --- a/src/log.c +++ b/src/log.c @@ -14,7 +14,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + +#include +#include +#include +#include + #include "log.h" void __uh_log(const char *filename, int line, int priority, const char *fmt, ...) diff --git a/src/log.h b/src/log.h index dcb1c82..d204d28 100755 --- a/src/log.h +++ b/src/log.h @@ -18,8 +18,7 @@ #ifndef _LOG_H #define _LOG_H -#include "common.h" - +#include #include #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) diff --git a/src/uh_ssl.c b/src/uh_ssl.c index 01e5a15..7f7ac5a 100755 --- a/src/uh_ssl.c +++ b/src/uh_ssl.c @@ -17,8 +17,11 @@ */ #include +#include + #include "uhttpd.h" #include "uh_ssl.h" +#include "log.h" static bool _init = false; static struct ustream_ssl_ops *ops; diff --git a/src/uh_ssl.h b/src/uh_ssl.h index f7c179c..38f5585 100755 --- a/src/uh_ssl.h +++ b/src/uh_ssl.h @@ -19,6 +19,8 @@ #ifndef __UHTTPD_SSL_H #define __UHTTPD_SSL_H +#include "config.h" + #if (UHTTPD_SSL_SUPPORT) int uh_ssl_init(struct uh_server *srv, const char *key, const char *crt); diff --git a/src/uhttpd.c b/src/uhttpd.c index 0f3ece9..304c779 100755 --- a/src/uhttpd.c +++ b/src/uhttpd.c @@ -15,9 +15,14 @@ * along with this program. If not, see . */ +#include +#include #include +#include + #include "uhttpd.h" #include "uh_ssl.h" +#include "log.h" static void uh_set_docroot(struct uh_server *srv, const char *docroot) { diff --git a/src/uhttpd.h b/src/uhttpd.h index 2fd26d3..cc94a97 100755 --- a/src/uhttpd.h +++ b/src/uhttpd.h @@ -18,6 +18,7 @@ #ifndef _UHTTPD_H #define _UHTTPD_H +#include "config.h" #include "client.h" #include "action.h" diff --git a/src/utils.c b/src/utils.c index 0a4d3dd..d01da35 100755 --- a/src/utils.c +++ b/src/utils.c @@ -15,6 +15,10 @@ * along with this program. If not, see . */ +#include +#include +#include + #include "utils.h" void uh_printf(struct uh_client *cl, const char *format, ...)