mirror of https://github.com/python/cpython
Fix test_xmlrpc and make the CGI handler work with no CONTENT_LENGTH.
This commit is contained in:
parent
c53306c217
commit
61fce3877c
|
@ -600,7 +600,7 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher):
|
|||
# POST data is normally available through stdin
|
||||
try:
|
||||
length = int(os.environ.get('CONTENT_LENGTH', None))
|
||||
except ValueError:
|
||||
except (TypeError, ValueError):
|
||||
length = -1
|
||||
if request_text is None:
|
||||
request_text = sys.stdin.read(length)
|
||||
|
|
|
@ -629,7 +629,11 @@ class CGIHandlerTestCase(unittest.TestCase):
|
|||
sys.stdin = open("xmldata.txt", "r")
|
||||
sys.stdout = open(test_support.TESTFN, "w")
|
||||
|
||||
self.cgi.handle_request()
|
||||
os.environ['CONTENT_LENGTH'] = str(len(data))
|
||||
try:
|
||||
self.cgi.handle_request()
|
||||
finally:
|
||||
del os.environ['CONTENT_LENGTH']
|
||||
|
||||
sys.stdin.close()
|
||||
sys.stdout.close()
|
||||
|
|
Loading…
Reference in New Issue