#31319 URL dispatcher does not handle multislashes

44 views
Skip to first unread message

Bjoern Boschman

unread,
Mar 4, 2020, 12:19:24 PM3/4/20
to Django developers (Contributions to Django itself)
Hi,

I'd like to start a discussion about how django handles multiple slashes.

So far I can confirm that nginx, apache and unix folders handle multiple slashes the same way (-> they get merged)
What's your (dev) opinion on this?

Cheers
B

TV Squared Limited is a company registered in Scotland.  Registered number: SC421072.  Registered office: CodeBase, Argyle House, 3 Lady Lawson Street, Edinburgh, EH3 9DR.
 
TV Squared Inc (File No. 5600204) is an Incorporated company registered in Delaware. Principal office: 1412 Broadway, 22 Fl, New York, New York, 10018

TV Squared GmbH is a company registered in Munich. Registered number: HRB 236077. Registered office: Oskar-von-Miller-Ring 20, c/o wework, 80333 Munchen

This message is private and confidential.  If you have received this message in error, please notify us and remove it from your system.

Adam Johnson

unread,
Mar 4, 2020, 2:27:19 PM3/4/20
to django-d...@googlegroups.com
I'd be against this

Merging multiple slashes is a way of duplicating canonical URL's for things, something Django actively tries to avoid with APPEND_SLASHES.

If you want this functionality you should be able to create it yourself with a custom URL converter or URLPattern subclass.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/0afe6cd9-952e-46a7-b756-10bb04eb70e9%40googlegroups.com.


--
Adam

Bjoern Boschman

unread,
Mar 4, 2020, 2:31:11 PM3/4/20
to Django developers (Contributions to Django itself)
Hi Adam,

APPEND_SLASH only adds a slash at the end of the path
I'm more concerned about having multiple slashes in the middle of the path
I get your point about canonical URLs - I'm just confused why other major HTTP servers are handling this different


On Wednesday, 4 March 2020 14:27:19 UTC-5, Adam Johnson wrote:
I'd be against this

Merging multiple slashes is a way of duplicating canonical URL's for things, something Django actively tries to avoid with APPEND_SLASHES.

If you want this functionality you should be able to create it yourself with a custom URL converter or URLPattern subclass.

On Wed, 4 Mar 2020 at 14:41, Bjoern Boschman <bjoern....@tvsquared.com> wrote:
Hi,

I'd like to start a discussion about how django handles multiple slashes.

So far I can confirm that nginx, apache and unix folders handle multiple slashes the same way (-> they get merged)
What's your (dev) opinion on this?

Cheers
B

TV Squared Limited is a company registered in Scotland.  Registered number: SC421072.  Registered office: CodeBase, Argyle House, 3 Lady Lawson Street, Edinburgh, EH3 9DR.
 
TV Squared Inc (File No. 5600204) is an Incorporated company registered in Delaware. Principal office: 1412 Broadway, 22 Fl, New York, New York, 10018

TV Squared GmbH is a company registered in Munich. Registered number: HRB 236077. Registered office: Oskar-von-Miller-Ring 20, c/o wework, 80333 Munchen

This message is private and confidential.  If you have received this message in error, please notify us and remove it from your system.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-d...@googlegroups.com.


--
Adam

Adam Johnson

unread,
Mar 4, 2020, 2:44:21 PM3/4/20
to django-d...@googlegroups.com

 Note that compression is essential for the correct matching of prefix string and regular expression locations. Without it, the “//scripts/one.php” request would not match

    location /scripts/ { ...

I think this much more of a concern with classic web servers that serve up files from your filesystem directly from the URL..

It also points to a reason why it would be backwards incompatible of Django to start doing this:

 Turning the compression off can become necessary if a URI contains base64-encoded names, since base64 uses the “/” character internally. However, for security considerations, it is better to avoid turning the compression off

To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/fce90055-ce46-4704-b81e-afc64bcde358%40googlegroups.com.


--
Adam
Reply all
Reply to author
Forward
0 new messages