jonswar / perl-mason

Mason 2
58 stars 20 forks source link

allow_path_info and single / #8

Open melo opened 12 years ago

melo commented 12 years ago

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

This URL does not match:

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

Thoughts?

jonswar commented 12 years ago

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 commented 12 years ago

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?

melo commented 12 years ago

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.

jonswar commented 12 years ago

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...

melo commented 12 years ago

Sure, that works too