Re: Bug report: using HTTP::Request::Common to send a POST reques t to a CGI.pm-based script
Gisle Aas (gisle@aas.no)
24 Jun 1999 12:35:41 +0200
"Schwartz, Todd" <todd.schwartz@intel.com> writes:
> Also, section 3.4. specifically addresses query components:
>
> Within a query component, the characters ";", "/", "?", ":", "@",
> "&", "=", "+", ",", and "$" are reserved.
This quote did it for me. I am now uploading URI-1.03 which the
following change.
Regads,
Gisle
Index: URI/_query.pm
===================================================================
RCS file: /home/cvs/aas/perl/mods/uri/URI/_query.pm,v
retrieving revision 4.2
retrieving revision 4.3
diff -u -u -r4.2 -r4.3
--- _query.pm 1998/10/12 09:31:06 4.2
+++ _query.pm 1999/06/24 10:27:42 4.3
@@ -30,11 +30,11 @@
my @query;
while (my($key,$vals) = splice(@_, 0, 2)) {
$key = '' unless defined $key;
- $key =~ s/([=&%+])/$URI::Escape::escapes{$1}/g;
+ $key =~ s/([;\/?:@&=+,\$%])/$URI::Escape::escapes{$1}/g;
$vals = [ref($vals) ? @$vals : $vals];
for my $val (@$vals) {
$val = '' unless defined $val;
- $val =~ s/([=&%+])/$URI::Escape::escapes{$1}/g;
+ $val =~ s/([;\/?:@&=+,\$%])/$URI::Escape::escapes{$1}/g;
push(@query, "$key=$val");
}
}
@@ -52,13 +52,9 @@
my $old = $self->query;
if (@_) {
# Try to set query string
- my $k;
- $self->query(join('+', map { $k = $_;
- $k =~ s/%/%25/g;
- $k =~ s/=/%3D/g;
- $k =~ s/\+/%2B/g;
- $k }
- @_));
+ my @copy = @_;
+ for (@copy) { s/([;\/?:@&=+,\$%])/$URI::Escape::escapes{$1}/g; }
+ $self->query(join('+', @copy));
}
return if !defined($old) || !defined(wantarray);
return if $old =~ /=/; # not keywords, but a form