libhv icon indicating copy to clipboard operation
libhv copied to clipboard

HTTP服务器静态映射403 Forbidden

Open OliveRuan opened this issue 4 weeks ago • 1 comments

root@nle-desktop:/usr/local/disk/record# curl -v http://127.0.0.1:18081/snapshot/34020000000001231452_34020000001180000221_0.jpg

  • Trying 127.0.0.1...
  • TCP_NODELAY set
  • Connected to 127.0.0.1 (127.0.0.1) port 18081 (#0)

GET /snapshot/34020000000001231452_34020000001180000221_0.jpg HTTP/1.1 Host: 127.0.0.1:18081 User-Agent: curl/7.58.0 Accept: /

< HTTP/1.1 403 Forbidden < Connection: keep-alive < Content-Length: 0 < Content-Type: image/jpeg < Date: Fri, 05 Dec 2025 10:39:18 GMT < Server: httpd/1.3.2 <

  • Connection #0 to host 127.0.0.1 left intact

使用的是http_server_t和hv::HttpService,监听了18081端口 文件存在,并不是404,文件权限也正常 使用的是hv::HttpService的void Static(const char* path, const char* dir);方法 请教一下有可能是什么原因导致的?

OliveRuan avatar Dec 05 '25 10:12 OliveRuan

是不是设置了HttpService::limit_rate=0导致?如果设置为0,会禁止下载大文件(默认超过4M就是大文件)

ithewei avatar Dec 09 '25 03:12 ithewei