Redirects // Re: [Catalyst] Re: forwarding to chained actions

John Napiorkowski jjn1056 at yahoo.com
Fri Apr 27 18:55:00 GMT 2007


----- Original Message ----
From: Michael Reece <mreece at vinq.com>
To: The elegant MVC web framework <catalyst at lists.rawmode.org>
Sent: Friday, April 27, 2007 12:27:29 PM
Subject: Re: Redirects // Re: [Catalyst] Re: forwarding to chained actions

it would be nice if $c->res->redirect returned a 303 appropriately if  
$c->req->method eq 'POST'.

i have in the past trapped it in 'end' to fix up the $c->res->status  
if == 302 and $c->req->method eq 'POST', but lately i just don't bother.

You should be able to set the http status code with ->redirect(302) if I'm reading the source code correctly.

--John

On Apr 27, 2007, at 6:03 AM, Simon Wilcox wrote:

> On Tue, 24 Apr 2007, A. Pagaltzis wrote:
>
>> _ALL_ POSTs should be followed by a redirect, ALWAYS.
>
> This is really good advice but I was looking at the response code RFC
> today [1] for an unrelated matter and found the following:
>
>   If the 302 status code is received in response to a request other  
> than
>   GET or HEAD, the user agent MUST NOT automatically redirect the  
> request
>   unless it can be confirmed by the user, since this might change the
>   conditions under which the request was issued.
>
> It then goes on to say:
>
>   Note: RFC 1945 and RFC 2068 specify that the client is not  
> allowed to
>   change the method on the redirected request.  However, most existing
>   user agent implementations treat 302 as if it were a 303 response,
>   performing a GET on the Location field-value regardless of the  
> original
>   request method. The status codes 303 and 307 have been added for  
> servers
>   that wish to make unambiguously clear which kind of reaction is  
> expected
>   of the client.
>
> So, what do people do - do you send 303/307's "correctly" or just  
> default
> to 302 behaviour ?
>
> Simon Wilcox
> [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
>
> -- 
> Digital Craftsmen Ltd
> Exmouth House, 3 Pine Street, London. EC1R 0JH
> t 020 7183 1410 f 020 7099 5140 m 07951 758698
> w http://www.digitalcraftsmen.net/
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/ 
> catalyst at lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/

---
michael reece :: software engineer :: mreece at vinq.com



_______________________________________________
List: Catalyst at lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Catalyst mailing list