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 995CD200C6; Wed, 8 Apr 2015 17:32:48 +0000 (UTC) Date: Wed, 8 Apr 2015 17:32:48 +0000 From: Eric Wong To: "Lin Jen-Shin (godfat)" Cc: yahns-public@yhbt.net Subject: Re: [RFC] proxy_pass: possibly avoid breaking some middlewares Message-ID: <20150408173248.GA30602@dcvr.yhbt.net> References: <20150407213431.GA20108@dcvr.yhbt.net> <20150408170328.GA10903@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: "Lin Jen-Shin (godfat)" wrote: > On Thu, Apr 9, 2015 at 1:03 AM, Eric Wong wrote: > > "Lin Jen-Shin (godfat)" wrote: > >> On Wed, Apr 8, 2015 at 5:34 AM, Eric Wong wrote: > >> > + # this probably breaks fewer middlewares than returning whatever else... > >> > + [ 500, [], [] ] > >> > >> You probably meant [ 500, {}, [] ] here? > > > > No, arrays work fine, Rack headers just need to respond to #each > > with key + value strings. > > I didn't know this, and just looked at the spec. Indeed it's only > claiming this. However some middleware bundled with Rack > would try to call [ ] method with a string, in those cases, > this would probably give a type error. Right, I've fixed some Rack bugs like that in the past, and already maintain a fair amount of Rack code which returns arrays. > I think the spec should probably also claim that it should respond to > [ ] and taking strings as keys. I consider that too much, and Rack 1.x is pretty much set in stone already. > > But I'm also likely to revert this patch since it's no longer a drop-in > > replacement and the old, synchronous ProxyPass is reinstated. > > After playing a bit with hijack myself, I started to wonder if hijacking > is really a good idea, exactly the reason that it would probably break > a lot of middleware... It's totally hackish, but acceptable in the absence of any other standards. It's still nice to be able to intercept requests (for rewrites/redirects/etc) in middleware or use Rack::Cascade to handle some requests directly in Rack while only hijacking only a few. I'll write up some documentation for Yahns::ProxyPass soon.