Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#14594 closed (fixed)

Django/CherryPy problem with POST data

Reported by: msundstr Owned by: nobody
Component: HTTP handling Version: master
Severity: Keywords:
Cc: isagalaev Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 msundstr 4 years ago.
Patch to reverse the use of content_length applied in [14435]

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by msundstr

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 4 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(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 Changed 4 years ago by msundstr

  • Has patch set
  • Resolution fixed deleted
  • Status changed from closed to reopened

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

Changed 4 years ago by msundstr

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

comment:4 Changed 4 years ago by russellm

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:5 Changed 4 years ago by russellm

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 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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