Renamed project: libuhttp -> libuhttpd

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-12-29 11:44:03 +08:00
parent 01503b3128
commit 62a3a563f1
24 changed files with 153 additions and 153 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(libuhttp C) project(libuhttpd C)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/") 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( include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src/include ${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 ${CMAKE_CURRENT_BINARY_DIR}/src/include
) )

View File

@ -1,7 +1,7 @@
Contributing 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: 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: 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: 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. You can name it however you want.

View File

@ -1,7 +1,7 @@
贡献代码 贡献代码
================================================================================ ================================================================================
如果你想为[libuhttp](https://github.com/zhaojh329/libuhttp)贡献代码, 请按照如下步骤: 如果你想为[libuhttpd](https://github.com/zhaojh329/libuhttpd)贡献代码, 请按照如下步骤:
1. 点击fork按钮: 1. 点击fork按钮:
@ -10,13 +10,13 @@
2. 从你的github账户克隆仓库代码: 2. 从你的github账户克隆仓库代码:
``` ```
git clone https://github.com/你的github账户/libuhttp.git git clone https://github.com/你的github账户/libuhttpd.git
``` ```
3. 创建一个新的分支: 3. 创建一个新的分支:
``` ```
git checkout -b "libuhttp-1-fix" git checkout -b "libuhttpd-1-fix"
``` ```
你可以使用一个你想要的分支名称。 你可以使用一个你想要的分支名称。

View File

@ -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") ![](https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic "License")
[libev]: http://software.schmorp.de/pkg/libev.html [libev]: http://software.schmorp.de/pkg/libev.html
[http-parser]: https://github.com/nodejs/http-parser [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, Support HTTPS(alternative OpenSSL and CyaSSl(wolfssl)) and if you're sensitive to size,
you can choose CyaSSl(wolfssl). you can choose CyaSSl(wolfssl).
@ -37,53 +37,53 @@ CentOS
## Clone the repository ## Clone the repository
~$ git clone https://github.com/zhaojh329/libuhttp.git ~$ git clone https://github.com/zhaojh329/libuhttpd.git
~$ cd libuhttp ~$ cd libuhttpd
## Create the build directory ## Create the build directory
~/libuhttp$ mkdir build ~/libuhttpd$ mkdir build
~/libuhttp$ cd build ~/libuhttpd$ cd build
## Configure ## Configure
See which configuration are supported See which configuration are supported
~/libuhttp/build$ cmake .. -L ~/libuhttpd/build$ cmake .. -L
~/libuhttp/build$ cmake .. -LH ~/libuhttpd/build$ cmake .. -LH
Default configure: automatically select the SSL library as its SSL backend(If there is a SSL library available) 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 Disable SSl support
~/libuhttp/build$ cmake .. -DUHTTP_DISABLE_SSL=1 ~/libuhttpd/build$ cmake .. -DUHTTP_DISABLE_SSL=1
Explicit use OpenSSL as its SSL backend 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 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 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 ## Run the Example
First generate the SSL certificate file First generate the SSL certificate file
~/libuhttp/build$ cd .. ~/libuhttpd/build$ cd ..
~/libuhttp$ ./gen_cert.sh ~/libuhttpd$ ./gen_cert.sh
Run Run
~/libuhttp$ ./build/example/helloworld ~/libuhttpd$ ./build/example/helloworld
Then use the command curl or browser to test 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 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 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 # Contributing
If you would like to help making [libuhttp](https://github.com/zhaojh329/libuhttp) better, If you would like to help making [libuhttpd](https://github.com/zhaojh329/libuhttpd) better,
see the [CONTRIBUTING.md](https://github.com/zhaojh329/libuhttp/blob/master/CONTRIBUTING.md) file. see the [CONTRIBUTING.md](https://github.com/zhaojh329/libuhttpd/blob/master/CONTRIBUTING.md) file.
# Thanks for the following project # Thanks for the following project
* [libev] * [libev]

View File

@ -1,4 +1,4 @@
# libuhttp # libuhttpd
![](https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic "License") ![](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 ~$ git clone https://github.com/zhaojh329/libuhttpd.git
~$ cd libuhttp ~$ cd libuhttpd
## 创建编译目录 ## 创建编译目录
~/libuhttp$ mkdir build ~/libuhttpd$ mkdir build
~/libuhttp$ cd build ~/libuhttpd$ cd build
## 配置 ## 配置
查看支持哪些配置选项 查看支持哪些配置选项
~/libuhttp/build$ cmake .. -L ~/libuhttpd/build$ cmake .. -L
~/libuhttp/build$ cmake .. -LH ~/libuhttpd/build$ cmake .. -LH
默认配置: 自动选择SSL库(如果有可用的SSL库) 默认配置: 自动选择SSL库(如果有可用的SSL库)
~/libuhttp/build$ cmake .. ~/libuhttpd/build$ cmake ..
禁用SSL 禁用SSL
~/libuhttp/build$ cmake .. -DUHTTP_DISABLE_SSL=1 ~/libuhttpd/build$ cmake .. -DUHTTP_DISABLE_SSL=1
强制选择OpenSSL 强制选择OpenSSL
~/libuhttp/build$ cmake .. -DUHTTP_USE_OPENSSL=1 ~/libuhttpd/build$ cmake .. -DUHTTP_USE_OPENSSL=1
强制选择CyaSSl(wolfssl) 强制选择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证书文件 首先生成SSL证书文件
~/libuhttp/build$ cd .. ~/libuhttpd/build$ cd ..
~/libuhttp$ ./gen_cert.sh ~/libuhttpd$ ./gen_cert.sh
运行 运行
~/libuhttp$ ./build/example/helloworld ~/libuhttpd$ ./build/example/helloworld
然后使用命令curl或者浏览器进行测试 然后使用命令curl或者浏览器进行测试
@ -98,11 +98,11 @@ CentOS
Host: 192.168.0.100:8000 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 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)变得更好,请参考 如果你想帮助[libuhttpd](https://github.com/zhaojh329/libuhttpd)变得更好,请参考
[CONTRIBUTING_ZH.md](https://github.com/zhaojh329/libuhttp/blob/master/CONTRIBUTING_ZH.md)。 [CONTRIBUTING_ZH.md](https://github.com/zhaojh329/libuhttpd/blob/master/CONTRIBUTING_ZH.md)。
# 技术交流 # 技术交流
QQ群153530783 QQ群153530783

View File

@ -1,6 +1,6 @@
add_executable(helloworld helloworld.c) add_executable(helloworld helloworld.c)
target_link_libraries(helloworld uhttp) target_link_libraries(helloworld uhttpd)
add_executable(lua_template lua_template.c) add_executable(lua_template lua_template.c)
target_link_libraries(lua_template uhttp) target_link_libraries(lua_template uhttpd)

View File

@ -1,6 +1,6 @@
#include <ev.h> #include <ev.h>
#include <stdio.h> #include <stdio.h>
#include <uhttp.h> #include <uhttpd.h>
static void signal_cb(struct ev_loop *loop, ev_signal *w, int revents) static void signal_cb(struct ev_loop *loop, ev_signal *w, int revents)
{ {

View File

@ -1,6 +1,6 @@
#include <ev.h> #include <ev.h>
#include <stdio.h> #include <stdio.h>
#include <uhttp.h> #include <uhttpd.h>
static void signal_cb(struct ev_loop *loop, ev_signal *w, int revents) static void signal_cb(struct ev_loop *loop, ev_signal *w, int revents)
{ {

View File

@ -1,7 +1,7 @@
# The version number. # The version number.
set(UHTTP_VERSION_MAJOR 0) set(UHTTPD_VERSION_MAJOR 0)
set(UHTTP_VERSION_MINOR 3) set(UHTTPD_VERSION_MINOR 3)
set(UHTTP_VERSION_PATCH 0) set(UHTTPD_VERSION_PATCH 0)
# Check the third party Libraries # Check the third party Libraries
find_package(Libev REQUIRED) find_package(Libev REQUIRED)
@ -11,60 +11,60 @@ find_package(Lua)
include_directories(${LIBEV_INCLUDE_DIR} ${LUA_INCLUDE_DIR}) include_directories(${LIBEV_INCLUDE_DIR} ${LUA_INCLUDE_DIR})
set(EXTRA_LIBS ${LIBEV_LIBRARIES} ${LUA_LIBRARIES}) 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) set(UHTTPD_DEBUG_CONFIG 0)
option(UHTTP_DEBUG "Turn on debug" OFF) option(UHTTPD_DEBUG "Turn on debug" OFF)
if(UHTTP_DEBUG) if(UHTTPD_DEBUG)
set(UHTTP_DEBUG_CONFIG 1) set(UHTTPD_DEBUG_CONFIG 1)
endif() endif()
option(UHTTP_DISABLE_SSL "Disable ssl support" OFF) option(UHTTPD_DISABLE_SSL "Disable ssl support" OFF)
option(UHTTP_USE_OPENSSL "Explicit use OpenSSL as SSL backend" OFF) option(UHTTPD_USE_OPENSSL "Explicit use OpenSSL as SSL backend" OFF)
option(UHTTP_USE_CYASSL "Explicit use CyaSSL as SSL backend" OFF) option(UHTTPD_USE_CYASSL "Explicit use CyaSSL as SSL backend" OFF)
set(UHTTP_SSL_ENABLED OFF) set(UHTTPD_SSL_ENABLED OFF)
set(UHTTP_SSL_ENABLED_CONFIG 0) set(UHTTPD_SSL_ENABLED_CONFIG 0)
set(UHTTP_USE_OPENSSL_CONFIG 0) set(UHTTPD_USE_OPENSSL_CONFIG 0)
set(UHTTP_USE_CYASSL_CONFIG 0) set(UHTTPD_USE_CYASSL_CONFIG 0)
if(NOT UHTTP_DISABLE_SSL) if(NOT UHTTPD_DISABLE_SSL)
if(UHTTP_USE_OPENSSL) if(UHTTPD_USE_OPENSSL)
if(NOT OPENSSL_FOUND) if(NOT OPENSSL_FOUND)
message(FATAL_ERROR "Could NOT find OpenSSL") message(FATAL_ERROR "Could NOT find OpenSSL")
endif() endif()
set(UHTTP_SSL_ENABLED ON) set(UHTTPD_SSL_ENABLED ON)
set(UHTTP_SSL_ENABLED_CONFIG 1) set(UHTTPD_SSL_ENABLED_CONFIG 1)
set(UHTTP_USE_OPENSSL_CONFIG 1) set(UHTTPD_USE_OPENSSL_CONFIG 1)
list(APPEND EXTRA_LIBS ${OPENSSL_LIBRARIES}) list(APPEND EXTRA_LIBS ${OPENSSL_LIBRARIES})
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
elseif(UHTTP_USE_CYASSL) elseif(UHTTPD_USE_CYASSL)
if (NOT CYASSL_FOUND) if (NOT CYASSL_FOUND)
message(FATAL_ERROR "Could NOT find CyaSSL") message(FATAL_ERROR "Could NOT find CyaSSL")
endif() endif()
set(UHTTP_SSL_ENABLED ON) set(UHTTPD_SSL_ENABLED ON)
set(UHTTP_SSL_ENABLED_CONFIG 1) set(UHTTPD_SSL_ENABLED_CONFIG 1)
set(UHTTP_USE_CYASSL_CONFIG 1) set(UHTTPD_USE_CYASSL_CONFIG 1)
list(APPEND EXTRA_LIBS ${CYASSL_LIBRARIES}) list(APPEND EXTRA_LIBS ${CYASSL_LIBRARIES})
include_directories(${CYASSL_INCLUDE_DIR}) include_directories(${CYASSL_INCLUDE_DIR})
endif() endif()
if(NOT UHTTP_SSL_ENABLED) if(NOT UHTTPD_SSL_ENABLED)
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
set(UHTTP_SSL_ENABLED ON) set(UHTTPD_SSL_ENABLED ON)
set(UHTTP_SSL_ENABLED_CONFIG 1) set(UHTTPD_SSL_ENABLED_CONFIG 1)
set(UHTTP_USE_OPENSSL_CONFIG 1) set(UHTTPD_USE_OPENSSL_CONFIG 1)
list(APPEND EXTRA_LIBS ${OPENSSL_LIBRARIES}) list(APPEND EXTRA_LIBS ${OPENSSL_LIBRARIES})
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
elseif(CYASSL_FOUND) elseif(CYASSL_FOUND)
set(UHTTP_SSL_ENABLED ON) set(UHTTPD_SSL_ENABLED ON)
set(UHTTP_SSL_ENABLED_CONFIG 1) set(UHTTPD_SSL_ENABLED_CONFIG 1)
set(UHTTP_USE_CYASSL_CONFIG 1) set(UHTTPD_USE_CYASSL_CONFIG 1)
list(APPEND EXTRA_LIBS ${CYASSL_LIBRARIES}) list(APPEND EXTRA_LIBS ${CYASSL_LIBRARIES})
include_directories(${CYASSL_INCLUDE_DIR}) include_directories(${CYASSL_INCLUDE_DIR})
@ -72,45 +72,45 @@ if(NOT UHTTP_DISABLE_SSL)
endif() endif()
endif() endif()
add_library(uhttp SHARED ${SOURCE_FILES}) add_library(uhttpd SHARED ${SOURCE_FILES})
set_target_properties(uhttp PROPERTIES VERSION ${UHTTP_VERSION_MAJOR}.${UHTTP_VERSION_MINOR}.${UHTTP_VERSION_PATCH}) set_target_properties(uhttpd PROPERTIES VERSION ${UHTTPD_VERSION_MAJOR}.${UHTTPD_VERSION_MINOR}.${UHTTPD_VERSION_PATCH})
target_link_libraries(uhttp ${EXTRA_LIBS}) target_link_libraries(uhttpd ${EXTRA_LIBS})
# configure a header file to pass some of the CMake settings to the source code # 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( install(
FILES FILES
${CMAKE_CURRENT_BINARY_DIR}/include/uhttp/config.h ${CMAKE_CURRENT_BINARY_DIR}/include/uhttpd/config.h
${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/uhttp.h ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/uhttpd.h
${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/log.h ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/log.h
${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/buf.h ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/buf.h
${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/str.h ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/str.h
${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp/parser.h ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd/parser.h
DESTINATION DESTINATION
include/uhttp include/uhttpd
) )
install( install(
FILES FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/uhttp.h ${CMAKE_CURRENT_SOURCE_DIR}/include/uhttpd.h
DESTINATION DESTINATION
include include
) )
install( install(
TARGETS uhttp LIBRARY TARGETS uhttpd LIBRARY
DESTINATION lib DESTINATION lib
) )
message("") message("")
message(STATUS "UHTTP_VERSION: ${UHTTP_VERSION_MAJOR}.${UHTTP_VERSION_MINOR}.${UHTTP_VERSION_PATCH}") message(STATUS "UHTTPD_VERSION: ${UHTTPD_VERSION_MAJOR}.${UHTTPD_VERSION_MINOR}.${UHTTPD_VERSION_PATCH}")
if(UHTTP_USE_OPENSSL_CONFIG) if(UHTTPD_USE_OPENSSL_CONFIG)
message(STATUS "UHTTP_SSL_ENABLED: OpenSSL") message(STATUS "UHTTPD_SSL_ENABLED: OpenSSL")
elseif(UHTTP_USE_CYASSL_CONFIG) elseif(UHTTPD_USE_CYASSL_CONFIG)
message(STATUS "UHTTP_SSL_ENABLED: CyaSSL") message(STATUS "UHTTPD_SSL_ENABLED: CyaSSL")
else() else()
message(STATUS "UHTTP_SSL_ENABLED: None") message(STATUS "UHTTPD_SSL_ENABLED: None")
endif() endif()
message(STATUS "DEBUG: ${UHTTP_DEBUG}") message(STATUS "DEBUG: ${UHTTPD_DEBUG}")
message("") message("")

View File

@ -17,8 +17,8 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "uhttp/buf.h" #include "uhttpd/buf.h"
#include "uhttp/log.h" #include "uhttpd/log.h"
int uh_buf_init(struct uh_buf *buf, size_t initial_size) int uh_buf_init(struct uh_buf *buf, size_t initial_size)
{ {

View File

@ -21,7 +21,7 @@
#include <lua.h> #include <lua.h>
#include "list.h" #include "list.h"
#include "uhttp/uhttp.h" #include "uhttpd/uhttpd.h"
#define UH_BUFFER_SIZE 2048 #define UH_BUFFER_SIZE 2048
#define UH_CONNECTION_TIMEOUT 30 #define UH_CONNECTION_TIMEOUT 30

View File

@ -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

View File

@ -15,9 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _UHTTP_H #ifndef _UHTTPD_H
#define _UHTTP_H #define _UHTTPD_H
#include "uhttp/uhttp.h" #include "uhttpd/uhttpd.h"
#endif #endif

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _UHTTP_BUF_H #ifndef _UHTTPD_BUF_H
#define _UHTTP_BUF_H #define _UHTTPD_BUF_H
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -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

View File

@ -15,15 +15,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _UHTTP_LOG_H #ifndef _UHTTPD_LOG_H
#define _UHTTP_LOG_H #define _UHTTPD_LOG_H
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <errno.h> #include <errno.h>
#include <syslog.h> #include <syslog.h>
#include "uhttp/config.h" #include "uhttpd/config.h"
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
@ -32,7 +32,7 @@
*/ */
#define uh_log(priority, format...) __uh_log(__FILENAME__, __LINE__, priority, format) #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) #define uh_log_debug(format...) uh_log(LOG_DEBUG, format)
#else #else
#define uh_log_debug(format...) #define uh_log_debug(format...)

View File

@ -18,8 +18,8 @@
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
#ifndef _UHTTP_PARSER_H #ifndef _UHTTPD_PARSER_H
#define _UHTTP_PARSER_H #define _UHTTPD_PARSER_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _UHTTP_SSL_H #ifndef _UHTTPD_SSL_H
#define _UHTTP_SSL_H #define _UHTTPD_SSL_H
#include "internal.h" #include "internal.h"

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _UHTTP_STR_H #ifndef _UHTTPD_STR_H
#define _UHTTP_STR_H #define _UHTTPD_STR_H
struct uh_str { struct uh_str {
const char *at; const char *at;

View File

@ -15,17 +15,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _UHTTP_UHTTP_H #ifndef _UHTTPD_UHTTP_H
#define _UHTTP_UHTTP_H #define _UHTTPD_UHTTP_H
#include <ev.h> #include <ev.h>
#include <stdbool.h> #include <stdbool.h>
#include "uhttp/config.h" #include "uhttpd/config.h"
#include "uhttp/log.h" #include "uhttpd/log.h"
#include "uhttp/buf.h" #include "uhttpd/buf.h"
#include "uhttp/str.h" #include "uhttpd/str.h"
#include "uhttp/parser.h" #include "uhttpd/parser.h"
struct uh_server; struct uh_server;
struct uh_connection; struct uh_connection;

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "uhttp/log.h" #include "uhttpd/log.h"
void __uh_log(const char *filename, int line, int priority, const char *format, ...) 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); syslog(priority, "%s", buf);
#if (UHTTP_DEBUG) #if (UHTTPD_DEBUG)
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
#else #else
if (priority == LOG_ERR) if (priority == LOG_ERR)

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "uhttp/ssl.h" #include "uhttpd/ssl.h"
#include <unistd.h> #include <unistd.h>
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -30,7 +30,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include "internal.h" #include "internal.h"
#include "uhttp/uhttp.h" #include "uhttpd/uhttpd.h"
/* code types */ /* code types */
#define T_TYPE_INIT 0 #define T_TYPE_INIT 0

View File

@ -24,12 +24,12 @@
#include <signal.h> #include <signal.h>
#include "internal.h" #include "internal.h"
#include "uhttp/uhttp.h" #include "uhttpd/uhttpd.h"
#include "uhttp/ssl.h" #include "uhttpd/ssl.h"
const char *uh_version() const char *uh_version()
{ {
return UHTTP_VERSION_STRING; return UHTTPD_VERSION_STRING;
} }
static const char *http_status_str(enum http_status s) 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; char *base;
int len, parsered; int len, parsered;
#if (UHTTP_SSL_ENABLED) #if (UHTTPD_SSL_ENABLED)
if (con->flags & UH_CON_SSL_HANDSHAKE_DONE) if (con->flags & UH_CON_SSL_HANDSHAKE_DONE)
goto 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); const char *reason = http_status_str(code);
uh_printf(con, "HTTP/1.1 %d %s\r\nServer: Libuhttp %s\r\n", 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) void uh_send_head(struct uh_connection *con, int status, int length, const char *extra_headers)