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,AWL,BAYES_00, URIBL_BLOCKED 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 BF5BB200CA; Tue, 7 Apr 2015 21:34:31 +0000 (UTC) Date: Tue, 7 Apr 2015 21:34:31 +0000 From: Eric Wong To: yahns-public@yhbt.net Subject: [RFC] proxy_pass: possibly avoid breaking some middlewares Message-ID: <20150407213431.GA20108@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: Running this on http://yhbt.net/yahns-public/ for now. I originally I forgot to disable one of my throwaway middlewares which was not aware of Rack hijacking. From: Eric Wong Subject: [PATCH] proxy_pass: possibly avoid breaking some middlewares hijack seems incompatible with many middlewares, so return a wonky response tuplet just in case... --- lib/yahns/proxy_pass.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/yahns/proxy_pass.rb b/lib/yahns/proxy_pass.rb index e3ba7f0..48a61af 100644 --- a/lib/yahns/proxy_pass.rb +++ b/lib/yahns/proxy_pass.rb @@ -235,6 +235,9 @@ class Yahns::ProxyPass # :nodoc: # finally, prepare to emit the headers rr.req_start(c, req << "\r\n".freeze, input, chunked) + + # this probably breaks fewer middlewares than returning whatever else... + [ 500, [], [] ] rescue => e Yahns::Log.exception(env['rack.logger'], 'proxy_pass', e) [ 502, [ %w(Content-Length 0), %w(Content-Type text/plain) ], [] ] -- EW