Opened 19 years ago
Closed 17 years ago
#1291 closed defect (fixed)
Django built-in web-server does not handle double-slashes (//) properly, ends up in infinte loop
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | major | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Django built-in web-server does not handle double-slashes () properly, ends up in infinte loop
Attachments (1)
Change History (6)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
I am seeing this too.
urlpatterns = patterns('', (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/path/to/project/media'}), )
in my template I have something like:
<link rel="stylesheet" type="text/css" href="/site_media//css/site.css" />
which results in the log entry in the builtin django webserver log:
[01/Feb/2006 11:30:33] "GET /site_media//css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/css/site.css HTTP/1.0" 302 0
and the css file doesn't get loaded.
comment:3 by , 19 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I cannot replicate this on Linux.
comment:4 by , 17 years ago
Component: | django-admin.py → Generic views |
---|---|
Resolution: | worksforme |
Status: | closed → reopened |
Version: | → SVN |
I am able to reproduce the problem. It occurs if the double slash occurs at the start of the path that the regexp captures as the path parameter to the 'django.views.static.serve' function.
So in the example '/site_mediacss/site.css' causes the 'serve' function to respond with a redirection to 'css/site.css' which causes the browser to request '/site_mediacss/css/site.css' and so on... (firefox eventually gives up)
A request of '/site_mediasite.css' causes the 'serve' function to respond with a redirection to 'site.css' which causes the browser to request the same url again (firefox gives up)
So its seems to be a bug in the 'django.views.static.serve' function.
by , 17 years ago
Attachment: | static_serve_empty_path_compnent.diff added |
---|
test to illustrate problem and potential fix
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Can you give an example? Everything I've tried results in a 404, as expected.