From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.140.141.15 with SMTP id o15cs1278375rvd; Mon, 4 Jan 2010 11:44:28 -0800 (PST) Received: from mr.google.com ([10.150.172.13]) by 10.150.172.13 with SMTP id u13mr7485992ybe.25.1262634266885 (num_hops = 1); Mon, 04 Jan 2010 11:44:26 -0800 (PST) Received: by 10.150.172.13 with SMTP id u13mr1133603ybe.25.1262634265491; Mon, 04 Jan 2010 11:44:25 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.231.121.76 with SMTP id g12ls61513ibr.2.p; Mon, 04 Jan 2010 11:44:22 -0800 (PST) Received: by 10.143.21.42 with SMTP id y42mr5081147wfi.21.1262634262381; Mon, 04 Jan 2010 11:44:22 -0800 (PST) Received: by 10.143.21.42 with SMTP id y42mr5081146wfi.21.1262634262363; Mon, 04 Jan 2010 11:44:22 -0800 (PST) Return-Path: Received: from mail-ew0-f227.google.com (mail-ew0-f227.google.com [209.85.219.227]) by gmr-mx.google.com with ESMTP id 23si6585550pxi.4.2010.01.04.11.44.21; Mon, 04 Jan 2010 11:44:22 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.227 is neither permitted nor denied by best guess record for domain of ibc@aliax.net) client-ip=209.85.219.227; Received: by mail-ew0-f227.google.com with SMTP id 27so3925438ewy.36 for ; Mon, 04 Jan 2010 11:44:21 -0800 (PST) Received: by 10.213.100.65 with SMTP id x1mr12007242ebn.67.1262634261174; Mon, 04 Jan 2010 11:44:21 -0800 (PST) Return-Path: Received: from ibc-laptop.localnet ([212.230.46.89]) by mx.google.com with ESMTPS id 13sm12803720ewy.9.2010.01.04.11.44.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 04 Jan 2010 11:44:18 -0800 (PST) From: =?iso-8859-1?q?I=F1aki_Baz_Castillo?= To: rack-devel@googlegroups.com Subject: Re: Why env.object_id is different in each middleware? Date: Mon, 4 Jan 2010 20:44:15 +0100 User-Agent: KMail/1.12.2 (Linux/2.6.28-16-generic; KDE/4.3.2; x86_64; ; ) References: <200912092359.08240.ibc@aliax.net> <200912100015.17445.ibc@aliax.net> In-Reply-To: MIME-Version: 1.0 Message-Id: <201001042044.15245.ibc@aliax.net> X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.219.227 is neither permitted nor denied by best guess record for domain of ibc@aliax.net) smtp.mail=ibc@aliax.net X-Original-Sender: ibc@aliax.net Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: X-Thread-Url: http://groups.google.com/group/rack-devel/t/5d93266373a372ea X-Message-Url: http://groups.google.com/group/rack-devel/msg/2d5b990b580863fe Sender: rack-devel@googlegroups.com List-Unsubscribe: , List-Subscribe: , Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable El Lunes, 4 de Enero de 2010, Tim Carey-Smith escribi=F3: > Is this patch useful? > Is it useful to assume that a request will only have a single env hash? > Will it make Rack::Cascade and friends behave incorrectly? >=20 > Should URLMap revert the change in an ensure to allow subsequent =20 > requests to function? A workaround is creating an initial middleware (like rack-config), adding s= ome=20 empty entries to env hash and latter, in other middlewares or final=20 application, using env["NEW_ENTRY"].replace. Of course this is a hack as it's only valid if the new entry is a String or= an=20 object supporting "replace". class Init def initialize(app) @app =3D app end def call(env) # Create env["REMOTE_USER"] so it can be latter replaced # (String#replaced) by the main application and Clogger will log it. env["REMOTE_USER"] =3D "" @app.call(env) end end And in config.ru: --------------------------------- use Init use ::Clogger, xxxxx run MyApp.new --------------------------------- Then in case env["REMOTE_USER"] is set into MyApp it should be set as follo= ws: class MyApp def call(env) ...getting username string... env["REMOTE_USER"].replace(username) ... end end Would be any performance penalty in using env.merge! like you suggest rathe= r=20 than env.merge? Regards. =2D-=20 I=F1aki Baz Castillo