This is a maintenance fork of libuhttpd
 
 
 
Go to file
Jianhui Zhao ef94e04328 Bump version to 0.4.0
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
2017-12-29 11:46:11 +08:00
cmake/Modules Direct use the source code of http-parser 2017-11-22 14:11:31 +08:00
example Renamed project: libuhttp -> libuhttpd 2017-12-29 11:44:03 +08:00
src Bump version to 0.4.0 2017-12-29 11:46:11 +08:00
.gitignore New script used to automatically generate SSL certificate files 2017-11-11 17:10:22 +08:00
CMakeLists.txt Renamed project: libuhttp -> libuhttpd 2017-12-29 11:44:03 +08:00
CONTRIBUTING.md Renamed project: libuhttp -> libuhttpd 2017-12-29 11:44:03 +08:00
CONTRIBUTING_ZH.md Renamed project: libuhttp -> libuhttpd 2017-12-29 11:44:03 +08:00
LICENSE Initial commit 2017-11-04 17:30:20 +08:00
README.md Renamed project: libuhttp -> libuhttpd 2017-12-29 11:44:03 +08:00
README_ZH.md Renamed project: libuhttp -> libuhttpd 2017-12-29 11:44:03 +08:00
gen_cert.sh New script used to automatically generate SSL certificate files 2017-11-11 17:10:22 +08:00
openssl.cnf New script used to automatically generate SSL certificate files 2017-11-11 17:10:22 +08:00

README.md

libuhttpd(中文)

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).

Keep Watching for More Actions on This Space

Features

  • tiny and fast
  • use libev as its event backend
  • support HTTPS: alternative OpenSSL and CyaSSl(wolfssl)
  • flexible and you can easily extend your application to have HTTP/HTTPS services
  • Lua template: embed LUA code into HTML code, like embedding PHP to HTML
  • code structure is concise and understandable, also suitable for learning

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.

How to Build

Install dependency Tools and Libraries

Ubuntu

~$ sudo apt install gcc cmake libev-dev libssl-dev libwolfssl-dev

CentOS

~$ sudo yum install gcc cmake libev-devel openssl-devel

Clone the repository

~$ git clone https://github.com/zhaojh329/libuhttpd.git
~$ cd libuhttpd

Create the build directory

~/libuhttpd$ mkdir build
~/libuhttpd$ cd build

Configure

See which configuration are supported

~/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)

~/libuhttpd/build$ cmake ..

Disable SSl support

~/libuhttpd/build$ cmake .. -DUHTTP_DISABLE_SSL=1

Explicit use OpenSSL as its SSL backend

~/libuhttpd/build$ cmake .. -DUHTTP_USE_OPENSSL=1

Explicit use CyaSSl(wolfssl) as its SSL backend

~/libuhttpd/build$ cmake .. -DUHTTP_USE_CYASSL=1

Turn on debug

~/libuhttpd/build$ cmake .. -DUHTTP_DEBUG=1

Build and install libuhttpd

~/libuhttpd/build$ make && sudo make install

Run the Example

First generate the SSL certificate file

~/libuhttpd/build$ cd ..
~/libuhttpd$ ./gen_cert.sh

Run

~/libuhttpd$ ./build/example/helloworld

Then use the command curl or browser to test

$ curl -k 'https://127.0.0.1:8000/test?name=context%3d%7b"nid"%3a"test"%7d' -v

If use browser to test, it will be show

Hello World
Libuhttp v0.1
Url: /test?name=context%3d%7b%22nid%22%3a%22test%22%7d
Path: /test
Name: context%3d%7b%22nid%22%3a%22test%22%7d
Unescaped Name: context={"nid":"test"}
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

Contributing

If you would like to help making libuhttpd better, see the CONTRIBUTING.md file.

Thanks for the following project