Skip to content
Browse files

Adding +/CRLF to x-www-form-urlencoded per standards

  • Loading branch information...
1 parent 512c4fb commit 014cf3fe19c4f16e77f1291b4688ccaa9cb885b6 @SineSwiper SineSwiper committed Sep 29, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/HTTP/Request/Common.pm
View
8 lib/HTTP/Request/Common.pm
@@ -81,6 +81,14 @@ sub POST
my $url = URI->new('http:');
$url->query_form(ref($content) eq "HASH" ? %$content : @$content);
$content = $url->query;
+
+ # Technically, x-www-form-urlencoded should use plus signs
+ # and CR/LF, as it otherwise breaks HTML/4.01
+ $content =~ s/\%20/+/g;
+
+ $content =~ s/\%0D\%0A/\n/g;
+ $content =~ s/\%0D|\%0A/\n/g;
+ $content =~ s/\n/\%0D\%0A/g;
}
}

0 comments on commit 014cf3f

Please sign in to comment.
Something went wrong with that request. Please try again.