[Catalyst] Re: Catalyst::Example::InstantCRUD RFC

Bill Moseley moseley at hank.org
Sat Jan 21 16:27:04 CET 2006


On Sat, Jan 21, 2006 at 11:21:32AM +0000, Alex Kavanagh wrote:
> I might rewrite it the other way:
> 
> my $status = ($c->request->protocol eq 'HTTP/1.0') ? 302 : 303;
> 
> This way only 1.0 clients get 302 and everybody later 1.1 (and
> futures?) would get 303 assuming forwards compatibility.  But maybe
> that's a bad assumption.


What about something like:

sub post_redirect {
    my ( $c, $location ) = @_;
    my ($version) = $c->request->protocol =~ m/(\d+\.\d+)/;
    $c->res->redirect(
        $location,
        ($version && $version > 1.0 ? 303 : 302),
    );
}

-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list