Hi,
The attached patch extents InternetExplorerFix to read garbage send with IE
POST requests. I would appreciate adding this patch to the official source.
The change is tested with FF and IE successfully.
I spend some time for searching the way to integrate fixers properly. May you
improve the werkzeug documentation with a small integration example.
Regards,
Carsten
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en.
--- fixers.py.orig 2012-05-01 12:32:08.000000000 +0200
+++ fixers.py 2012-05-14 09:44:23.566725000 +0200
@@ -16,6 +16,8 @@
:copyright: Copyright 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
+import select
+
from urllib import unquote
from werkzeug.http import parse_options_header, parse_cache_control_header, \
parse_set_header
@@ -170,6 +172,14 @@
Internet Explorer if `Content-Disposition` is set. Can be
disabled by passing ``fix_attach=False`` to the constructor.
+ - removes extra CRLF characters added to POST requests.
+ Those both characters aren't read and causes the TCP RST from
+ server to client. Can be disabled by passing
+ ``fix_crlf=False`` to the constructor.
+ see: http://support.microsoft.com/kb/823099/en-us,
+ http://trac.edgewall.org/ticket/8020,
+ http://blog.insightvr.com/uncategorized/ie7-bug-post-request-causes-ack-rst/
+
If it does not detect affected Internet Explorer versions it won't touch
the request / response.
"""
@@ -179,10 +189,11 @@
# by Michael Axiak and is available as part of the Django project:
# http://code.djangoproject.com/ticket/4148
- def __init__(self, app, fix_vary=True, fix_attach=True):
+ def __init__(self, app, fix_vary=True, fix_attach=True, fix_crlf=True):
self.app = app
self.fix_vary = fix_vary
self.fix_attach = fix_attach
+ self.fix_crlf = fix_crlf
def fix_headers(self, environ, headers, status=None):
if self.fix_vary:
@@ -211,6 +222,11 @@
else:
headers['Cache-Control'] = header
+ if self.fix_crlf and environ['REQUEST_METHOD'] == 'POST':
+ while select.select([environ['wsgi.input']], [], [], 0)[0]:
+ if not environ['wsgi.input'].read(1):
+ break
+
def run_fixed(self, environ, start_response):
def fixing_start_response(status, headers, exc_info=None):
self.fix_headers(environ, Headers.linked(headers), status)