Hacker News new | ask | show | jobs
by bazoom42 54 days ago
If different clients does it differently, you have incompatibilies. This punishes everybody. Since normalizing // to / removes information which may be significant, the obviously correct choice is folllowing the spec.
1 comments

if it is significant, you coded your app wrong, plain and simple
Of course not. It's an explicit feature part of every specification.

Plenty of websites rewrite paths like /a/b/c/d into a backend service call like /?w=a&x=b&y=c&z=d. In that scheme, /a//c/d would rewrite to /?w=a&x=&y=c&z=d, something entirely distinct from /a/c/d working out to /?w=a&x=b&y=c

It's not the application's fault that the people attempting to configure web server URLs don't know how web server URLs work.

A sane configuration, of course, would collapse the slashes first, so it would be /?w=a&x=c&y=d&z=.

See, it’s because when we do these acrobatics with turning path elements into query parameters, we do it for humans, so they are more readable. Humans can make typos, and accidentally entering two slashes instead of one is not exactly unheard of.

If we do it for some other code, we shouldn’t be rewriting anything at all, and just use query parameters.

Why?