Commit Graph

77 Commits

Author SHA1 Message Date
Claude Paroz 38408f8007 Marked bytestrings with b prefix. Refs #18269
This is a preparation for unicode literals general usage in
Django (Python 3 compatibility).
2012-05-19 17:43:34 +02:00
Claude Paroz d7dfab59ea Replaced cStringIO.StringIO by io.BytesIO.
Also replaced StringIO.StringIO by BytesIO in some other appropriate
places. StringIO is not available in Python 3.
2012-05-05 21:41:44 +02:00
Adrian Holovaty 61f0aff811 Fixed #14597 -- Added a SECURE_PROXY_SSL_HEADER setting for cases when you're behind a proxy that 'swallows' the fact that a request is HTTPS
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17209 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-16 22:06:06 +00:00
Adrian Holovaty 082cfce185 Negligible typo fix in a comment in handlers/wsgi.py
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17207 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-16 20:21:16 +00:00
Carl Meyer 145a77edc9 Fixed #16360 -- Added WSGI entrypoint to startproject layout, and enabled internal servers (runserver and runfcgi) to use an externally-defined WSGI application. Thanks to Armin Ronacher, Jannis Leidel, Alex Gaynor, ptone, and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17022 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-10-22 04:30:10 +00:00
Jacob Kaplan-Moss 4584069c8a Fixed #16746 - added more HTTP code/string mappings.
This moves the arbitrary line on which HTTP codes to include away from
RFC 2616 and to the IANA assignments, thus picking up WebDAV and a couple
others.

Thanks to vfaronov for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16732 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-09-09 16:57:35 +00:00
Jannis Leidel 24f4764a48 Fixed #16225 -- Removed unused imports. Many thanks to Aymeric Augustin for the work on the patch and Alex for reviewing.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-07-13 09:35:51 +00:00
Jannis Leidel a6cd78662e Fixed #15785 -- Stopped HttpRequest.read() from reading beyond the end of a wsgi.input stream and removed some redundant code in the multipartparser. Thanks, tomchristie, grahamd and isagalaev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16479 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-28 10:17:56 +00:00
Luke Plant db2f9bfae1 Fixed #16178 - Cleanup request classes' `__repr__()`
Thanks to julien for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16350 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-06-09 23:15:42 +00:00
Jannis Leidel 12265410ac Fixed #15672 -- Refined changes made in r15918. Thanks, vung.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16082 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-04-22 12:15:52 +00:00
Adrian Holovaty 2f9658fc3a Fixed #15672 -- Fixed bug in core/handlers/wsgi.py where we were referring to the 'request' variable before assigning to it. Thanks for the report, vkryachko
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-26 03:53:37 +00:00
Russell Keith-Magee b4f0921463 Fixed #15018 -- Corrected the handling of LimitedStream under one edge case involving size restricted buffers and newlines. Thanks to xjdrew for the report, and aaugustin for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-16 07:31:35 +00:00
Russell Keith-Magee 0d70d29227 Corrected r15205 syntax to be Python2.4 compatible.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15210 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-15 05:54:55 +00:00
Andrew Godwin ba585a2c6d Fixed #11193 -- WSGI handler not properly handling lock on error in load_middleware. Thanks to Phillip Sitbon.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-14 23:18:21 +00:00
Russell Keith-Magee c906b270f5 Fixed #14602 -- Added an extra check to wsgi.input handling to prevent AppEngine from choking. Thanks to Waldemar Kornewald for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14453 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-04 12:03:38 +00:00
Russell Keith-Magee 269e921756 Fixed #9886 -- Added a file-like interface to HttpRequest. Thanks to Ivan Sagalaev for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 16:39:25 +00:00
Russell Keith-Magee 3086b55b0e Fixed #14523 -- Modified response handling so that exceptions raised by process_response() in a middleware are caught and handled like any other exception. Thanks to Ivan Sagalaev for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29 07:43:56 +00:00
Russell Keith-Magee fea159282b Fixed #14406 -- Added a Python 2.4 compatibility to the logging interface. Thanks to Łukasz Rekucki for the report, and to Luke Plant for original patch this was based on.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13989 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-06 15:02:26 +00:00
Russell Keith-Magee 24acca4139 Fixed #12012 -- Added support for logging. Thanks to Vinay Sajip for his draft patch, and to the many people who gave feedback during development of the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-04 15:12:39 +00:00
Malcolm Tredinnick d01c17e81d Fixed #9469 -- Apply the fix from r9189 to the WSGI handler as well.
This is a defensive encoding fix. No functionality change for correct URLs.
Patch from magneto.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 09:58:40 +00:00
Jacob Kaplan-Moss 15644cb255 Fixed #8622: accessing POST after a POST handling exception no longer throws the server into an infinite loop. Thanks to vung for tracking this one down and fixing it.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-30 19:56:14 +00:00
Malcolm Tredinnick 948a833eb7 Fixed #8490 -- Worked around a bug in flup 1.0.1 when working out the correct
path_info setting in the WSGI handler. Thanks, Mike Richardson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-26 02:42:39 +00:00
Malcolm Tredinnick 77bf14d581 Fixed #8259 -- Handle an error situation that we should never see, but still
occurs for some reason (be liberal in what you accept, and all that). Patch
from kevin.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8495 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-23 18:08:28 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Malcolm Tredinnick c236874c48 Fixed #7871 -- Added some more bullet-proofing in PATH_INFO determination,
since Django would like it to at least contain a '/' (rather than being an
empty string).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8032 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 22:13:56 +00:00
Malcolm Tredinnick bfcecbffd3 Changed/fixed the way Django handles SCRIPT_NAME and PATH_INFO (or
equivalents). Basically, URL resolving will only use the PATH_INFO and the
SCRIPT_NAME will be prepended by reverse() automatically. Allows for more
portable development and installation. Also exposes SCRIPT_NAME in the
HttpRequest instance.

