about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-12-15 05:23:37 +0000
committerEric Wong <e@80x24.org>2014-12-15 05:26:36 +0000
commitcf171301f3f8bc030825db7107151f06db9a00d5 (patch)
tree8cde05a9b937c976acc46b07cb18c43671c48c54 /lib
parent71aea810c6e15ba8af662698adbcb28be7e2c395 (diff)
downloadyahns-cf171301f3f8bc030825db7107151f06db9a00d5.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/wbuf_common.rb3
1 files changed, 3 insertions, 0 deletions
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)