From 019c513819c829af038bdec93a7c4c0cb3f687b7 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 19 Oct 2020 23:31:02 -0400 Subject: [multiple] use http_chunk_append_file_ref() use http_chunk_append_file_ref() and http_chunk_append_file_ref_range() reduce resource usage (number of fds open) by reference counting open fds to files served, and sharing the fd among FILE_CHUNKs in responses --- src/mod_deflate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mod_deflate.c') diff --git a/src/mod_deflate.c b/src/mod_deflate.c index 68a6c253..7ef1af0b 100644 --- a/src/mod_deflate.c +++ b/src/mod_deflate.c @@ -1533,9 +1533,7 @@ REQUEST_FUNC(mod_deflate_handle_response_start) { stat_cache_entry *sce = stat_cache_get_entry_open(tb, 1); if (NULL != sce) { chunkqueue_reset(&r->write_queue); - int fd = sce->fd >= 0 ? fdevent_dup_cloexec(sce->fd) : -1; - if (fd < 0 - || 0 != http_chunk_append_file_fd(r, tb, fd, sce->st.st_size)) + if (sce->fd < 0 || 0 != http_chunk_append_file_ref(r, sce)) return HANDLER_ERROR; if (light_btst(r->resp_htags, HTTP_HEADER_CONTENT_LENGTH)) http_header_response_unset(r, HTTP_HEADER_CONTENT_LENGTH, -- cgit v1.2.1