perl-mason icon indicating copy to clipboard operation
perl-mason copied to clipboard

allow_path_info and single /

Open melo opened this issue 12 years ago • 5 comments

If I have a component in the root of my site named foo with allow_path_info enabled, the following URLs match:

  • /foo: gives me an empty path info;
  • /foo/something: gives me something as path info.

This URL does not match:

  • /foo/

I think it should and path_info should be '/'.

Thoughts?

melo avatar May 04 '12 13:05 melo

Hey Pedro,

Just wanted to thank you for your Mason feedback and contributions, and apologize for the delay in responding to/adopting them. That is not the way I normally like to treat contributors...

I'm now finally unburying myself after a particularly busy season at work and working chronologically through my email backlog. Currently at January :), but moving forward.

Best Jon

jonswar avatar Jul 11 '12 10:07 jonswar

On May 4, 2012, at 6:01 AM, Pedro Melo wrote:

If I have a component in the root of my site named foo with allow_path_info enabled, the following URLs match:

  • /foo: gives me an empty path info;
  • /foo/something: gives me something as path info.

This URL does not match:

  • /foo/

I think it should and path_info should be '/'.

It should certainly match. Not sure about path_info, in particular not sure whether trailing slashes should be automatically cleaned up from path_info. Should Mason in general treat path /foo/bar/ the same as /foo/bar?

jonswar avatar Jul 11 '12 10:07 jonswar

Jonathan, no worries about the delays :)

Although I would personally choose to treat /foo/bar/ the same as /foo/bar, I also admit that it is because I'm biased to think in terms of mapping URLs to filesystems.

They are not the same URL, although years of automatic redirects by Apache and nginx from one to the other have trained us to think of them as the same.

I would keep path_info => '/' because it would allow each developer to decide if they are the same or not. Usually I like opinionated frameworks, but only if they let me choose my wrong way, if I really really need it.

melo avatar Jul 11 '12 10:07 melo

Hmmm. I think that ignoring trailing slashes is probably the vast common case, so I don't want to require more work for that case. Maybe it can ignore them by default but provide an option to expose them...

jonswar avatar Jul 11 '12 10:07 jonswar

Sure, that works too

melo avatar Jul 11 '12 10:07 melo