From b29523fc2a6961771031e850e34d0660c8794970 Mon Sep 17 00:00:00 2001 From: Onur ER Date: Mon, 16 Dec 2019 22:01:32 +0300 Subject: [PATCH 1/2] Added Array Handling Handle the repeated key query string https://github.com/rapid7/metasploit-framework/pull/12704#discussion_r357748834 --- lib/rex/proto/http/client_request.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/rex/proto/http/client_request.rb b/lib/rex/proto/http/client_request.rb index 492d3a6069..3bcfe29b1c 100644 --- a/lib/rex/proto/http/client_request.rb +++ b/lib/rex/proto/http/client_request.rb @@ -136,12 +136,16 @@ class ClientRequest opts['vars_post'].each_pair do |var,val| var = var.to_s - val = val.to_s - - pstr << '&' if pstr.length > 0 - pstr << (opts['encode_params'] ? set_encode_uri(var) : var) - pstr << '=' - pstr << (opts['encode_params'] ? set_encode_uri(val) : val) + unless val.is_a?(Array) + val = val.split + end + val.each do |v| + v = v.to_s + pstr << '&' if pstr.length > 0 + pstr << (opts['encode_params'] ? set_encode_uri(var) : var) + pstr << '=' + pstr << (opts['encode_params'] ? set_encode_uri(v) : v) + end end else if opts['encode'] From a45e4b6d37f66fe8a6da26e0a5c5911e2a938967 Mon Sep 17 00:00:00 2001 From: Onur ER Date: Thu, 19 Dec 2019 20:43:30 +0300 Subject: [PATCH 2/2] Update lib/rex/proto/http/client_request.rb Co-Authored-By: acammack-r7 --- lib/rex/proto/http/client_request.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rex/proto/http/client_request.rb b/lib/rex/proto/http/client_request.rb index 3bcfe29b1c..a00f6e390c 100644 --- a/lib/rex/proto/http/client_request.rb +++ b/lib/rex/proto/http/client_request.rb @@ -137,7 +137,7 @@ class ClientRequest opts['vars_post'].each_pair do |var,val| var = var.to_s unless val.is_a?(Array) - val = val.split + val = [val] end val.each do |v| v = v.to_s