#23173: SCRIPT_URL on WSGI is misinterpreted when PATH_INFO is empty
-------------------------------------+-------------------------------------
     Reporter:  j-sz@…               |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (URLs)          |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  wsgi, script name,   |             Triage Stage:
  negative index slicing             |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by janek37):

 Replying to [comment:1 bmispelon]:
 > Isn't `path_info` guaranteed to be non-empty because of
 
https://github.com/django/django/blob/master/django/core/handlers/wsgi.py#L87-L92?

 No, it isn't. Look at it in context:
 
https://github.com/django/django/blob/master/django/core/handlers/wsgi.py#L233-L235.
 It reads PATH_INFO straight from the environment and it assumes an empty
 string if the variable is not set.

 >
 > Could you give us some details on what error you're seeing and how
 you're triggering it?
 >
 > Thanks.

 In my evironment the PATH_INFO variable is not set. I don't get any error
 message, I just get wrong urls when calling
 django.core.urlresolvers.reverse or {% url %} template tag. Eg. I have a
 WSGI server at /foobar/ and the resolve function returns '/some/url/'
 instead of '/foobar/some/url/'. Easy to see, when SCRIPT_URL variable is
 set to '/foobar/' and PAT_INFO is not set, get_script_name(environ) will
 return '' while it should return '/foobar/'. Just look at the code, it's
 obvious:
 
https://github.com/django/django/blob/master/django/core/handlers/wsgi.py#L229-L237

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23173#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.7e4e18b49944ac2b74498c2ab9e3266e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to