in reply to GET variables overwriting POST variables
In order to make param processing DWIM, CGI stores GET and/or POST params into the same internal variable. Here's the relevant bits from CGI:
# If method is GET or HEAD, fetch the query from # the environment. if ($meth=~/^(GET|HEAD)$/) { if ($MOD_PERL) { $query_string = $self->r->args; } else { $query_string = $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'}; $query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined $ENV{'REDIRECT_QUERY_STRING'}; } last METHOD; } if ($meth eq 'POST') { $self->read_from_client(\$query_string,$content_length,0) if $content_length > 0; # Some people want to have their cake and eat it too! # Uncomment this line to have the contents of the query # string # APPENDED to the POST data. # $query_string .= (length($query_string) ? '&' : '') . # $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'}; last METHOD; }
I've always loved that cake comment in CGI
|
|---|