nginx-dav-ext-module
nginx-dav-ext-module copied to clipboard
PROPFIND: Got 500 on stat() fail
I have some dir with simlink (ln -s) that points to non exist folder. nginx return to me 500 - internal server error then I try to read this dir:
Request:
PROPFIND /DataStore/ HTTP/1.1
Host: 172.16.0.254
Range: bytes=0-
User-Agent: Kodi/19.0-ALPHA1 (X11; FreeBSD amd64) App_Bitness/64 Version/19.0-ALPHA1-Git:20200217-nogitfound
Accept: */*
Accept-Encoding: deflate, gzip
Accept-Charset: UTF-8,*;q=0.8
Content-Type: text/xml; charset="utf-8"
depth: 1
Response:
HTTP/1.1 500 Internal Server Error
Server: nginx
Date: Thu, 12 Mar 2020 20:38:08 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 170
Connection: close
<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx</center>
</body>
</html>
Error log:
2020/03/12 23:55:30 [crit] 43059#100926: *8 stat() "/usr/DataStore/Family" failed (2: No such file or directory), client: 172.16.0.226, server: , request: "PROPFIND /DataStore/ HTTP/1.1",
host: "172.16.0.254"
2020/03/12 23:55:30 [crit] 43059#100926: *8 stat() "/usr/DataStore/tmp" failed (2: No such file or directory), client: 172.16.0.226, server: , request: "PROPFIND /DataStore/ HTTP/1.1", hos
t: "172.16.0.254"
IMHO at this point it was broken: https://github.com/arut/nginx-dav-ext-module/commit/732c02f9e9c08de8fd53f6fe1a4b51388a847a28#diff-4e53c5fe25cf9451fc3262464aa2813eR535
I do quick test:
@@ -896,10 +896,9 @@
ngx_cpystrn(last, name.data, name.len + 1);
if (ngx_de_info(filename, &dir) == NGX_FILE_ERROR) {
- ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno,
ngx_de_info_n " \"%s\" failed", filename);
- rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
- break;
+ continue;
}
}
this works for me.