Re: Setting a cookie and redirecting
| From: | Richard Lynch | Date: | Wed, 03 Jul 2002 03:52:02 +0000 |
| Subject: | Re: Setting a cookie and redirecting | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105125@lists.php.net to get a copy of this message | ||
>I don't agree with the general rule of thumb that the use of the
>"Location" header is bad, but I have reviewed plenty of code where
>people misuse it terribly, as a lazy goto-style operation. In most
>cases, you do want to design your application to:
>1) receive data
>2) analyze data
>3) respond with appropriate response
>
>If you instead do this:
>1) receive data
>2) analyze data
>3) respond with a "Location" header telling the Web client where to get
>the appropriate response
>4) receive the subsequent GET request
>5) respond with appropriate response
>
>then this is the type of misuse that runs rampant and makes people like
>Mr. Lynch have a distaste for its use.
Pretty much. I've wasted too much time trying to chase down the "paper
trail" of re-direct after re-direct from badly-designed applications.
Unfortunately, some very popular software packages (which shall remain
nameless) are rampant with this second "style" of coding.
>Like many things, it is all a matter of the developer. Personally, I
>like PHP's general approach of giving the developer the power to do
>anything, even if it is bad. *shrug* Most criticism I've heard of PHP
>(like the bogus security vulnerabilities cited in PHP) stems from this
>characteristic.
Hey, I like the flexibility.
I just wish more PHP scripters were better programmers so there was a better
quality of code out there, so PHP wouldn't be getting slagged for "security
vulnerabilities" that are the fault of the programmer, not PHP.
If you do a lot of Location: headers, re-think your design.
--
Like Music? http://l-i-e.com/artists.htm