diff options
author | Eric Wong <e@80x24.org> | 2014-12-16 22:54:55 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-12-20 04:10:22 +0000 |
commit | f8a260976417f14bb0de59ca3f6645813edb37b7 (patch) | |
tree | fc93f837dc5356e6cbbc32c13a84536659a4c72c | |
parent | 0270501f70ed74552a13f85ea0b85ce3389f84e8 (diff) | |
download | yahns-f8a260976417f14bb0de59ca3f6645813edb37b7.tar.gz |
Not everybody needs to serve or even buffer to regular files, so make sendfile optional to avoid the extra memory use and relocations.
-rw-r--r-- | lib/yahns/wbuf_common.rb | 7 | ||||
-rw-r--r-- | yahns.gemspec | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/yahns/wbuf_common.rb b/lib/yahns/wbuf_common.rb index 69fd00d..0ce4526 100644 --- a/lib/yahns/wbuf_common.rb +++ b/lib/yahns/wbuf_common.rb @@ -1,10 +1,11 @@ # -*- encoding: binary -*- # Copyright (C) 2009-2013, Eric Wong <normalperson@yhbt.net> et. al. # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) -if ENV["SENDFILE_BROKEN"] - require_relative 'sendfile_compat' -else +begin + raise LoadError, "SENDFILE_BROKEN env set" if ENV["SENDFILE_BROKEN"] require 'sendfile' +rescue LoadError + require_relative 'sendfile_compat' end module Yahns::WbufCommon # :nodoc: diff --git a/yahns.gemspec b/yahns.gemspec index db1d50e..120dc46 100644 --- a/yahns.gemspec +++ b/yahns.gemspec @@ -12,8 +12,8 @@ Gem::Specification.new do |s| s.files = manifest s.add_dependency(%q<kgio>, '~> 2.9') s.add_dependency(%q<sleepy_penguin>, '~> 3.2') - s.add_dependency(%q<kgio-sendfile>, '~> 1.2') s.add_dependency(%q<unicorn>, '~> 4.6', '>= 4.6.3') + # s.add_dependency(%q<kgio-sendfile>, '~> 1.2') # optional # minitest is standard in Ruby 2.0, 4.3 is packaged with Ruby 2.0.0, # 4.7.5 with 2.1. We work with minitest 5, too. 6.x does not exist |