From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 6F9B71F7C2; Thu, 5 Feb 2015 20:37:16 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Cc: Eric Wong Subject: [PATCH] fix compatibility with unicorn.git Date: Thu, 5 Feb 2015 20:37:12 +0000 Message-Id: <1423168632-22746-1-git-send-email-e@80x24.org> List-Id: Install workarounds for running with unreleased versions of unicorn for now, as unicorn 5.x will be dropping many needless features. --- lib/yahns.rb | 4 +++- lib/yahns/http_client.rb | 5 +++-- 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 -- EW