There are a number of cases where things don't work completely transparently,
so mod_python and fastcgi users should read the relevant docs.

Fixed #285, #1516, #3414.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 07:57:10 +00:00
Malcolm Tredinnick 189c704ae6 Revert [7991] - [7993]. I was committing from the wrong branch. Sorry 'bout
that, folks. :-(


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:37:55 +00:00
Malcolm Tredinnick b653cdcfb2 First part of setting request.path correctly.
Still needs:
    - testing
    - docs changes
    - some way of fixing reverse().


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7991 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:32:01 +00:00
Jacob Kaplan-Moss d725cc9734 Fixed #2070: refactored Django's file upload capabilities.
A description of the new features can be found in the new [http://www.djangoproject.com/documentation/upload_handing/ upload handling documentation]; the executive summary is that Django will now happily handle uploads of large files without issues.

This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-01 15:10:51 +00:00
Gary Wilson Jr c882d7c99c Re-organized imports in handler modules to adhere to Django coding style.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6826 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-12-02 02:22:19 +00:00
Malcolm Tredinnick 3ee3d6b5f3 Fixed #5898 -- Changed a few response processing paths to make things harder to get wrong and easier to get right. Previous behaviour wasn't buggy, but it was harder to use than necessary.
We now have automatic HEAD processing always (previously required ConditionalGetMiddleware), middleware benefits from the Location header rewrite, so they can use relative URLs as well, and responses with response codes 1xx, 204 or 304 will always have their content removed, in accordance with the HTTP spec (so it's much harder to indavertently deliver invalid responses).

Based on a patch and diagnosis from regexbot@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-11 03:55:44 +00:00
Malcolm Tredinnick 375a6d78cb Fixed #3496 -- Handle the case of missing (and hence '0') Content-Length header
in a POST to the wsgi handler. Based on a patch from Mikko Ohtamaa.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6592 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-21 23:52:08 +00:00
Malcolm Tredinnick f34935c37f Slightly changed the way we handle non-UTF-8 encoded URIs (see [6475]). Made it
easier to subclass the current behaviour, if needed. Fixed #5738.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6550 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-20 07:42:34 +00:00
Adrian Holovaty 8ae74eae55 Fixed #5738 -- Fixed bug with defective Unicode strings in a URL
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-10-13 02:57:57 +00:00
Gary Wilson Jr 39d61439e0 Re-organized imports to adhere to PEP 8.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6430 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-27 17:01:34 +00:00
Gary Wilson Jr 1f42d1c9a5 Removed unused import, unneeded due to [4144].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6429 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-27 17:00:07 +00:00
Gary Wilson Jr f4bb24658b Fixed #5604 -- Check for use of HTTPS by looking at the `wsgi.url_scheme` environment variable instead of the `HTTPS` environment variable since `wsgi.url_scheme` is required by the WSGI spec, while `HTTPS` is not. Thanks, ramiro.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-27 16:57:55 +00:00
Jacob Kaplan-Moss ca9388cdaf Added more dict-like methods to HttpResponse as part of the response.headers -> response._headers move, and fixed a few direct uses of response.headers in Django itself. Thanks to PhiR for tracking down and slaying these bugs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6235 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 22:33:56 +00:00
Malcolm Tredinnick 6d31e431c3 Fixed #4909 -- Fixed a race condition with middleware initialisation in multi-threaded setups. Thanks, colin@owlfish.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-12 10:24:05 +00:00
Malcolm Tredinnick fad7247715 Changed HttpRequest.path to be a Unicode object. It has already been
URL-decoded by the time we see it anyway, so keeping it as a UTF-8 bytestring
was causing unnecessary problems.

Also added handling for non-ASCII URL fragments in feed creation (the portion
that was outside the control of the Feed class was messed up).



git-svn-id: http://code.djangoproject.com/svn/django/trunk@5629 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-07 17:15:54 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Malcolm Tredinnick 439cb4047f Fixed #4040 -- Changed uses of has_key() to "in". Slight performance
improvement and forward-compatible with future Python releases. Patch from Gary
Wilson.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-04-26 13:30:48 +00:00
Adrian Holovaty d506b90163 Fixed #2924 -- Development server no longer spins on an empty form post. Bug caused by [3805]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4144 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-29 22:51:24 +00:00
Adrian Holovaty e71fb7c7f2 Fixed #3057 -- Improved wsgi backend to tolerate empty string in CONTENT_LENGTH. Thanks for the patch, Ivan Sagalaev
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4107 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-26 23:52:12 +00:00
Adrian Holovaty 9884211a1a Fixed #3057 -- Fixed typo in [4091]. Thanks for the heads-up, Barry Pederson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4094 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-23 17:48:06 +00:00
Adrian Holovaty a2e227f2fa Fixed #3057 -- Changed WSGI handler not to expect CONTENT_LENGTH. Thanks for the patch, Ivan Sagalaev
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4091 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-11-23 17:06:11 +00:00
Adrian Holovaty f638234932 Removed ENABLE_PSYCO setting. If you still need to use this, write custom middleware that activates psyco for you.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3877 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-28 02:31:05 +00:00
Adrian Holovaty 15e7805ae4 Changed BaseHandler.get_response() to take a single parameter (an HttpRequest object) rather than a URL and the HttpRequest object, which is redundant
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3875 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-28 01:56:02 +00:00
Malcolm Tredinnick f1c63992f7 Fixed #2745 -- Made the __repr__ methods for modpython and wsgi request more
robust in the face of bad input, since they are needed for error handling.
Based on a patch from md@hudora.de.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@3820 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-25 07:25:12 +00:00
Malcolm Tredinnick 28fad23a3f A corrected version of r3805.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3807 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2006-09-23 13:53:02 +00:00