cinatra
cinatra copied to clipboard
modern c++(c++20), cross-platform, header-only, easy to use http framework
测试用例:http://ip:port/Local/1 - 副本 (17).mp3 postman:  关键代码段:  原因: std::ifstream 对于utf8编码字符串文件路径,打开异常 处理方式: http请求参数默认utf8编码,使用file_system::u8path转码下  可用考虑处理下,谢谢!
今天就遇到#198 这个问题了。相关原因这个issues已经陈诉。 ``` void websocket_server::start() { server_.enable_timeout(false); server_.set_keep_alive_timeout(std::numeric_limits::max()); server_.listen(ip_, port_); std::string_view uri{"/usb_capture"}; server_.set_http_handler( uri, [this](cinatra::request& request, cinatra::response& response) { if (request.get_content_type() != cinatra::content_type::websocket) { LOG_WARN
```cpp void print(const cinatra::response_data& result) { print(result.ec, result.status, result.resp_body, result.resp_headers.second); } ``` 改为 ```cpp void my_print(const cinatra::response_data& result) { cinatra::print(result.ec, result.status, result.resp_body, result.resp_headers.second); } ``` 好一些,如果直接复制的话,会有个模板展开的报错,然后print不加上命名空间的话,也会有歧义。
请问如何同时监听多个端口?
 如图,正常情况下获取的文件后缀是不带_ing的。
cinatra好像会将上传的文件重命名,可是如果我想获取到它本身的名字应该怎么做呢?没有找到对应的接口。
代码中对于 multipart 文件数据都会存储到文件中。(该操作在解析http请求时进行,无论代码是否需要使用这个文件) https://github.com/qicosmos/cinatra/blob/df5654533ecd7929a29bf48a085ee20e54bf48d5/include/cinatra/connection.hpp#L843-L860 而默认配置 static_dir_ 为相对路径www,有可能能被直接访问。 建议能修改这个路径为 /tmp 或者其他临时路径中,由开发者进行处理。
我尝试请求一个返回302的网址,但是我得到的状态码总是200。 这是我的代码: ```cpp auto client = cinatra::client_factory::instance().new_client(); cinatra::response_data result2 = client->get("https://iw233.cn/api/Random.php"); std::cout
#由ca 生成证书 openssl genrsa -out server.key 1024 openssl req -new -subj /CN=thgy/O=thchain/OU=keyms -key server.key -out server.csr openssl genrsa -out ca.key 1024 openssl req -new -subj /CN=thgy/O=thchain/OU=keyms -key ca.key -out ca.csr...