Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#14594 closed (fixed)

Django/CherryPy problem with POST data

Reported by: Mark Sundstrom Owned by: nobody
Component: HTTP handling Version: dev
Severity: Keywords:
Cc: Ivan Sagalaev Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Changeset [14394] causes a hang when reading POST data running Django trunk behind CherryPy 3.1.2 and Python 2.7.

See this thread on Django Developers:
<http://groups.google.com/group/django-developers/browse_thread/thread/6f803957fd4b4152>

Attachments (1)

14594.diff (724 bytes ) - added by Mark Sundstrom 13 years ago.
Patch to reverse the use of content_length applied in [14435]

Download all attachments as: .zip

Change History (7)

comment:1 by Mark Sundstrom, 13 years ago

Steps to reproduce Ticket #14594

I used a virtualenv running Python 2.7, but I don't think the Python version matters

# Install or make sure you are using Django trunk >= 14394
pip install CherryPy # 3.1.2
django-admin.py startproject newbug
cd newbug
python manage.py runserver # verify on port 8000 that "It works!"
# Edit urls.py to enable the admin
# Edit settings.py to enable the admin
# Edit settings.py to create a database.
# I used sqlite3 and specified a path
python manage.py syncdb # setup the database and create a superuser
# Verify that you can login, using the development server and your new superuser at
# localhost:8000/admin/
# Log out, stop the development server
python manage.py shell

import cherrypy
from django.core.handlers.wsgi import WSGIHandler
cherrypy.tree.graft( WSGIHandler(), script_name="")
cherrypy.quickstart() # this will start the CherryPy server on 8080

# The admin media will not be served, but this doesn't matter
# Go to localhost:8080/admin/
# Try to login with your superuser, or just click the login button with blank input
# Hangs

comment:2 by Russell Keith-Magee, 13 years ago

Resolution: fixed
Status: newclosed

(In [14435]) Fixed #14594 -- Corrected a problem introduced by r14394 whereby reading POST data when running a WSGI server under CherryPy would hang. Thanks to Mark Sundstrom for the report.

comment:3 by Mark Sundstrom, 13 years ago

Has patch: set
Resolution: fixed
Status: closedreopened

The fix in [14435] is exactly backwards -- content_length should be passed to read() when available, not the other way around.

by Mark Sundstrom, 13 years ago

Attachment: 14594.diff added

Patch to reverse the use of content_length applied in [14435]

comment:4 by Russell Keith-Magee, 13 years ago

Resolution: fixed
Status: reopenedclosed

(In [14436]) Fixed #14594 -- Corrected r14435, which got the logic completely bass ackwards. Thanks to Mark Sundstrom for keeping me honest :-)

comment:5 by Russell Keith-Magee, 13 years ago

Oops - sorry about that. I had the code right in my editor during testing; I just hit undo a few too many times removing some debug before I committed (Honest! I did! :-)

comment:6 by Jacob, 12 years ago

milestone: 1.3

Milestone 1.3 deleted

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