Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Dev

Catalyst::Request is missing a function for initial/previous URI

 

 

Catalyst dev RSS feed   Index | Next | Previous | View Threaded


markus.zimmermann at atikon

Jul 17, 2008, 6:25 AM

Post #1 of 6 (2218 views)
Permalink
Catalyst::Request is missing a function for initial/previous URI

When using a Catalyst action as ErrorDocument handler in Apache-mod_perl,
$c->req->uri does not give the URI the user typed in, but the one registered
as handler. This makes it impossible to for example use a 404 handler as
search shortcut.

The attached patch adds an "initial_uri" accessor to Catalyst::Request to give
access to that information. Please review and apply if everything's ok.

--
Markus Zimmermann
Attachments: Apache.diff (1.10 KB)
  Request.diff (0.64 KB)


bobtfish at bobtfish

Jul 17, 2008, 8:01 AM

Post #2 of 6 (2103 views)
Permalink
Re: Catalyst::Request is missing a function for initial/previous URI [In reply to]

On 17 Jul 2008, at 14:25, Markus Zimmermann wrote:

> When using a Catalyst action as ErrorDocument handler in Apache-
> mod_perl,
> $c->req->uri does not give the URI the user typed in, but the one
> registered
> as handler. This makes it impossible to for example use a 404
> handler as
> search shortcut.
>
> The attached patch adds an "initial_uri" accessor to
> Catalyst::Request to give
> access to that information. Please review and apply if everything's
> ok.

This looks reasonably sane to me, however:

1) There are no tests..
2) Shouldn't you do *something* with initial_uri in engines other
than Apache? Surely it should return something sane no matter what
engine you are using.. Otherwise you're not going to be able to
develop / test your application other than under Apache..

Cheers
t0m


_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


dbix-class at trout

Jul 19, 2008, 6:52 PM

Post #3 of 6 (2089 views)
Permalink
Re: Catalyst::Request is missing a function for initial/previous URI [In reply to]

On Thu, Jul 17, 2008 at 03:25:38PM +0200, Markus Zimmermann wrote:
> When using a Catalyst action as ErrorDocument handler in Apache-mod_perl,
> $c->req->uri does not give the URI the user typed in, but the one registered
> as handler. This makes it impossible to for example use a 404 handler as
> search shortcut.

What is the difference? Are you using a rewrite where a <Location> or
similar would have been better?

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


markus.zimmermann at atikon

Jul 28, 2008, 5:19 AM

Post #4 of 6 (2059 views)
Permalink
Re: Catalyst::Request is missing a function for initial/previous URI [In reply to]

Am Sonntag, 20. Juli 2008 03:52:38 schrieb Matt S Trout:
> On Thu, Jul 17, 2008 at 03:25:38PM +0200, Markus Zimmermann wrote:
> > When using a Catalyst action as ErrorDocument handler in Apache-mod_perl,
> > $c->req->uri does not give the URI the user typed in, but the one
> > registered as handler. This makes it impossible to for example use a 404
> > handler as search shortcut.
>
> What is the difference? Are you using a rewrite where a <Location> or
> similar would have been better?

We are using something like this:

<LocationMatch ^/my/project.+$>
   ErrorDocument 404 /my/project/search
</LocationMatch>

If you make a request for "http://my.server.domain.com/my/project/projectname"
the search function should use "projectname" as search string.

--
Markus Zimmermann

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


dbix-class at trout

Jul 28, 2008, 12:23 PM

Post #5 of 6 (2046 views)
Permalink
Re: Catalyst::Request is missing a function for initial/previous URI [In reply to]

On Mon, Jul 28, 2008 at 02:19:41PM +0200, Markus Zimmermann wrote:
> Am Sonntag, 20. Juli 2008 03:52:38 schrieb Matt S Trout:
> > On Thu, Jul 17, 2008 at 03:25:38PM +0200, Markus Zimmermann wrote:
> > > When using a Catalyst action as ErrorDocument handler in Apache-mod_perl,
> > > $c->req->uri does not give the URI the user typed in, but the one
> > > registered as handler. This makes it impossible to for example use a 404
> > > handler as search shortcut.
> >
> > What is the difference? Are you using a rewrite where a <Location> or
> > similar would have been better?
>
> We are using something like this:
>
> <LocationMatch ^/my/project.+$>
>    ErrorDocument 404 /my/project/search
> </LocationMatch>
>
> If you make a request for "http://my.server.domain.com/my/project/projectname"
> the search function should use "projectname" as search string.

Ok. So now I can see the need for the feature.

But obviously your patch can't be applied since it pollutes Catalyst::Request
with a mod_perl specific feature; if you can come up with a better API for
it and a patch with tests that only affects Catalys::Engine::Apache then
I'm sure andyg would be happy to review it and either apply or give feedback.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev


pagaltzis at gmx

Jul 28, 2008, 1:59 PM

Post #6 of 6 (2049 views)
Permalink
Re: Catalyst::Request is missing a function for initial/previous URI [In reply to]

* Markus Zimmermann <markus.zimmermann [at] atikon> [2008-07-17 15:25]:
> + if ($self->apache->prev) {
> + my $prev = $self->apache->prev;

As an aside, this is much more nicely written like this:

if (my $prev = $self->apache->prev) {

--
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
Catalyst-dev mailing list
Catalyst-dev [at] lists
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev

Catalyst dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.