From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.142.140.7 with SMTP id n7cs42554wfd; Thu, 5 Nov 2009 14:34:44 -0800 (PST) Received-SPF: pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.220.89.212 as permitted sender) client-ip=10.220.89.212; Authentication-Results: mr.google.com; spf=pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 10.220.89.212 as permitted sender) smtp.mail=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com; dkim=pass header.i=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com Received: from mr.google.com ([10.220.89.212]) by 10.220.89.212 with SMTP id f20mr1964722vcm.24.1257460481469 (num_hops = 1); Thu, 05 Nov 2009 14:34:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :received:received:received:received-spf:received:received:received :from:to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; bh=emUd7TwWMHFsWl7hrQIYiy4f26Oo5PdTMZHgxY/KcwQ=; b=4y/ZfVGn1xPAtOmoSld2oUqowwJUqnV8JGpACXundqxRll+gKi3sLFr9dyEBWuwbt4 od69lTTvb+fFzS1xqxQ3+4oDMYqqU0G9DvyJY6KOeuhXhZxQ0MqHTb32PK14UJWcu/BS mQhUNMeQ7kmQcmKlRRsiDo5yiQ2RIaAdZa4H0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:received-spf:authentication-results:from :to:subject:date:user-agent:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id:reply-to:sender :precedence:x-google-loop:mailing-list:list-id:list-post:list-help :list-unsubscribe:x-beenthere-env:x-beenthere; b=ihhL6W18+jwnA4slgzpVraHIW/wJOt+tFudPDD+ki8xx6Nuqq8EkJkK8TAy4lK2J+H 3Vkdm99dx+pcufpZw7U5n+IprOLyVF88UFtyKAKosi6Gw24ZgoJdoyyiyQcn2TlU+JiH J+mIjJ6hgqGwG+ALvJPbu3bSaHBY2PfVGDewc= Received: by 10.220.89.212 with SMTP id f20mr159938vcm.24.1257460454218; Thu, 05 Nov 2009 14:34:14 -0800 (PST) Received: by 10.230.31.142 with SMTP id y14gr1716vbc.0; Thu, 05 Nov 2009 14:32:45 -0800 (PST) X-Sender: ibc@aliax.net X-Apparently-To: rack-devel@googlegroups.com Received: by 10.213.24.24 with SMTP id t24mr367829ebb.10.1257460363371; Thu, 05 Nov 2009 14:32:43 -0800 (PST) Received: by 10.213.24.24 with SMTP id t24mr367828ebb.10.1257460363352; Thu, 05 Nov 2009 14:32:43 -0800 (PST) Return-Path: Received: from mail-ew0-f221.google.com (mail-ew0-f221.google.com [209.85.219.221]) by gmr-mx.google.com with ESMTP id 13si2281355ewy.6.2009.11.05.14.32.43; Thu, 05 Nov 2009 14:32:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.219.221 is neither permitted nor denied by best guess record for domain of ibc@aliax.net) client-ip=209.85.219.221; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 209.85.219.221 is neither permitted nor denied by best guess record for domain of ibc@aliax.net) smtp.mail=ibc@aliax.net Received: by mail-ew0-f221.google.com with SMTP id 21so543418ewy.8 for ; Thu, 05 Nov 2009 14:32:43 -0800 (PST) Received: by 10.213.110.9 with SMTP id l9mr4077004ebp.14.1257460363103; Thu, 05 Nov 2009 14:32:43 -0800 (PST) Return-Path: Received: from ibc-laptop.localnet ([212.230.46.89]) by mx.google.com with ESMTPS id 5sm7517272eyh.2.2009.11.05.14.32.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 05 Nov 2009 14:32:42 -0800 (PST) From: =?iso-8859-1?q?I=F1aki_Baz_Castillo?= To: rack-devel@googlegroups.com Subject: Re: Using Rack Middlware to filter parameters Date: Thu, 5 Nov 2009 23:32:39 +0100 User-Agent: KMail/1.12.2 (Linux/2.6.28-15-generic; KDE/4.3.2; x86_64; ; ) References: <50c7f5da-ba10-4552-9e19-64cf8ede1211@k17g2000yqb.googlegroups.com> In-Reply-To: <50c7f5da-ba10-4552-9e19-64cf8ede1211@k17g2000yqb.googlegroups.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200911052332.39227.ibc@aliax.net> Reply-To: rack-devel@googlegroups.com Sender: rack-devel@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rack-devel@googlegroups.com; contact rack-devel+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rack-devel@googlegroups.com X-BeenThere: rack-devel@googlegroups.com El Jueves, 5 de Noviembre de 2009, RobL escribi=F3: > Hi there, >=20 > I wanted to ask if anyone could point me in the direction of some code > examples where you can use Rack Middleware to filter incoming > parameters. > But as a very tivial example I want be able to do something like >=20 > module Rack > class Myfilter > def initialize(app) > @app =3D app > end >=20 > def call(env) > request =3D Rack::Request.new(env) > request.params.delete('someparam') > # but at this point I want/need to modify env > @app.call(env) > end > end > end >=20 > I'm not sure how I'd then get the modified env back, do you have to > literally modify something like env['query_string'], also at this > point the content length would be different so I'd have to update that > also. Do you mean parameters in the request URI? or in the body? in the first cas= e=20 the content-length should not be modified. =20 > Most of the applications I've seen are an endpoint and an app in > itself than sitting in the middle of the incoming request, and I'm yet > to find an example of modifying the incoming params. I expect that Rack is not designed for that, as changing the request is not= a=20 very common usage (IMHO). =2D-=20 I=F1aki Baz Castillo