about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-02-05 19:53:54 +0000
committerEric Wong <e@80x24.org>2015-02-05 19:53:54 +0000
commitb182bd7523a7dac186f1cb4f0bbca3a2649b451f (patch)
treec8774d1f7bd2f8662c6383f6f153fd856b2cda60 /lib
parent61149fd36bb1959bc2ae4ecb71c68fbda3c35c7a (diff)
downloadyahns-b182bd7523a7dac186f1cb4f0bbca3a2649b451f.tar.gz
Install workarounds for running with unreleased versions of unicorn
for now, as unicorn 5.x will be dropping many needless features.
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns.rb4
-rw-r--r--lib/yahns/http_client.rb5
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/yahns.rb b/lib/yahns.rb
index d48b34d..a55837f 100644
--- a/lib/yahns.rb
+++ b/lib/yahns.rb
@@ -10,7 +10,9 @@ require 'sleepy_penguin'
 # on unicorn at all
 [ :ClientShutdown, :Const, :SocketHelper, :StreamInput, :TeeInput,
   :SSLConfigurator, :Configurator, :TmpIO, :Util, :Worker, :SSLServer,
-  :HttpServer ].each { |sym| Unicorn.__send__(:remove_const, sym) }
+  :HttpServer ].each do |sym|
+    Unicorn.__send__(:remove_const, sym) if Unicorn.const_defined?(sym)
+end
 
 # yahns exposes no user-visible API outside of the config file
 # Internals are subject to change.
diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb
index a294511..15ee9d4 100644
--- a/lib/yahns/http_client.rb
+++ b/lib/yahns/http_client.rb
@@ -4,8 +4,9 @@
 class Yahns::HttpClient < Kgio::Socket # :nodoc:
   NULL_IO = StringIO.new("")
 
-  # FIXME: we shouldn't have this at all
-  Unicorn::HttpParser.keepalive_requests = 0xffffffff
+  # FIXME: we shouldn't have this at all when we go Unicorn 5-only
+  Unicorn::HttpParser.respond_to?(:keepalive_requests=) and
+    Unicorn::HttpParser.keepalive_requests = 0xffffffff
 
   include Yahns::HttpResponse
   QEV_FLAGS = Yahns::Queue::QEV_RD # used by acceptor