Skip to content

Commit 6d2dec9

Browse files
author
Ralf Schlatterbeck
committed
Handle OPTIONS http request method in wsgi handler, fixes issue2550587.
Thanks to Thomas Arendsen Hein for reporting and to Intevation for funding the fix.
1 parent 5c3ff4b commit 6d2dec9

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

CHANGES.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ Fixes:
2323
fix.
2424
- Fix traceback on .../msgN/ url, this requests the file content and for
2525
apache mod_wsgi produced a traceback because the mime type is None for
26-
messages, fixes issue2550586, thanks to ThomasAH for reporting and to
27-
Intevation for funding the fix.
26+
messages, fixes issue2550586, thanks to Thomas Arendsen Hein for
27+
reporting and to Intevation for funding the fix.
28+
- Handle OPTIONS http request method in wsgi handler, fixes issue2550587.
29+
Thanks to Thomas Arendsen Hein for reporting and to Intevation for
30+
funding the fix.
2831

2932

3033
2009-10-09 1.4.10 (r4374)

roundup/cgi/wsgi_handler.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import roundup.instance
1212
from roundup.cgi import TranslationService
13-
from BaseHTTPServer import BaseHTTPRequestHandler
13+
from BaseHTTPServer import BaseHTTPRequestHandler, DEFAULT_ERROR_MESSAGE
1414

1515

1616
class Writer(object):
@@ -43,6 +43,14 @@ def __call__(self, environ, start_response):
4343
request.wfile = Writer(request)
4444
request.__wfile = None
4545

46+
if environ ['REQUEST_METHOD'] == 'OPTIONS':
47+
code = 501
48+
message, explain = BaseHTTPRequestHandler.responses[code]
49+
request.start_response([('Content-Type', 'text/html'),
50+
('Connection', 'close')], code)
51+
request.wfile.write(DEFAULT_ERROR_MESSAGE % locals())
52+
return []
53+
4654
tracker = roundup.instance.open(self.home, not self.debug)
4755

4856
# need to strip the leading '/'

0 commit comments

Comments
 (0)