rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / code / Atom feed
* Why is there quote parsing on queries?
@ 2010-01-28 18:20 Simon Chiang
  2010-01-29 12:45 ` Iñaki Baz Castillo
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Chiang @ 2010-01-28 18:20 UTC (permalink / raw)
  To: Rack Development

Rack currently parses out quoted values such that you get this:

  foo='bar'   # => {"foo" => "bar"}

Rather than this:

  foo='bar'   # => {"foo" => "'bar'"}

I came across this when I was trying to send multiple quoted values
through a text field such that:

  Text Field           Encoded String                  String After
Parsing
  "'a' 'b'"                %27a%27+%27b%27        "a' 'b"
  " 'a' 'b' "              +%27a%27+%27b%27+    " 'a' 'b' "

It seems confusing because when a user adds spaces, the quotes are
suddenly preserved.  Obviously a user could work around this by
quoting the whole thing (ie "\"'a' 'b'\"") but I just wanted to know
if this is part of the URL specification someplace, or is quote
parsing a convention introduced by rack?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Why is there quote parsing on queries?
  2010-01-28 18:20 Why is there quote parsing on queries? Simon Chiang
@ 2010-01-29 12:45 ` Iñaki Baz Castillo
  0 siblings, 0 replies; 2+ messages in thread
From: Iñaki Baz Castillo @ 2010-01-29 12:45 UTC (permalink / raw)
  To: rack-devel

2010/1/28 Simon Chiang <simon.a.chiang@gmail.com>:
> Rack currently parses out quoted values such that you get this:
>
>  foo='bar'   # => {"foo" => "bar"}
>
> Rather than this:
>
>  foo='bar'   # => {"foo" => "'bar'"}
>
> I came across this when I was trying to send multiple quoted values
> through a text field such that:
>
>  Text Field           Encoded String                  String After
> Parsing
>  "'a' 'b'"                %27a%27+%27b%27        "a' 'b"
>  " 'a' 'b' "              +%27a%27+%27b%27+    " 'a' 'b' "

IMHO this is a bug in Rack.
Usually parameters can contain a non double quoted string value or a
double quoted string value (or no value).
In case the parameter value contains single quote (') it should be
treated as any other char into a string and shouldn't be stripped out.


-- 
Iñaki Baz Castillo
<ibc@aliax.net>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-29 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-28 18:20 Why is there quote parsing on queries? Simon Chiang
2010-01-29 12:45 ` Iñaki Baz Castillo

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/rack.git

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).