Attachment 'contrib_fixers_IE_CRLF.diff'
Download 1 --- fixers.py.orig 2012-05-01 12:32:08.000000000 +0200
2 +++ fixers.py 2012-05-14 09:44:23.566725000 +0200
3 @@ -16,6 +16,8 @@
4 :copyright: Copyright 2009 by the Werkzeug Team, see AUTHORS for more details.
5 :license: BSD, see LICENSE for more details.
6 """
7 +import select
8 +
9 from urllib import unquote
10 from werkzeug.http import parse_options_header, parse_cache_control_header, \
11 parse_set_header
12 @@ -170,6 +172,14 @@
13 Internet Explorer if `Content-Disposition` is set. Can be
14 disabled by passing ``fix_attach=False`` to the constructor.
15
16 + - removes extra CRLF characters added to POST requests.
17 + Those both characters aren't read and causes the TCP RST from
18 + server to client. Can be disabled by passing
19 + ``fix_crlf=False`` to the constructor.
20 + see: http://support.microsoft.com/kb/823099/en-us,
21 + http://trac.edgewall.org/ticket/8020,
22 + http://blog.insightvr.com/uncategorized/ie7-bug-post-request-causes-ack-rst/
23 +
24 If it does not detect affected Internet Explorer versions it won't touch
25 the request / response.
26 """
27 @@ -179,10 +189,11 @@
28 # by Michael Axiak and is available as part of the Django project:
29 # http://code.djangoproject.com/ticket/4148
30
31 - def __init__(self, app, fix_vary=True, fix_attach=True):
32 + def __init__(self, app, fix_vary=True, fix_attach=True, fix_crlf=True):
33 self.app = app
34 self.fix_vary = fix_vary
35 self.fix_attach = fix_attach
36 + self.fix_crlf = fix_crlf
37
38 def fix_headers(self, environ, headers, status=None):
39 if self.fix_vary:
40 @@ -211,6 +222,11 @@
41 else:
42 headers['Cache-Control'] = header
43
44 + if self.fix_crlf and environ['REQUEST_METHOD'] == 'POST':
45 + while select.select([environ['wsgi.input']], [], [], 0)[0]:
46 + if not environ['wsgi.input'].read(1):
47 + break
48 +
49 def run_fixed(self, environ, start_response):
50 def fixing_start_response(status, headers, exc_info=None):
51 self.fix_headers(environ, Headers.linked(headers), status)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.