Opened 16 years ago

Closed 15 years ago

Last modified 11 years ago

#8490 closed (fixed)

path_info equals script_name on lighttpd using fastcgi under a subdirectory when accessed without a trailing '/'

Reported by: mtrichardson Owned by: nobody
Component: Core (Other) Version: dev
Severity: Keywords: path_info, script_name, lighttpd, fastcgi
Cc: richard.davies@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have a Django app running under lighttpd and fastcgi in a subdirectory. When accessed without a trailing '/', eg, example.com/carfactory instead of example.com/carfactory/, script_name is the same as path_info resulting in an attempt to resolve 'carfactory/carfactory' instead of '/'.

Simple patch attached that fixes this.

Attachments (4)

8490.diff (1.1 KB ) - added by mtrichardson 16 years ago.
Simple patch which tests to see if path_info equals script_name and, if so, set it to '/'
nginx.conf (1.1 KB ) - added by QingFeng 15 years ago.
nginx.conf
sina.conf (628 bytes ) - added by QingFeng 15 years ago.
Django project conf file
wsgi_r11339.diff (1.1 KB ) - added by QingFeng 15 years ago.

Download all attachments as: .zip

Change History (16)

by mtrichardson, 16 years ago

Attachment: 8490.diff added

Simple patch which tests to see if path_info equals script_name and, if so, set it to '/'

comment:1 by mtrichardson, 16 years ago

This is only relevant for flup 1.0.1 - flup 1.0 appears to handle this properly.

comment:2 by Malcolm Tredinnick, 16 years ago

milestone: 1.0
Triage Stage: UnreviewedAccepted

comment:3 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

Fixed in [8569].

comment:4 by Richard Davies <richard.davies@…>, 15 years ago

Cc: richard.davies@… added

comment:5 by QingFeng, 15 years ago

milestone: 1.01.2
Resolution: fixed
Status: closedreopened

http://code.djangoproject.com/ticket/8874

nginx + django Still have this problem

in reply to:  5 comment:6 by Karen Tracey, 15 years ago

milestone: 1.21.0
Resolution: fixed
Status: reopenedclosed

Replying to qingfeng:

http://code.djangoproject.com/ticket/8874

nginx + django Still have this problem

Why did you reopen this ticket if that other one (also open) already reports the issue? We only need one open ticket per problem. This one was fixed nearly a year ago. After that long, it is preferable to open a new ticket to track a new problem. Unless there is already an open ticket that covers the issue (#8874?), in which case it is not necessary to do anything unless you want to pitch in and help with fixing the open ticket.

comment:7 by QingFeng, 15 years ago

This patch is not good.

the code is good:

if not path_info:
    path_info = u'/'
if path_info == script_name:
    script_name = u''

by QingFeng, 15 years ago

Attachment: nginx.conf added

nginx.conf

by QingFeng, 15 years ago

Attachment: sina.conf added

Django project conf file

by QingFeng, 15 years ago

Attachment: wsgi_r11339.diff added

comment:8 by QingFeng, 15 years ago

milestone: 1.01.2
Resolution: fixed
Status: closedreopened

nginx+django project conf file:

http://code.djangoproject.com/attachment/ticket/8490/nginx.conf

http://code.djangoproject.com/attachment/ticket/8490/sina.conf

urls.py:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^hello/', 'demo.views.hello'),
)

demo/views.py

from django.http import HttpResponse

def hello(request):
    return HttpResponse("Hello")

Django 1.1 Test:

curl -I http://localhost/hello

Restuls:

HTTP/1.1 404 NOT FOUND
Server: nginx/0.7.62
Date: Wed, 16 Sep 2009 09:23:29 GMT
Content-Type: text/html
Connection: keep-alive

use new patch:

http://code.djangoproject.com/attachment/ticket/8490/wsgi_r11339.diff

curl -I http://localhost/hello

Results:

HTTP/1.1 200 OK
Server: nginx/0.7.62
Date: Wed, 16 Sep 2009 10:27:11 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Cookie

in reply to:  8 ; comment:9 by Karen Tracey, 15 years ago

milestone: 1.21.0
Resolution: fixed
Status: reopenedclosed

Please stop reopening this ticket to report problems with nginx. This ticket reported a problem that was fixed before 1.0. That fix may have caused a different problem, reported in #8874. #8874 is the correct place to track fixing the follow-on problem, not here.

in reply to:  9 comment:10 by QingFeng, 15 years ago

Replying to kmtracey:

Please stop reopening this ticket to report problems with nginx. This ticket reported a problem that was fixed before 1.0. That fix may have caused a different problem, reported in #8874. #8874 is the correct place to track fixing the follow-on problem, not here.

sorry,i see.

comment:11 by Jacob, 12 years ago

milestone: 1.0

Milestone 1.0 deleted

comment:12 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In f5dbb566ee07bf3328015c70574b832052b4ebb7:

Fixed #17550 -- Removed a workaround for a bug in flup 1.0.1.

This reverts commit 948a833eb7fd9be0bc2d585c92a407f036ef42b2.

flup appears to be dead, and this fix breaks legitimate uses of Django.

Refs #8490.

Note: See TracTickets for help on using tickets.
Back to Top