Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 68515
Status: rejected
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: gelbman [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: The url method uses the wrong params to get the query string
Date: Fri, 27 May 2011 17:19:57 -0500
To: bug-CGI [...] rt.cpan.org
From: Jacob Gelbman <gelbman [...] gmail.com>
Download (untitled) / with headers
text/plain 599b
The url method is using the wrong params to get the query string. For example the following cgi script, returns (what should be) the url for itself: #!/usr/bin/env perl use CGI; my $q = CGI->new; print $q->header, $q->url(-query => 1); If I fetch the page like this $ curl http://localhost/urlprob.cgi?a=b It will respond with: http://localhost/urlprob.cgi?a=b But if I post something to the page: $ curl -d p=XXX http://localhost/urlprob.cgi?a=b It responds with: http://localhost/urlprob.cgi?p=XXX I think the url method should ALWAYS use the url params.
Subject: Re: [rt.cpan.org #68515] The url method uses the wrong params to get the query string
Date: Thu, 02 Jun 2011 10:36:09 -0400
To: bug-CGI [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Download (untitled) / with headers
text/plain 150b
Show quoted text
> I think the url method should ALWAYS use the url params.
How does your wish for how it works compare with how url() is documented to work? Mark
Download (untitled) / with headers
text/plain 1.8k
The url() method behaves in a way that is consistent with the following documented behavior: MIXING POST AND URL PARAMETERS $color = url_param('color'); It is possible for a script to receive CGI parameters in the URL as well as in the fill-out form by creating a form that POSTs to a URL containing a query string (a "?" mark followed by arguments). The param() method will always return the contents of the POSTed fill-out form, ignoring the URL's query string. To retrieve URL parameters, call the url_param() method. Use it in the same way as param(). The main difference is that it allows you to read the parameters, but not set them. Under no circumstances will the contents of the URL query string interfere with similarly-named CGI parameters in POSTed forms. If you try to mix a URL query string with a form submitted with the GET method, the results will not be what you expect. Unfortunately, changing how url() works now will probably break lots of existing scripts. If you want to get the query string verbatim, you can call CGI->query_string(). On Fri May 27 18:20:06 2011, iamjake wrote: Show quoted text
> The url method is using the wrong params to get the query string. For > example the following cgi script, returns (what should be) the url for > itself: > > #!/usr/bin/env perl > use CGI; > my $q = CGI->new; > print $q->header, $q->url(-query => 1); > > If I fetch the page like this > > $ curl http://localhost/urlprob.cgi?a=b > > It will respond with: > > http://localhost/urlprob.cgi?a=b > > But if I post something to the page: > > $ curl -d p=XXX http://localhost/urlprob.cgi?a=b > > It responds with: > > http://localhost/urlprob.cgi?p=XXX > > I think the url method should ALWAYS use the url params.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.