parent
73c08a4bcf
commit
0866539493
81
README.md
81
README.md
|
@ -2,33 +2,76 @@
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
A very tiny and fast HTTP library based on [libev](http://software.schmorp.de/pkg/libev.html) and
|
[libev]: http://software.schmorp.de/pkg/libev.html
|
||||||
[http-parser](https://github.com/nodejs/http-parser) for Embedded Linux.
|
[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`
|
`Keep Watching for More Actions on This Space`
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
* Tiny and fast
|
* use [libev] as its event backend
|
||||||
|
* tiny and fast
|
||||||
* SSL support: Optional OpenSSL and CyaSSl(wolfssl)
|
* 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
|
## Install dependency Tools and Libraries
|
||||||
sudo apt install cmake libev-dev libhttp-parser-dev
|
|
||||||
|
|
||||||
## Compile libuhttp
|
~$ sudo apt install cmake libev-dev libhttp-parser-dev libssl-dev libwolfssl-dev
|
||||||
git clone https://github.com/zhaojh329/libuhttp.git
|
|
||||||
cd libuhttp
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake ../
|
|
||||||
make && sudo make install
|
|
||||||
|
|
||||||
## Test
|
## Clone the repository
|
||||||
$ cd ../ && ./gen_cert.sh
|
|
||||||
$ ./build/example/helloworld
|
|
||||||
|
|
||||||
Then use the command curl or browser to access https://127.0.0.1:8000/test
|
~$ 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
|
||||||
|
|
||||||
|
## 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
|
$ curl -k https://127.0.0.1:8000/test -v
|
||||||
|
|
||||||
|
@ -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.
|
see the [CONTRIBUTING.md](https://github.com/zhaojh329/libuhttp/blob/master/CONTRIBUTING.md) file.
|
||||||
|
|
||||||
# Thanks for the following project
|
# Thanks for the following project
|
||||||
* [libev](http://software.schmorp.de/pkg/libev.html)
|
* [libev]
|
||||||
* [http-parser](https://github.com/nodejs/http-parser)
|
* [http-parser]
|
||||||
|
|
||||||
# If the project is helpful to you, please do not hesitate to star. Thank you!
|
# If the project is helpful to you, please do not hesitate to star. Thank you!
|
|
@ -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)
|
set(SOURCE_FILES uhttp.c uhttp_log.c uhttp_buf.c uhttp_ssl.c)
|
||||||
|
|
||||||
option(UHTTP_DISABLE_SSL "Disable ssl support" OFF)
|
option(UHTTP_DISABLE_SSL "Disable ssl support" OFF)
|
||||||
option(UHTTP_USE_OPENSSL "Force use OpenSSL as SSL backend" OFF)
|
option(UHTTP_USE_OPENSSL "Explicit use OpenSSL as SSL backend" OFF)
|
||||||
option(UHTTP_USE_CYASSL "Force use CyaSSL as SSL backend" OFF)
|
option(UHTTP_USE_CYASSL "Explicit use CyaSSL as SSL backend" OFF)
|
||||||
|
|
||||||
set(UHTTP_SSL_ENABLED OFF)
|
set(UHTTP_SSL_ENABLED OFF)
|
||||||
set(UHTTP_SSL_ENABLED_CONFIG 0)
|
set(UHTTP_SSL_ENABLED_CONFIG 0)
|
||||||
|
|
Loading…
Reference in New Issue