代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/Tiny-httpd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
##Tinyhttpd A tiny http server with multi-port monitoring.
##目录结构
[src]
├── LICENSE #MIT许可证
├── README.md #使用说明
├── tinyhttpd.pro #工程文件
#主程序
├── main.cpp #启动多端口监听
├── serverthread.cpp #QThread子类线程,设置IP,port及启动Server
├── server.cpp #QTcpServer子类,多线程,每个线程对应一个port监听
├── request.cpp #接受client请求,多线程,每个线程对应一个请求
├── response.cpp #构造返回Request Headers
├── responsefile.cpp #返回网页
├── responsedictionary.cpp#列举url对应目录
├── mime.cpp #设定扩展应用
├── common.cpp #获取当前时间
├── log.cpp #日志系统
├── database.cpp #Redis数据库
├── monitorui.cpp #UI界面
├── starter.cpp #UI界面控制逻辑
├── ips.cpp #UI子界面控制逻辑
#配置
├── httpstatus.h #状态码
├── tinyhttpd.ini #服务器配置文件
├── tinyhttpd.log #服务器日志
├── mime.txt #mime配置
├── monitorui.ui #UI界面配置
├── ip.ui #UI子界面配置
[www] #网站根目录
├──static
├──index.html
[response] #网页返回状态网页
├── 301.html #301 Permanently Moved
├── 304.html #304 Not Modified
├── 403.html #403 Forbidden
└── 404.html #404 Not Found
[resource]
├── black.png #QT界面用到图片
├── blue.png
[assets]
├── database.png
├── monitor.png
└── ip.png
##Todo
##运行环境
##使用
git clone https://github.com/antirez/hiredis.git && cd hiredis
make
sudo make install
sudo ldconfig
[httpd]
port=1234|1235|1236 #配置服务器监听的多个端口,用|隔开
ipv6=true #配置ipv6支持
logfile=tinyhttpd.log
show_log=true
[site]
root_path=/home/huangyi/Practice/QT/tinyhttpd/www #网站根目录
dir_listing=true #是否允许获取文件树,否则返回403 forbidden
#index="index.html", "index.htm" #配置后,直接跳到网页index.html,不列出文件树
[request]
buffer_size=1048576 #为网页文件分配的内存空间
keep_alive_enable=true #是否打开长连接
keep_alive_default=true
keep_alive_timeout=30 #长连接timeout
keep_alive_timeout_max=300
/etc/redis.conf
daemonize yes
使Redis服务器运行在daemon模式
redis-server /etc/redis.conf
##界面
QT运行界面
QT显示来访数据
Redis存储数据
##原理
封装层次
Tinyhttpd
|
QTcpServer
|
QTcpSocket
多线程模型
fork ┌──Request A
┌──Server(Port)—————├──Request B
| └──Request C
fork |
ServerThread—————├──Server(Port)...
|
|
└──Server(Port)...
##说明
本repo参考
在项目基础上进行更改,感谢项目作者。
具体细节参见博客HTTP服务器实现。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。