新增插件系统: - plugin.h / plugin.c:dlopen/dlsym 动态加载,最多8个插件 - 插件接口:cocoon_plugin_init / cocoon_plugin_shutdown / cocoon_plugin_version - 插件可通过 cocoon_middleware_register() 注册中间件参与请求处理 - 命令行:--plugin <path>(可多次指定) - 配置文件:plugins 字段(字符串,单插件路径) - server.c 在 server_create 时加载,server_destroy 时逆序卸载 - plugins/hello.c:示例插件,演示中间件注册 - 集成测试:新增插件加载 + 日志验证测试(68项全部通过) - 单元测试:127个全部通过 - 编译:Makefile 添加 plugin.c 和 -ldl - .gitignore 排除编译产物和上传目录
14 lines
289 B
JSON
14 lines
289 B
JSON
{
|
|
"root_dir": "./examples/www",
|
|
"port": 8080,
|
|
"threaded": true,
|
|
"num_workers": 4,
|
|
"max_connections": 10000,
|
|
"timeout_ms": 30000,
|
|
"log_level": "info",
|
|
"gzip_enabled": true,
|
|
"brotli_enabled": true,
|
|
"plugins": "plugins/hello.so",
|
|
"access_log": "-"
|
|
}
|