From cf171301f3f8bc030825db7107151f06db9a00d5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 15 Dec 2014 05:23:37 +0000 Subject: wbuf_common: close body proxies on sendfile abort If we're streaming large files and sendfile fails (due to a client aborting the connection), we need to ensure middleware proxies are closed to ensure proper logging of a partial request. This affects users of the "clogger" gem serving static files. Unfortunately with clogger (or any Rack API-compliant middleware using "to_path"), we still cannot log the amount of bytes transferred for a static file. --- lib/yahns/wbuf_common.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb index 01e20bb..69fd00d 100644 --- a/lib/yahns/wbuf_common.rb +++ b/lib/yahns/wbuf_common.rb @@ -32,6 +32,9 @@ module Yahns::WbufCommon # :nodoc: "sf_offset=#@sf_offset sf_count=#@sf_count" end while @sf_count > 0 wbuf_close(client) + rescue + wbuf_close(client) + raise end def wbuf_close_common(client) -- cgit v1.2.3-24-ge0c7