17 Star 57 Fork 17

赵建辉 / libuhttpd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

libuhttpd

license PRs Welcome Issue Welcome Release Version Build Status

一个非常灵活的,轻量的,高性能的HTTP服务器C库,基于libevhttp-parser,主要用于嵌入式Linux。

特性

  • 轻量、高性能
  • 使用libev作为其事件后端
  • 支持HTTPS - OpenSSL, mbedtls 和 CyaSSl(wolfssl)
  • 支持 IPv6
  • 支持 CGI
  • 支持插件
  • 支持上传大文件
  • 支持 HTTP 范围请求
  • 支持多进程模型 - 和 Nginx 一样的多进程模型
  • 可伸缩 - 你可以非常方便的扩展你的应用程序,使之具备 HTTP/HTTPS 服务
  • 代码结构简洁通俗易懂,亦适合学习

依赖

  • libev - 一个全功能和高性能的事件循环库
  • http-parser - 一个用 C 语言编写的高性能的 HTTP 消息解析器
  • mbedtls - 如果你选择mbedtls作为你的SSL后端
  • wolfssl - 如果你选择wolfssl作为你的SSL后端
  • openssl - 如果你选择openssl作为你的SSL后端

基准测试

Nginx

$ wrk -t4 -c400 -d10s http://localhost:80/test.html
Running 10s test @ http://localhost:80/test.html
4 threads and 400 connections
Thread Stats   Avg      Stdev     Max   +/- Stdev
	Latency     3.54ms    7.32ms 224.58ms   93.30%
	Req/Sec    40.63k    12.49k   96.29k    74.50%
1622012 requests in 10.05s, 385.09MB read
Requests/sec: 161390.39
Transfer/sec:     38.32MB

libuhttpd

$ wrk -t4 -c400 -d10s http://localhost:8080/test.html
Running 10s test @ http://localhost:8080/test.html
4 threads and 400 connections
Thread Stats   Avg      Stdev     Max   +/- Stdev
	Latency     2.12ms    3.01ms  31.30ms   89.26%
	Req/Sec    70.87k    12.53k  142.54k    79.75%
2826394 requests in 10.05s, 547.18MB read
Requests/sec: 281328.83
Transfer/sec:     54.46MB

编译

~/libuhttpd/$ mkdir build && cd build
~/libuhttpd/build$ cmake ..
~/libuhttpd/build$ make

运行示例程序

运行

~/libuhttpd/build$ ./example/simple_server -v -a :8080

然后使用命令curl进行测试

$ curl 'http://127.0.0.1:8000/echo'

安装到OpenWRT

opkg update
opkg list | grep libuhttpd
opkg install libuhttpd-nossl

如果安装失败,你可以自己编译

示例程序

贡献代码

如果你想帮助libuhttpd变得更好,请参考 CONTRIBUTING_ZH.md

技术交流

QQ群:153530783

MIT License Copyright (c) 2019 Jianhui Zhao <zhaojh329@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个非常灵活的,轻量的,全异步的HTTP服务器C库,基于libev和http-parser 展开 收起
C 等 4 种语言
MIT
取消

发行版 (7)

全部

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/zhaojh329/libuhttpd.git
git@gitee.com:zhaojh329/libuhttpd.git
zhaojh329
libuhttpd
libuhttpd
master

搜索帮助