From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,SPF_PASS,T_DKIM_INVALID shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 5466F1F89D for ; Tue, 25 Jul 2017 20:02:52 +0000 (UTC) Received: by mail-io0-x243.google.com with SMTP id m88so5188544iod.1 for ; Tue, 25 Jul 2017 13:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kpumuk.info; s=kpumuk; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=f9thejWX34jWxj2/z4MFOc08v4etxVL/wwpYYPramrQ=; b=KlC2ba9xOy5XpsXvDuS85yZfI0Tu4hhpdKsqxN/mtF88IYcdJ9SmFtaUvQ2j29vgW6 mtjeICsMHrY7adGCcNlLvnJimxfpGx+HpPdbmXg62eXtn/N7Uoqp+7Zygjc7/0mfC6yI 8K7U5U7ZArqNe1uOLLztcdT/xOrtHqStaS39M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=f9thejWX34jWxj2/z4MFOc08v4etxVL/wwpYYPramrQ=; b=Y+p2y5H8pP6KlaVaWXdgV/hosoIjeooH+3OkQQV6dwzh/kjoB24wl5Obzptt7lmzpY 4wmEv9zO13M195Cb1VsCV70zK5xEM2RzYfD+IfRni1ALmdlM/RhW1Eid9OVcDCGbRHWx zGKH99HZe8ezxOyCyWrSQ38cU1eL6Lq2/O1CElfSLpP6buK6s2yJDnM26Z7TGFfaF4Xy kl0a8eSawSgwnxm8VBEUWm3iq6Zd3VTtAhgspGw7UyUzNwUxmMsduByVWYjMEuMnT5gB QQhlOcKHY9bbwNqju76oM6qLZmvLaPkfXbFGfhKNwHk0t4AAheABLWi3dhXl5sTlAZ8r PK3g== X-Gm-Message-State: AIVw110/q3gjH+FFhCaiLZBLJSUrhs6/xhiUW4vaSpr12U6OLbhBBGPM vi2yHWvh43JNAk3jMjxTKQ== X-Received: by 10.107.199.70 with SMTP id x67mr19745993iof.113.1501012971217; Tue, 25 Jul 2017 13:02:51 -0700 (PDT) Received: from localhost.localdomain (CPE50465dcd1918-CMbc4dfba78b30.cpe.net.cable.rogers.com. [173.33.228.3]) by smtp.gmail.com with ESMTPSA id 16sm5508951itm.14.2017.07.25.13.02.49 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 25 Jul 2017 13:02:50 -0700 (PDT) From: Dmytro Shteflyuk To: raindrops-public@bogomips.org Cc: Dmytro Shteflyuk Subject: [PATCH] Properly override respond_to? in Raindrops::Middleware::Proxy Date: Tue, 25 Jul 2017 16:02:42 -0400 Message-Id: <20170725200242.54318-1-kpumuk@kpumuk.info> X-Mailer: git-send-email 2.13.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit List-Id: Correct method definition according to Ruby documentation (https://ruby-doc.org/core-2.4.1/Object.html#method-i-respond_to-3F) is: respond_to?(string, include_all=false) → true or false Rack started using second argument starting from version 2: https://github.com/rack/rack/blob/master/lib/rack/body_proxy.rb#L14 If raindrops is used in Rack 2+ applications, an exception is raised: ArgumentError: wrong number of arguments (2 for 1) /gems/raindrops-0.18.0/lib/raindrops/middleware/proxy.rb:30:in `respond_to?' /gems/rack-2.0.3/lib/rack/body_proxy.rb:14:in `respond_to?' --- lib/raindrops/middleware/proxy.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/raindrops/middleware/proxy.rb b/lib/raindrops/middleware/proxy.rb index 1cf437c..a7c8e66 100644 --- a/lib/raindrops/middleware/proxy.rb +++ b/lib/raindrops/middleware/proxy.rb @@ -27,9 +27,9 @@ def to_path # Rack servers use +respond_to?+ to check for the presence of +close+ # and +to_path+ methods. - def respond_to?(m) + def respond_to?(m, include_all = false) m = m.to_sym - :close == m || @body.respond_to?(m) + :close == m || @body.respond_to?(m, include_all) end # Avoid breaking users of non-standard extensions (e.g. #body) -- 2.13.2