* [Muffin Cake] parse_query / normalize_params issues
@ 2010-03-18 22:44 Christian Neukirchen
2010-03-19 21:13 ` Simon Chiang
2010-04-29 22:08 ` [Muffin Cake] " Ryan Tomayko
0 siblings, 2 replies; 3+ messages in thread
From: Christian Neukirchen @ 2010-03-18 22:44 UTC (permalink / raw)
To: Rack Development
Date: Thu, 18 Mar 2010 15:32:19 -0700 (PDT)
From: Muffin Cake <cakemuffin10@yahoo.com>
Subject: parse_query / normalize_params issues
To: chneukirchen@gmail.com
Hey,
Rack is great.
I found a small issue, that took me quite a while to uncover though:
In parse_query and normalize_params there is a special case when a param starts and ends with " or '. And it removes them. What is the reasoning behind this?
app?q="a" --> {"q"=>"a"} instead of {"q"=>"\"a\""}
eg. compare to google, searching for "funny quotes"
There is even a test case for this behaviour, which I found oddly surprising.
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: parse_query / normalize_params issues
2010-03-18 22:44 [Muffin Cake] parse_query / normalize_params issues Christian Neukirchen
@ 2010-03-19 21:13 ` Simon Chiang
2010-04-29 22:08 ` [Muffin Cake] " Ryan Tomayko
1 sibling, 0 replies; 3+ messages in thread
From: Simon Chiang @ 2010-03-19 21:13 UTC (permalink / raw)
To: Rack Development
See also http://groups.google.com/group/rack-devel/browse_thread/thread/f81f79e633b9e086
-- same question.
On Mar 18, 4:44 pm, Christian Neukirchen <chneukirc...@gmail.com>
wrote:
> Date: Thu, 18 Mar 2010 15:32:19 -0700 (PDT)
> From: Muffin Cake <cakemuffi...@yahoo.com>
> Subject: parse_query / normalize_params issues
> To: chneukirc...@gmail.com
>
> Hey,
>
> Rack is great.
>
> I found a small issue, that took me quite a while to uncover though:
>
> In parse_query and normalize_params there is a special case when a param starts and ends with " or '. And it removes them. What is the reasoning behind this?
>
> app?q="a" --> {"q"=>"a"} instead of {"q"=>"\"a\""}
>
> eg. compare to google, searching for "funny quotes"
>
> There is even a test case for this behaviour, which I found oddly surprising.
>
> Thanks!
To unsubscribe from this group, send email to rack-devel+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Muffin Cake] parse_query / normalize_params issues
2010-03-18 22:44 [Muffin Cake] parse_query / normalize_params issues Christian Neukirchen
2010-03-19 21:13 ` Simon Chiang
@ 2010-04-29 22:08 ` Ryan Tomayko
1 sibling, 0 replies; 3+ messages in thread
From: Ryan Tomayko @ 2010-04-29 22:08 UTC (permalink / raw)
To: rack-devel
On Thu, Mar 18, 2010 at 3:44 PM, Christian Neukirchen
<chneukirchen@gmail.com> wrote:
> Date: Thu, 18 Mar 2010 15:32:19 -0700 (PDT)
> From: Muffin Cake <cakemuffin10@yahoo.com>
> Subject: parse_query / normalize_params issues
> To: chneukirchen@gmail.com
>
> Hey,
>
> Rack is great.
>
> I found a small issue, that took me quite a while to uncover though:
>
> In parse_query and normalize_params there is a special case when a param starts and ends with " or '. And it removes them. What is the reasoning behind this?
>
> app?q="a" --> {"q"=>"a"} instead of {"q"=>"\"a\""}
>
> eg. compare to google, searching for "funny quotes"
>
> There is even a test case for this behaviour, which I found oddly surprising.
>
> Thanks!
I've committed a failing test from Job Bardin for this. This is
certainly a bug, yes? I can't imagine a reason Rack would be dequoting
here. Patch follows.
Thanks,
Ryan
From e5396b20d6e89bd19730bb9fa5ce90c3d0286857 Mon Sep 17 00:00:00 2001
From: Jon Bardin <jon@jbardin.local>
Date: Wed, 28 Apr 2010 17:43:55 -0700
Subject: [PATCH] added test for bug with escaping query string parameters
---
test/spec_rack_request.rb | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/test/spec_rack_request.rb b/test/spec_rack_request.rb
index fcdeb48..43a4b87 100644
--- a/test/spec_rack_request.rb
+++ b/test/spec_rack_request.rb
@@ -1,5 +1,6 @@
require 'test/spec'
require 'stringio'
+require 'cgi'
require 'rack/request'
require 'rack/mock'
@@ -542,4 +543,16 @@ EOF
req2.GET.should.equal "foo" => "bar"
req2.params.should.equal "foo" => "bar"
end
+
+ (0x20...0x7E).collect { |a|
+ b = a.chr
+ c = CGI.escape(b)
+ specify "should not strip '#{a}' => '#{c}' => '#{b}' escaped
character from parameters when accessed as string" do
+ url = "/?foo=#{c}bar#{c}"
+ env = Rack::MockRequest.env_for(url)
+ req2 = Rack::Request.new(env)
+ req2.GET.should.equal "foo" => "#{b}bar#{b}"
+ req2.params.should.equal "foo" => "#{b}bar#{b}"
+ end
+ }
end
--
1.7.0.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-29 22:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-18 22:44 [Muffin Cake] parse_query / normalize_params issues Christian Neukirchen
2010-03-19 21:13 ` Simon Chiang
2010-04-29 22:08 ` [Muffin Cake] " Ryan Tomayko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).