From f6dd9694b43c2625f514e89856834a633b70f91b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 12 Feb 2016 00:55:46 +0000 Subject: properly emulate sendfile for OpenSSL sockets We cannot use the sendfile(2) syscall when serving static files to TLS clients without breaking them. We currently rely on OpenSSL to encrypt the data before it hits the socket, so it must be read into userspace buffers before being written to the socket. --- lib/yahns/sendfile_compat.rb | 4 ---- lib/yahns/wbuf_common.rb | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/yahns/sendfile_compat.rb b/lib/yahns/sendfile_compat.rb index cdd2d7b..8bd4622 100644 --- a/lib/yahns/sendfile_compat.rb +++ b/lib/yahns/sendfile_compat.rb @@ -22,7 +22,3 @@ module Yahns::SendfileCompat # :nodoc: end while true end end - -class IO # :nodoc: - include Yahns::SendfileCompat -end diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb index 21e9b3a..c51050b 100644 --- a/lib/yahns/wbuf_common.rb +++ b/lib/yahns/wbuf_common.rb @@ -7,6 +7,7 @@ begin require 'sendfile' rescue LoadError require_relative 'sendfile_compat' + IO.__send__ :include, Yahns::SendfileCompat end module Yahns::WbufCommon # :nodoc: -- cgit v1.2.3-24-ge0c7