From 62a3a563f1d182f8b25ac0d9f34a9b43320f1e63 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Fri, 29 Dec 2017 11:44:03 +0800 Subject: [PATCH] Renamed project: libuhttp -> libuhttpd Signed-off-by: Jianhui Zhao --- CMakeLists.txt | 4 +- CONTRIBUTING.md | 6 +- CONTRIBUTING_ZH.md | 6 +- README.md | 42 ++++---- README_ZH.md | 40 +++---- example/CMakeLists.txt | 4 +- example/helloworld.c | 2 +- example/lua_template.c | 2 +- src/CMakeLists.txt | 102 +++++++++--------- src/buf.c | 4 +- src/include/internal.h | 2 +- src/include/uhttp/config.h.in | 15 --- src/include/{uhttp.h => uhttpd.h} | 6 +- src/include/{uhttp => uhttpd}/buf.h | 4 +- src/include/uhttpd/config.h.in | 15 +++ src/include/{uhttp => uhttpd}/log.h | 8 +- src/include/{uhttp => uhttpd}/parser.h | 4 +- src/include/{uhttp => uhttpd}/ssl.h | 4 +- src/include/{uhttp => uhttpd}/str.h | 4 +- .../{uhttp/uhttp.h => uhttpd/uhttpd.h} | 14 +-- src/log.c | 4 +- src/ssl.c | 2 +- src/template.c | 2 +- src/{uhttp.c => uhttpd.c} | 10 +- 24 files changed, 153 insertions(+), 153 deletions(-) delete mode 100755 src/include/uhttp/config.h.in rename src/include/{uhttp.h => uhttpd.h} (92%) rename src/include/{uhttp => uhttpd}/buf.h (97%) create mode 100755 src/include/uhttpd/config.h.in rename src/include/{uhttp => uhttpd}/log.h (94%) rename src/include/{uhttp => uhttpd}/parser.h (99%) rename src/include/{uhttp => uhttpd}/ssl.h (98%) rename src/include/{uhttp => uhttpd}/str.h (95%) rename src/include/{uhttp/uhttp.h => uhttpd/uhttpd.h} (96%) rename src/{uhttp.c => uhttpd.c} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66d3989..0043e0f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8) -project(libuhttp C) +project(libuhttpd C) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") @@ -10,7 +10,7 @@ add_definitions(-O -Wall -Werror --std=gnu99 -D_GNU_SOURCE) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/src/include - ${CMAKE_CURRENT_SOURCE_DIR}/src/include/uhttp + ${CMAKE_CURRENT_SOURCE_DIR}/src/include/uhttpd ${CMAKE_CURRENT_BINARY_DIR}/src/include ) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 370a9e5..2845d18 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ Contributing ================================================================================ -If you want to contribute to [libuhttp](https://github.com/zhaojh329/libuhttp), please follow these simple rules: +If you want to contribute to [libuhttpd](https://github.com/zhaojh329/libuhttpd), please follow these simple rules: 1. Press the fork button: @@ -10,13 +10,13 @@ If you want to contribute to [libuhttp](https://github.com/zhaojh329/libuhttp), 2. Clone the repository from your account with: ``` - git clone https://github.com/your_github_username/libuhttp.git + git clone https://github.com/your_github_username/libuhttpd.git ``` 3. Create a new branch with: ``` - git checkout -b "libuhttp-1-fix" + git checkout -b "libuhttpd-1-fix" ``` You can name it however you want. diff --git a/CONTRIBUTING_ZH.md b/CONTRIBUTING_ZH.md index 9c35068..8cd68a1 100755 --- a/CONTRIBUTING_ZH.md +++ b/CONTRIBUTING_ZH.md @@ -1,7 +1,7 @@ 贡献代码 ================================================================================ -如果你想为[libuhttp](https://github.com/zhaojh329/libuhttp)贡献代码, 请按照如下步骤: +如果你想为[libuhttpd](https://github.com/zhaojh329/libuhttpd)贡献代码, 请按照如下步骤: 1. 点击fork按钮: @@ -10,13 +10,13 @@ 2. 从你的github账户克隆仓库代码: ``` - git clone https://github.com/你的github账户/libuhttp.git + git clone https://github.com/你的github账户/libuhttpd.git ``` 3. 创建一个新的分支: ``` - git checkout -b "libuhttp-1-fix" + git checkout -b "libuhttpd-1-fix" ``` 你可以使用一个你想要的分支名称。 diff --git a/README.md b/README.md index a557efe..596f6e5 100755 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# libuhttp([中文](https://github.com/zhaojh329/libuhttp/blob/master/README_ZH.md)) +# libuhttpd([中文](https://github.com/zhaojh329/libuhttpd/blob/master/README_ZH.md)) ![](https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic "License") [libev]: http://software.schmorp.de/pkg/libev.html [http-parser]: https://github.com/nodejs/http-parser -A very tiny and fast HTTP library based on [libev] and [http-parser] for Embedded Linux. +A very tiny and fast HTTP server library based on [libev] and [http-parser] for Embedded Linux. Support HTTPS(alternative OpenSSL and CyaSSl(wolfssl)) and if you're sensitive to size, you can choose CyaSSl(wolfssl). @@ -37,53 +37,53 @@ CentOS ## Clone the repository - ~$ git clone https://github.com/zhaojh329/libuhttp.git - ~$ cd libuhttp + ~$ git clone https://github.com/zhaojh329/libuhttpd.git + ~$ cd libuhttpd ## Create the build directory - ~/libuhttp$ mkdir build - ~/libuhttp$ cd build + ~/libuhttpd$ mkdir build + ~/libuhttpd$ cd build ## Configure See which configuration are supported - ~/libuhttp/build$ cmake .. -L - ~/libuhttp/build$ cmake .. -LH + ~/libuhttpd/build$ cmake .. -L + ~/libuhttpd/build$ cmake .. -LH Default configure: automatically select the SSL library as its SSL backend(If there is a SSL library available) - ~/libuhttp/build$ cmake .. + ~/libuhttpd/build$ cmake .. Disable SSl support - ~/libuhttp/build$ cmake .. -DUHTTP_DISABLE_SSL=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_DISABLE_SSL=1 Explicit use OpenSSL as its SSL backend - ~/libuhttp/build$ cmake .. -DUHTTP_USE_OPENSSL=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_USE_OPENSSL=1 Explicit use CyaSSl(wolfssl) as its SSL backend - ~/libuhttp/build$ cmake .. -DUHTTP_USE_CYASSL=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_USE_CYASSL=1 Turn on debug - ~/libuhttp/build$ cmake .. -DUHTTP_DEBUG=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_DEBUG=1 -## Build and install libuhttp +## Build and install libuhttpd - ~/libuhttp/build$ make && sudo make install + ~/libuhttpd/build$ make && sudo make install ## Run the Example First generate the SSL certificate file - ~/libuhttp/build$ cd .. - ~/libuhttp$ ./gen_cert.sh + ~/libuhttpd/build$ cd .. + ~/libuhttpd$ ./gen_cert.sh Run - ~/libuhttp$ ./build/example/helloworld + ~/libuhttpd$ ./build/example/helloworld Then use the command curl or browser to test @@ -100,11 +100,11 @@ If use browser to test, it will be show Host: 192.168.0.100:8000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 -# [Example](https://github.com/zhaojh329/libuhttp/blob/master/example/helloworld.c) +# [Example](https://github.com/zhaojh329/libuhttpd/blob/master/example/helloworld.c) # Contributing -If you would like to help making [libuhttp](https://github.com/zhaojh329/libuhttp) better, -see the [CONTRIBUTING.md](https://github.com/zhaojh329/libuhttp/blob/master/CONTRIBUTING.md) file. +If you would like to help making [libuhttpd](https://github.com/zhaojh329/libuhttpd) better, +see the [CONTRIBUTING.md](https://github.com/zhaojh329/libuhttpd/blob/master/CONTRIBUTING.md) file. # Thanks for the following project * [libev] diff --git a/README_ZH.md b/README_ZH.md index 1db6672..f22f436 100755 --- a/README_ZH.md +++ b/README_ZH.md @@ -1,4 +1,4 @@ -# libuhttp +# libuhttpd ![](https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic "License") @@ -35,53 +35,53 @@ CentOS ## 克隆仓库代码 - ~$ git clone https://github.com/zhaojh329/libuhttp.git - ~$ cd libuhttp + ~$ git clone https://github.com/zhaojh329/libuhttpd.git + ~$ cd libuhttpd ## 创建编译目录 - ~/libuhttp$ mkdir build - ~/libuhttp$ cd build + ~/libuhttpd$ mkdir build + ~/libuhttpd$ cd build ## 配置 查看支持哪些配置选项 - ~/libuhttp/build$ cmake .. -L - ~/libuhttp/build$ cmake .. -LH + ~/libuhttpd/build$ cmake .. -L + ~/libuhttpd/build$ cmake .. -LH 默认配置: 自动选择SSL库(如果有可用的SSL库) - ~/libuhttp/build$ cmake .. + ~/libuhttpd/build$ cmake .. 禁用SSL - ~/libuhttp/build$ cmake .. -DUHTTP_DISABLE_SSL=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_DISABLE_SSL=1 强制选择OpenSSL - ~/libuhttp/build$ cmake .. -DUHTTP_USE_OPENSSL=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_USE_OPENSSL=1 强制选择CyaSSl(wolfssl) - ~/libuhttp/build$ cmake .. -DUHTTP_USE_CYASSL=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_USE_CYASSL=1 打开调试 - ~/libuhttp/build$ cmake .. -DUHTTP_DEBUG=1 + ~/libuhttpd/build$ cmake .. -DUHTTP_DEBUG=1 -## 编译和安装libuhttp +## 编译和安装libuhttpd - ~/libuhttp/build$ make && sudo make install + ~/libuhttpd/build$ make && sudo make install ## 运行例子 首先生成SSL证书文件 - ~/libuhttp/build$ cd .. - ~/libuhttp$ ./gen_cert.sh + ~/libuhttpd/build$ cd .. + ~/libuhttpd$ ./gen_cert.sh 运行 - ~/libuhttp$ ./build/example/helloworld + ~/libuhttpd$ ./build/example/helloworld 然后使用命令curl或者浏览器进行测试 @@ -98,11 +98,11 @@ CentOS Host: 192.168.0.100:8000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 -# [示例程序](https://github.com/zhaojh329/libuhttp/blob/master/example/helloworld.c) +# [示例程序](https://github.com/zhaojh329/libuhttpd/blob/master/example/helloworld.c) # 贡献代码 -如果你想帮助[libuhttp](https://github.com/zhaojh329/libuhttp)变得更好,请参考 -[CONTRIBUTING_ZH.md](https://github.com/zhaojh329/libuhttp/blob/master/CONTRIBUTING_ZH.md)。 +如果你想帮助[libuhttpd](https://github.com/zhaojh329/libuhttpd)变得更好,请参考 +[CONTRIBUTING_ZH.md](https://github.com/zhaojh329/libuhttpd/blob/master/CONTRIBUTING_ZH.md)。 # 技术交流 QQ群:153530783 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index b34cfc3..21b3f6f 100755 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(helloworld helloworld.c) -target_link_libraries(helloworld uhttp) +target_link_libraries(helloworld uhttpd) add_executable(lua_template lua_template.c) -target_link_libraries(lua_template uhttp) +target_link_libraries(lua_template uhttpd) diff --git a/example/helloworld.c b/example/helloworld.c index 5ecc766..359652b 100755 --- a/example/helloworld.c +++ b/example/helloworld.c @@ -1,6 +1,6 @@ #include #include -#include +#include static void signal_cb(struct ev_loop *loop, ev_signal *w, int revents) { diff --git a/example/lua_template.c b/example/lua_template.c index a97329c..c674ccb 100755 --- a/example/lua_template.c +++ b/example/lua_template.c @@ -1,6 +1,6 @@ #include #include -#include +#include static void signal_cb(struct ev_loop *loop, ev_signal *w, int revents) { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a892e5d..eb3938a 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ # The version number. -set(UHTTP_VERSION_MAJOR 0) -set(UHTTP_VERSION_MINOR 3) -set(UHTTP_VERSION_PATCH 0) +set(UHTTPD_VERSION_MAJOR 0) +set(UHTTPD_VERSION_MINOR 3) +set(UHTTPD_VERSION_PATCH 0) # Check the third party Libraries find_package(Libev REQUIRED) @@ -11,60 +11,60 @@ find_package(Lua) include_directories(${LIBEV_INCLUDE_DIR} ${LUA_INCLUDE_DIR}) set(EXTRA_LIBS ${LIBEV_LIBRARIES} ${LUA_LIBRARIES}) -set(SOURCE_FILES uhttp.c log.c buf.c ssl.c parser.c template.c) +set(SOURCE_FILES uhttpd.c log.c buf.c ssl.c parser.c template.c) -set(UHTTP_DEBUG_CONFIG 0) -option(UHTTP_DEBUG "Turn on debug" OFF) -if(UHTTP_DEBUG) - set(UHTTP_DEBUG_CONFIG 1) +set(UHTTPD_DEBUG_CONFIG 0) +option(UHTTPD_DEBUG "Turn on debug" OFF) +if(UHTTPD_DEBUG) + set(UHTTPD_DEBUG_CONFIG 1) endif() -option(UHTTP_DISABLE_SSL "Disable ssl support" OFF) -option(UHTTP_USE_OPENSSL "Explicit use OpenSSL as SSL backend" OFF) -option(UHTTP_USE_CYASSL "Explicit use CyaSSL as SSL backend" OFF) +option(UHTTPD_DISABLE_SSL "Disable ssl support" OFF) +option(UHTTPD_USE_OPENSSL "Explicit use OpenSSL as SSL backend" OFF) +option(UHTTPD_USE_CYASSL "Explicit use CyaSSL as SSL backend" OFF) -set(UHTTP_SSL_ENABLED OFF) -set(UHTTP_SSL_ENABLED_CONFIG 0) -set(UHTTP_USE_OPENSSL_CONFIG 0) -set(UHTTP_USE_CYASSL_CONFIG 0) +set(UHTTPD_SSL_ENABLED OFF) +set(UHTTPD_SSL_ENABLED_CONFIG 0) +set(UHTTPD_USE_OPENSSL_CONFIG 0) +set(UHTTPD_USE_CYASSL_CONFIG 0) -if(NOT UHTTP_DISABLE_SSL) - if(UHTTP_USE_OPENSSL) +if(NOT UHTTPD_DISABLE_SSL) + if(UHTTPD_USE_OPENSSL) if(NOT OPENSSL_FOUND) message(FATAL_ERROR "Could NOT find OpenSSL") endif() - set(UHTTP_SSL_ENABLED ON) - set(UHTTP_SSL_ENABLED_CONFIG 1) - set(UHTTP_USE_OPENSSL_CONFIG 1) + set(UHTTPD_SSL_ENABLED ON) + set(UHTTPD_SSL_ENABLED_CONFIG 1) + set(UHTTPD_USE_OPENSSL_CONFIG 1) list(APPEND EXTRA_LIBS ${OPENSSL_LIBRARIES}) include_directories(${OPENSSL_INCLUDE_DIR}) - elseif(UHTTP_USE_CYASSL) + elseif(UHTTPD_USE_CYASSL) if (NOT CYASSL_FOUND) message(FATAL_ERROR "Could NOT find CyaSSL") endif() - set(UHTTP_SSL_ENABLED ON) - set(UHTTP_SSL_ENABLED_CONFIG 1) - set(UHTTP_USE_CYASSL_CONFIG 1) + set(UHTTPD_SSL_ENABLED ON) + set(UHTTPD_SSL_ENABLED_CONFIG 1) + set(UHTTPD_USE_CYASSL_CONFIG 1) list(APPEND EXTRA_LIBS ${CYASSL_LIBRARIES}) include_directories(${CYASSL_INCLUDE_DIR}) endif() - if(NOT UHTTP_SSL_ENABLED) + if(NOT UHTTPD_SSL_ENABLED) if(OPENSSL_FOUND) - set(UHTTP_SSL_ENABLED ON) - set(UHTTP_SSL_ENABLED_CONFIG 1) - set(UHTTP_USE_OPENSSL_CONFIG 1) + set(UHTTPD_SSL_ENABLED ON) + set(UHTTPD_SSL_ENABLED_CONFIG 1) + set(UHTTPD_USE_OPENSSL_CONFIG 1) list(APPEND EXTRA_LIBS ${OPENSSL_LIBRARIES}) include_directories(${OPENSSL_INCLUDE_DIR}) elseif(CYASSL_FOUND) - set(UHTTP_SSL_ENABLED ON) - set(UHTTP_SSL_ENABLED_CONFIG 1) - set(UHTTP_USE_CYASSL_CONFIG 1) + set(UHTTPD_SSL_ENABLED ON) + set(UHTTPD_SSL_ENABLED_CONFIG 1) + set(UHTTPD_USE_CYASSL_CONFIG 1) list(APPEND EXTRA_LIBS ${CYASSL_LIBRARIES}) include_directories(${CYASSL_INCLUDE_DIR}) @@ -72,45 +72,45 @@ if(NOT UHTTP_DISABLE_SSL) endif() endif() -add_library(uhttp SHARED ${SOURCE_FILES}) -set_target_properties(uhttp PROPERTIES VERSION ${UHTTP_VERSION_MAJOR}.${UHTTP_VERSION_MINOR}.${UHTTP_VERSION_PATCH}) -target_link_libraries(uhttp ${EXTRA_LIBS}) +add_library(uhttpd SHARED ${SOURCE_FILES}) +set_target_properties(uhttpd PROPERTIES VERSION ${UHTTPD_VERSION_MAJOR}.${UHTTPD_VERSION_MINOR}.${UHTTPD_VERSION_PATCH}) +target_link_libraries(uhttpd ${EXTRA_LIBS}) # configure a header file to pass some of the CMake settings to the source code -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/uhttp/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/uhttpd/config.h) install( FILES - ${CMAKE_CURRENT_BINARY_DIR}/include/uhttp/config.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/uhttp.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/log.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/buf.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/str.h - ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/parser.h + ${CMAKE_CURRENT_BINARY_DIR}/include/uhttpd/config.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/uhttpd.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/log.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/buf.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/str.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/parser.h DESTINATION - include/uhttp + include/uhttpd ) install( FILES - ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp.h + ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd.h DESTINATION include ) install( - TARGETS uhttp LIBRARY + TARGETS uhttpd LIBRARY DESTINATION lib ) message("") -message(STATUS "UHTTP_VERSION: ${UHTTP_VERSION_MAJOR}.${UHTTP_VERSION_MINOR}.${UHTTP_VERSION_PATCH}") -if(UHTTP_USE_OPENSSL_CONFIG) -message(STATUS "UHTTP_SSL_ENABLED: OpenSSL") -elseif(UHTTP_USE_CYASSL_CONFIG) -message(STATUS "UHTTP_SSL_ENABLED: CyaSSL") +message(STATUS "UHTTPD_VERSION: ${UHTTPD_VERSION_MAJOR}.${UHTTPD_VERSION_MINOR}.${UHTTPD_VERSION_PATCH}") +if(UHTTPD_USE_OPENSSL_CONFIG) +message(STATUS "UHTTPD_SSL_ENABLED: OpenSSL") +elseif(UHTTPD_USE_CYASSL_CONFIG) +message(STATUS "UHTTPD_SSL_ENABLED: CyaSSL") else() -message(STATUS "UHTTP_SSL_ENABLED: None") +message(STATUS "UHTTPD_SSL_ENABLED: None") endif() -message(STATUS "DEBUG: ${UHTTP_DEBUG}") +message(STATUS "DEBUG: ${UHTTPD_DEBUG}") message("") diff --git a/src/buf.c b/src/buf.c index 830c90f..514f887 100755 --- a/src/buf.c +++ b/src/buf.c @@ -17,8 +17,8 @@ #include #include -#include "uhttp/buf.h" -#include "uhttp/log.h" +#include "uhttpd/buf.h" +#include "uhttpd/log.h" int uh_buf_init(struct uh_buf *buf, size_t initial_size) { diff --git a/src/include/internal.h b/src/include/internal.h index 02704dc..453eb60 100755 --- a/src/include/internal.h +++ b/src/include/internal.h @@ -21,7 +21,7 @@ #include #include "list.h" -#include "uhttp/uhttp.h" +#include "uhttpd/uhttpd.h" #define UH_BUFFER_SIZE 2048 #define UH_CONNECTION_TIMEOUT 30 diff --git a/src/include/uhttp/config.h.in b/src/include/uhttp/config.h.in deleted file mode 100755 index 0970b69..0000000 --- a/src/include/uhttp/config.h.in +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _UHTTP_CONFIG_H -#define _UHTTP_CONFIG_H - -#define UHTTP_VERSION_MAJOR @UHTTP_VERSION_MAJOR@ -#define UHTTP_VERSION_MINOR @UHTTP_VERSION_MINOR@ -#define UHTTP_VERSION_PATCH @UHTTP_VERSION_PATCH@ -#define UHTTP_VERSION_STRING "@UHTTP_VERSION_MAJOR@.@UHTTP_VERSION_MINOR@.@UHTTP_VERSION_PATCH@" - -#define UHTTP_DEBUG @UHTTP_DEBUG_CONFIG@ - -#define UHTTP_SSL_ENABLED @UHTTP_SSL_ENABLED_CONFIG@ -#define UHTTP_USE_OPENSSL @UHTTP_USE_OPENSSL_CONFIG@ -#define UHTTP_USE_CYASSL @UHTTP_USE_CYASSL_CONFIG@ - -#endif diff --git a/src/include/uhttp.h b/src/include/uhttpd.h similarity index 92% rename from src/include/uhttp.h rename to src/include/uhttpd.h index 03a394e..52886f4 100755 --- a/src/include/uhttp.h +++ b/src/include/uhttpd.h @@ -15,9 +15,9 @@ * along with this program. If not, see . */ -#ifndef _UHTTP_H -#define _UHTTP_H +#ifndef _UHTTPD_H +#define _UHTTPD_H -#include "uhttp/uhttp.h" +#include "uhttpd/uhttpd.h" #endif diff --git a/src/include/uhttp/buf.h b/src/include/uhttpd/buf.h similarity index 97% rename from src/include/uhttp/buf.h rename to src/include/uhttpd/buf.h index d5b2d74..ca0f2d6 100755 --- a/src/include/uhttp/buf.h +++ b/src/include/uhttpd/buf.h @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#ifndef _UHTTP_BUF_H -#define _UHTTP_BUF_H +#ifndef _UHTTPD_BUF_H +#define _UHTTPD_BUF_H #include #include diff --git a/src/include/uhttpd/config.h.in b/src/include/uhttpd/config.h.in new file mode 100755 index 0000000..17ba48c --- /dev/null +++ b/src/include/uhttpd/config.h.in @@ -0,0 +1,15 @@ +#ifndef _UHTTPD_CONFIG_H +#define _UHTTPD_CONFIG_H + +#define UHTTPD_VERSION_MAJOR @UHTTPD_VERSION_MAJOR@ +#define UHTTPD_VERSION_MINOR @UHTTPD_VERSION_MINOR@ +#define UHTTPD_VERSION_PATCH @UHTTPD_VERSION_PATCH@ +#define UHTTPD_VERSION_STRING "@UHTTPD_VERSION_MAJOR@.@UHTTPD_VERSION_MINOR@.@UHTTPD_VERSION_PATCH@" + +#define UHTTPD_DEBUG @UHTTPD_DEBUG_CONFIG@ + +#define UHTTPD_SSL_ENABLED @UHTTPD_SSL_ENABLED_CONFIG@ +#define UHTTPD_USE_OPENSSL @UHTTPD_USE_OPENSSL_CONFIG@ +#define UHTTPD_USE_CYASSL @UHTTPD_USE_CYASSL_CONFIG@ + +#endif diff --git a/src/include/uhttp/log.h b/src/include/uhttpd/log.h similarity index 94% rename from src/include/uhttp/log.h rename to src/include/uhttpd/log.h index 15b141e..9b7c021 100755 --- a/src/include/uhttp/log.h +++ b/src/include/uhttpd/log.h @@ -15,15 +15,15 @@ * along with this program. If not, see . */ -#ifndef _UHTTP_LOG_H -#define _UHTTP_LOG_H +#ifndef _UHTTPD_LOG_H +#define _UHTTPD_LOG_H #include #include #include #include #include -#include "uhttp/config.h" +#include "uhttpd/config.h" #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) @@ -32,7 +32,7 @@ */ #define uh_log(priority, format...) __uh_log(__FILENAME__, __LINE__, priority, format) -#if (UHTTP_DEBUG) +#if (UHTTPD_DEBUG) #define uh_log_debug(format...) uh_log(LOG_DEBUG, format) #else #define uh_log_debug(format...) diff --git a/src/include/uhttp/parser.h b/src/include/uhttpd/parser.h similarity index 99% rename from src/include/uhttp/parser.h rename to src/include/uhttpd/parser.h index 3770dda..ed956ff 100644 --- a/src/include/uhttp/parser.h +++ b/src/include/uhttpd/parser.h @@ -18,8 +18,8 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ -#ifndef _UHTTP_PARSER_H -#define _UHTTP_PARSER_H +#ifndef _UHTTPD_PARSER_H +#define _UHTTPD_PARSER_H #ifdef __cplusplus extern "C" { #endif diff --git a/src/include/uhttp/ssl.h b/src/include/uhttpd/ssl.h similarity index 98% rename from src/include/uhttp/ssl.h rename to src/include/uhttpd/ssl.h index c91ec7b..28765b0 100755 --- a/src/include/uhttp/ssl.h +++ b/src/include/uhttpd/ssl.h @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#ifndef _UHTTP_SSL_H -#define _UHTTP_SSL_H +#ifndef _UHTTPD_SSL_H +#define _UHTTPD_SSL_H #include "internal.h" diff --git a/src/include/uhttp/str.h b/src/include/uhttpd/str.h similarity index 95% rename from src/include/uhttp/str.h rename to src/include/uhttpd/str.h index 9dce267..e3b82a0 100755 --- a/src/include/uhttp/str.h +++ b/src/include/uhttpd/str.h @@ -15,8 +15,8 @@ * along with this program. If not, see . */ -#ifndef _UHTTP_STR_H -#define _UHTTP_STR_H +#ifndef _UHTTPD_STR_H +#define _UHTTPD_STR_H struct uh_str { const char *at; diff --git a/src/include/uhttp/uhttp.h b/src/include/uhttpd/uhttpd.h similarity index 96% rename from src/include/uhttp/uhttp.h rename to src/include/uhttpd/uhttpd.h index 4cbe773..cf9a232 100755 --- a/src/include/uhttp/uhttp.h +++ b/src/include/uhttpd/uhttpd.h @@ -15,17 +15,17 @@ * along with this program. If not, see . */ -#ifndef _UHTTP_UHTTP_H -#define _UHTTP_UHTTP_H +#ifndef _UHTTPD_UHTTP_H +#define _UHTTPD_UHTTP_H #include #include -#include "uhttp/config.h" -#include "uhttp/log.h" -#include "uhttp/buf.h" -#include "uhttp/str.h" -#include "uhttp/parser.h" +#include "uhttpd/config.h" +#include "uhttpd/log.h" +#include "uhttpd/buf.h" +#include "uhttpd/str.h" +#include "uhttpd/parser.h" struct uh_server; struct uh_connection; diff --git a/src/log.c b/src/log.c index 617bb2f..38b9225 100755 --- a/src/log.c +++ b/src/log.c @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -#include "uhttp/log.h" +#include "uhttpd/log.h" void __uh_log(const char *filename, int line, int priority, const char *format, ...) { @@ -35,7 +35,7 @@ void __uh_log(const char *filename, int line, int priority, const char *format, syslog(priority, "%s", buf); -#if (UHTTP_DEBUG) +#if (UHTTPD_DEBUG) fprintf(stderr, "%s\n", buf); #else if (priority == LOG_ERR) diff --git a/src/ssl.c b/src/ssl.c index 659808e..8c74bab 100755 --- a/src/ssl.c +++ b/src/ssl.c @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -#include "uhttp/ssl.h" +#include "uhttpd/ssl.h" #include #include diff --git a/src/template.c b/src/template.c index b38745a..d8977cf 100755 --- a/src/template.c +++ b/src/template.c @@ -30,7 +30,7 @@ #include #include "internal.h" -#include "uhttp/uhttp.h" +#include "uhttpd/uhttpd.h" /* code types */ #define T_TYPE_INIT 0 diff --git a/src/uhttp.c b/src/uhttpd.c similarity index 99% rename from src/uhttp.c rename to src/uhttpd.c index 4782399..ab9c177 100755 --- a/src/uhttp.c +++ b/src/uhttpd.c @@ -24,12 +24,12 @@ #include #include "internal.h" -#include "uhttp/uhttp.h" -#include "uhttp/ssl.h" +#include "uhttpd/uhttpd.h" +#include "uhttpd/ssl.h" const char *uh_version() { - return UHTTP_VERSION_STRING; + return UHTTPD_VERSION_STRING; } static const char *http_status_str(enum http_status s) @@ -223,7 +223,7 @@ static void connection_read_cb(struct ev_loop *loop, ev_io *w, int revents) char *base; int len, parsered; -#if (UHTTP_SSL_ENABLED) +#if (UHTTPD_SSL_ENABLED) if (con->flags & UH_CON_SSL_HANDSHAKE_DONE) goto handshake_done; @@ -467,7 +467,7 @@ static void send_status_line(struct uh_connection *con, int code) { const char *reason = http_status_str(code); uh_printf(con, "HTTP/1.1 %d %s\r\nServer: Libuhttp %s\r\n", - code, reason, UHTTP_VERSION_STRING); + code, reason, UHTTPD_VERSION_STRING); } void uh_send_head(struct uh_connection *con, int status, int length, const char *extra_headers)