Skip to content

Commit 9136511

Browse files
committed
Prevent env['CONTENT_TYPE'] from being None. FieldStorage's content
header parser can handle empty string or missing value but can't handle None.
1 parent e475009 commit 9136511

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

roundup/scripts/roundup_server.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,15 @@ def inner_run_cgi(self):
377377
env['QUERY_STRING'] = query
378378
if hasattr(self.headers, 'get_content_type'):
379379
# Python 3. We need the raw header contents.
380-
env['CONTENT_TYPE'] = self.headers.get('content-type')
380+
content_type = self.headers.get('content-type')
381381
elif self.headers.typeheader is None:
382382
# Python 2.
383-
env['CONTENT_TYPE'] = self.headers.type
383+
content_type = self.headers.type
384384
else:
385385
# Python 2.
386-
env['CONTENT_TYPE'] = self.headers.typeheader
386+
content_type = self.headers.typeheader
387+
if content_type:
388+
env['CONTENT_TYPE'] = content_type
387389
length = self.headers.get('content-length')
388390
if length:
389391
env['CONTENT_LENGTH'] = length

0 commit comments

Comments
 (0)