A Perl web-application I have written uses both GET and POST data at the same time. This is because I have URLs like:

http://www.example.com/site-manager/page/45

which are Mod_rewritten (internal server side rewrite, not passed back to browser) to:

http://www.example.com/site-manager?action=page&id=45

with POST data sometimes being passed when a form is submitted updating that page etc.

So from the point of view of the browser, it's only sending POST data, but the server is passing on both GET and POST data.

I'm assuming that this is ok, surely the server just sees the GET data as part of the URL it's passing down the line?

I get data using CGI.pm and a little sub like this:

sub _get_param_by_preference {
        my ( $q, $param ) = @_;
        
        defined $q->param ( $param )
                ? $q->param ( $param )
                : $q->url_param ( $param )
        
}

so it goes for POST data first and fails-over to GET data.

Is this ok? It's not caused me any problems, but a forum post I read just now says that this is in violation of the RFCs and can have unreliable results. Is that only for the browser? That it shouldn't pass both GET and POST data? In which case I'm innocent but will avoid doing it any other way than the rewrite method I'm using. Or server-side too?

Should I think about revising my approach? And if so why?

Thanks in advance,
Nigel


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to