comparison roundup/scripts/roundup_server.py @ 5667:5ad31de777a8

Prevent env['CONTENT_TYPE'] from being None. FieldStorage's content header parser can handle empty string or missing value but can't handle None.
author John Rouillard <rouilj@ieee.org>
date Sat, 23 Mar 2019 00:02:03 -0400
parents b3618882f906
children 320a1692a473
comparison
equal deleted inserted replaced
5666:d660d1c1ba63 5667:5ad31de777a8
375 env['PATH_INFO'] = urllib_.unquote(rest) 375 env['PATH_INFO'] = urllib_.unquote(rest)
376 if query: 376 if query:
377 env['QUERY_STRING'] = query 377 env['QUERY_STRING'] = query
378 if hasattr(self.headers, 'get_content_type'): 378 if hasattr(self.headers, 'get_content_type'):
379 # Python 3. We need the raw header contents. 379 # 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')
381 elif self.headers.typeheader is None: 381 elif self.headers.typeheader is None:
382 # Python 2. 382 # Python 2.
383 env['CONTENT_TYPE'] = self.headers.type 383 content_type = self.headers.type
384 else: 384 else:
385 # Python 2. 385 # 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
387 length = self.headers.get('content-length') 389 length = self.headers.get('content-length')
388 if length: 390 if length:
389 env['CONTENT_LENGTH'] = length 391 env['CONTENT_LENGTH'] = length
390 if hasattr(self.headers, 'get_all'): 392 if hasattr(self.headers, 'get_all'):
391 # Python 3. 393 # Python 3.

Roundup Issue Tracker: http://roundup-tracker.org/