Update README

Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
main
Jianhui Zhao 2017-11-12 16:28:09 +08:00
parent 73c08a4bcf
commit 0866539493
2 changed files with 64 additions and 21 deletions

View File

@ -2,34 +2,77 @@
![](https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic "License")
A very tiny and fast HTTP library based on [libev](http://software.schmorp.de/pkg/libev.html) and
[http-parser](https://github.com/nodejs/http-parser) for Embedded Linux.
[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.
`Keep Watching for More Actions on This Space`
# Features
* Tiny and fast
* use [libev] as its event backend
* tiny and fast
* SSL support: Optional OpenSSL and CyaSSl(wolfssl)
* Highly customizable, and can be easily integrated into your application
* flexible and you can easily extend your application to have HTTP/HTTPS services
# How To Compile on Ubuntu
# Why use [libev] as its backend?
[libev] tries to do one thing only (POSIX event library), and this in the most efficient way possible.
Libevent tries to give you the full solution (event lib, non-blocking I/O library, http server, DNS client).
[libev] tries to follow the UNIX toolbox philosophy of doing one thing only, as good as possible.
# Build on Ubuntu
## Install dependency Tools and Libraries
sudo apt install cmake libev-dev libhttp-parser-dev
## Compile libuhttp
git clone https://github.com/zhaojh329/libuhttp.git
cd libuhttp
mkdir build
cd build
cmake ../
make && sudo make install
~$ sudo apt install cmake libev-dev libhttp-parser-dev libssl-dev libwolfssl-dev
## Test
$ cd ../ && ./gen_cert.sh
$ ./build/example/helloworld
## Clone the repository
~$ git clone https://github.com/zhaojh329/libuhttp.git
~$ cd libuhttp
## Create the build directory
~/libuhttp$ mkdir build
~/libuhttp$ cd build
## Configure
See which configuration are supported
~/libuhttp/build$ cmake .. -LH
Default configure: automatically select the SSL library as its SSL backend(If there is a SSL library available).
~/libuhttp/build$ cmake ..
Disable SSl support
~/libuhttp/build$ cmake .. -DUHTTP_DISABLE_SSL=1
Explicit use OpenSSL as its SSL backend
~/libuhttp/build$ cmake .. -DUHTTP_USE_OPENSSL=1
Explicit use CyaSSl(wolfssl) as its SSL backend
~/libuhttp/build$ cmake .. -DUHTTP_USE_CYASSL=1
Then use the command curl or browser to access https://127.0.0.1:8000/test
## Build and install libuhttp
~/libuhttp/build$ make && sudo make install
## Run the Example
First generate the SSL certificate file
~/libuhttp/build$ cd ..
~/libuhttp$ ./gen_cert.sh
Run
~/libuhttp$ ./build/example/helloworld
Then use the command curl or browser to access https://127.0.0.1:8000/test
$ curl -k https://127.0.0.1:8000/test -v
# [Example](https://github.com/zhaojh329/libuhttp/blob/master/example/helloworld.c)
@ -39,7 +82,7 @@ If you would like to help making [libuhttp](https://github.com/zhaojh329/libuhtt
see the [CONTRIBUTING.md](https://github.com/zhaojh329/libuhttp/blob/master/CONTRIBUTING.md) file.
# Thanks for the following project
* [libev](http://software.schmorp.de/pkg/libev.html)
* [http-parser](https://github.com/nodejs/http-parser)
* [libev]
* [http-parser]
# If the project is helpful to you, please do not hesitate to star. Thank you!

View File

@ -15,8 +15,8 @@ set(EXTRA_LIBS ${LIBEV_LIBRARIES} ${HTTPPARSER_LIBRARIES})
set(SOURCE_FILES uhttp.c uhttp_log.c uhttp_buf.c uhttp_ssl.c)
option(UHTTP_DISABLE_SSL "Disable ssl support" OFF)
option(UHTTP_USE_OPENSSL "Force use OpenSSL as SSL backend" OFF)
option(UHTTP_USE_CYASSL "Force use CyaSSL as SSL backend" OFF)
option(UHTTP_USE_OPENSSL "Explicit use OpenSSL as SSL backend" OFF)
option(UHTTP_USE_CYASSL "Explicit use CyaSSL as SSL backend" OFF)
set(UHTTP_SSL_ENABLED OFF)
set(UHTTP_SSL_ENABLED_CONFIG 0)