From cba39a9a043f528e5c2e7cd6287fab740359fd8b Mon Sep 17 00:00:00 2001 From: Jeff Jarmoc Date: Mon, 12 May 2014 12:01:06 -0500 Subject: [PATCH] Adds spec for 'hex-all' mode --- spec/lib/rex/proto/http/client_request_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/lib/rex/proto/http/client_request_spec.rb b/spec/lib/rex/proto/http/client_request_spec.rb index f11b2b48e8..2fcd6e0271 100644 --- a/spec/lib/rex/proto/http/client_request_spec.rb +++ b/spec/lib/rex/proto/http/client_request_spec.rb @@ -189,6 +189,7 @@ describe Rex::Proto::Http::ClientRequest do 'foo[]' => 'bar', 'bar' => 'baz', 'frobnicate' => 'the froozle?', + 'foshizzle' => 'my/nizzle', } end @@ -215,6 +216,7 @@ describe Rex::Proto::Http::ClientRequest do str.should include("foo[]=bar") str.should include("bar=baz") str.should include("frobnicate=the froozle?") + str.should include("foshizzle=my/nizzle") end end @@ -226,6 +228,7 @@ describe Rex::Proto::Http::ClientRequest do str.should include("foo%5b%5d=bar") str.should include("bar=baz") str.should include("frobnicate=the%20froozle%3f") + str.should include("foshizzle=my/nizzle") end end @@ -236,6 +239,18 @@ describe Rex::Proto::Http::ClientRequest do str.should include("%66%6f%6f%5b%5d=%62%61%72") str.should include("%62%61%72=%62%61%7a") str.should include("%66%72%6f%62%6e%69%63%61%74%65=%74%68%65%20%66%72%6f%6f%7a%6c%65%3f") + str.should include("%66%6f%73%68%69%7a%7a%6c%65=%6d%79/%6e%69%7a%7a%6c%65") + end + end + + context "and 'uri_encode_mode' = hex-all" do + let(:encode_mode) { 'hex-all' } + it "should encode all chars" do + str = client_request.to_s + str.should include("%66%6f%6f%5b%5d%3d%62%61%72") + str.should include("%62%61%72%3d%62%61%7a") + str.should include("%66%72%6f%62%6e%69%63%61%74%65%3d%74%68%65%20%66%72%6f%6f%7a%6c%65%3f") + str.should include("%66%6f%73%68%69%7a%7a%6c%65%3d%6d%79%2f%6e%69%7a%7a%6c%65") end end