Skip to content
Browse files

Revert "Make query_form() encoded "\n" as "%0D%0A" for HTML/4.01 comp…

…liance"

Not so sure any more that this was a good idea, so I'm reverting it
for now [RT#75592]

This reverts commit dd80e79.
  • Loading branch information...
1 parent f94f982 commit a79d2760c1d613ae736267046de722fb11326838 @gisle gisle committed Mar 25, 2012
Showing with 2 additions and 10 deletions.
  1. +1 −2 URI/_query.pm
  2. +1 −8 t/query.t
View
3 URI/_query.pm
@@ -48,7 +48,6 @@ sub query_form {
$vals = [ref($vals) eq "ARRAY" ? @$vals : $vals];
for my $val (@$vals) {
$val = '' unless defined $val;
- $val =~ s/(?<!\r)\n/\r\n/g;
$val =~ s/([;\/?:@&=+,\$\[\]%])/ URI::Escape::escape_char($1)/eg;
$val =~ s/ /+/g;
push(@query, "$key=$val");
@@ -67,7 +66,7 @@ sub query_form {
}
return if !defined($old) || !length($old) || !defined(wantarray);
return unless $old =~ /=/; # not a form
- map { s/\+/ /g; $_ = uri_unescape($_); s/\r\n/\n/g; $_ }
+ map { s/\+/ /g; uri_unescape($_) }
map { /=/ ? split(/=/, $_, 2) : ($_ => '')} split(/[&;]/, $old);
}
View
9 t/query.t
@@ -1,7 +1,7 @@
#!perl -w
use strict;
-use Test::More tests => 26;
+use Test::More tests => 23;
use URI ();
my $u = URI->new("", "http");
@@ -79,10 +79,3 @@ $u->query_form([]);
$u->query_form(a => 1, b => 2);
}
is $u, "?a=1;b=2";
-
-$u->query_form(a => "foo\nbar\n", b => "foo\rbar\nbaz\r\n");
-is $u, "?a=foo%0D%0Abar%0D%0A;b=foo%0Dbar%0D%0Abaz%0D%0A";
-
-my %h = $u->query_form;
-is $h{a}, "foo\nbar\n";
-is $h{b}, "foo\rbar\nbaz\n";

0 comments on commit a79d276

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