From bb4e9db7e762a471861e481cdbd3bf31e756f3fb Mon Sep 17 00:00:00 2001 From: Devaev Maxim Date: Wed, 29 Jan 2020 20:20:53 +0300 Subject: [PATCH] fixed serving of empty static files --- src/http/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/http/server.c b/src/http/server.c index 4f78db9..9f291f4 100644 --- a/src/http/server.c +++ b/src/http/server.c @@ -326,7 +326,7 @@ static void _http_callback_static(struct evhttp_request *request, void *v_server goto not_found; } - if (evbuffer_add_file(buf, fd, 0, st.st_size) < 0) { + if (st.st_size > 0 && evbuffer_add_file(buf, fd, 0, st.st_size) < 0) { LOG_ERROR("HTTP: Can't serve static file %s", static_path); goto not_found; }