Permalink
Browse files

Make sure post keys/values are encoded separately

  • Loading branch information...
1 parent 0d8300f commit 4335c31777cc158704561444eefd9b9c52a97821 @mrallen1 mrallen1 committed Jun 25, 2013
Showing with 1 addition and 9 deletions.
  1. +1 −9 lib/LWP/Curl.pm
View
10 lib/LWP/Curl.pm
@@ -221,16 +221,8 @@ sub post {
#print STDERR Dumper $hash_form;
}
- my $post_string = "";
- foreach my $var ( keys %{$hash_form} ) {
- $post_string = $post_string . "$var=$hash_form->{$var}";
- $post_string = $post_string . "&";
-
- #print STDERR "var: $var - $hash_form->{$var}\n";
- }
-
$url = uri_escape($url,"[^:./]") if $self->{auto_encode};
- $post_string = uri_escape($post_string,"[^:./]") if $self->{auto_encode};
+ my $post_string = join '&', map {; uri_escape($_) . '=' . uri_escape($hash_form->{$_}) } keys %{ $hash_form };
$self->{agent}->setopt( CURLOPT_POSTFIELDS, $post_string );
$self->{agent}->setopt( CURLOPT_POST, 1 );

0 comments on commit 4335c31

Please sign in to comment.