rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* BUG: quote escaping destroys text (with spec patch)
@ 2010-06-06 11:11 Andreas S.
  2010-06-07 14:45 ` Simon Chiang
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas S. @ 2010-06-06 11:11 UTC (permalink / raw)
  To: Rack Development

SPEC:

diff --git a/test/spec_rack_request.rb b/test/spec_rack_request.rb
index 43a4b87..cfda3a1 100644
--- a/test/spec_rack_request.rb
+++ b/test/spec_rack_request.rb
@@ -555,4 +555,12 @@ EOF
       req2.params.should.equal "foo" => "#{b}bar#{b}"
     end
   }
+
+  specify "should not remove text containing quotes" do
+    url = "/?foo=" + CGI.escape("bar\n\"baz\"")
+    env = Rack::MockRequest.env_for(url)
+    req = Rack::Request.new(env)
+    req.GET.should.equal "foo" => "bar\n\"baz\""
+    req.params.should.equal "foo" => "bar\n\"baz\""
+  end
 end


RESULT:
  3) Failure:
test_spec {Rack::Request} 129 [should not remove text containing
quotes](Rack::Request) [./test/spec_rack_request.rb:563]:
<{"foo"=>"bar\n\"baz\""}> expected but was
<{"foo"=>"baz"}>.

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

* Re: BUG: quote escaping destroys text (with spec patch)
  2010-06-06 11:11 BUG: quote escaping destroys text (with spec patch) Andreas S.
@ 2010-06-07 14:45 ` Simon Chiang
  2010-06-08  2:02   ` Michael Fellinger
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Chiang @ 2010-06-07 14:45 UTC (permalink / raw)
  To: Rack Development

This has tripped up numerous people.  See also:

* http://groups.google.com/group/rack-devel/browse_thread/thread/94b8116ecdef5ec5
* http://groups.google.com/group/rack-devel/browse_thread/thread/befbad49b6409b45
* http://groups.google.com/group/rack-devel/browse_thread/thread/f81f79e633b9e086
* http://github.com/rack/rack/issues#issue/16

A patch that removes quote parsing and fixes the specs (including the
one reported on this thread) is here:
http://github.com/bahuvrihi/rack/commit/ec6edf522d581336a8900e68bde46




On Jun 6, 5:11 am, "Andreas S." <use...@andreas-s.net> wrote:
> SPEC:
>
> diff --git a/test/spec_rack_request.rb b/test/spec_rack_request.rb
> index 43a4b87..cfda3a1 100644
> --- a/test/spec_rack_request.rb
> +++ b/test/spec_rack_request.rb
> @@ -555,4 +555,12 @@ EOF
>        req2.params.should.equal "foo" => "#{b}bar#{b}"
>      end
>    }
> +
> +  specify "should not remove text containing quotes" do
> +    url = "/?foo=" + CGI.escape("bar\n\"baz\"")
> +    env = Rack::MockRequest.env_for(url)
> +    req = Rack::Request.new(env)
> +    req.GET.should.equal "foo" => "bar\n\"baz\""
> +    req.params.should.equal "foo" => "bar\n\"baz\""
> +  end
>  end
>
> RESULT:
>   3) Failure:
> test_spec {Rack::Request} 129 [should not remove text containing
> quotes](Rack::Request) [./test/spec_rack_request.rb:563]:
> <{"foo"=>"bar\n\"baz\""}> expected but was
> <{"foo"=>"baz"}>.

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

* Re: BUG: quote escaping destroys text (with spec patch)
  2010-06-07 14:45 ` Simon Chiang
@ 2010-06-08  2:02   ` Michael Fellinger
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Fellinger @ 2010-06-08  2:02 UTC (permalink / raw)
  To: rack-devel

OK, I applied the patch from bahuvrihi, will update the bug trackers.

On Mon, Jun 7, 2010 at 11:45 PM, Simon Chiang <simon.a.chiang@gmail.com> wrote:
> This has tripped up numerous people.  See also:
>
> * http://groups.google.com/group/rack-devel/browse_thread/thread/94b8116ecdef5ec5
> * http://groups.google.com/group/rack-devel/browse_thread/thread/befbad49b6409b45
> * http://groups.google.com/group/rack-devel/browse_thread/thread/f81f79e633b9e086
> * http://github.com/rack/rack/issues#issue/16
>
> A patch that removes quote parsing and fixes the specs (including the
> one reported on this thread) is here:
> http://github.com/bahuvrihi/rack/commit/ec6edf522d581336a8900e68bde46
>
>
>
>
> On Jun 6, 5:11 am, "Andreas S." <use...@andreas-s.net> wrote:
>> SPEC:
>>
>> diff --git a/test/spec_rack_request.rb b/test/spec_rack_request.rb
>> index 43a4b87..cfda3a1 100644
>> --- a/test/spec_rack_request.rb
>> +++ b/test/spec_rack_request.rb
>> @@ -555,4 +555,12 @@ EOF
>>        req2.params.should.equal "foo" => "#{b}bar#{b}"
>>      end
>>    }
>> +
>> +  specify "should not remove text containing quotes" do
>> +    url = "/?foo=" + CGI.escape("bar\n\"baz\"")
>> +    env = Rack::MockRequest.env_for(url)
>> +    req = Rack::Request.new(env)
>> +    req.GET.should.equal "foo" => "bar\n\"baz\""
>> +    req.params.should.equal "foo" => "bar\n\"baz\""
>> +  end
>>  end
>>
>> RESULT:
>>   3) Failure:
>> test_spec {Rack::Request} 129 [should not remove text containing
>> quotes](Rack::Request) [./test/spec_rack_request.rb:563]:
>> <{"foo"=>"bar\n\"baz\""}> expected but was
>> <{"foo"=>"baz"}>.



-- 
Michael Fellinger
CTO, The Rubyists, LLC

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

end of thread, other threads:[~2010-06-08  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-06 11:11 BUG: quote escaping destroys text (with spec patch) Andreas S.
2010-06-07 14:45 ` Simon Chiang
2010-06-08  2:02   ` Michael Fellinger

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