# HG changeset patch # User Javi Merino # Date 2013-10-02 21:46:32 # Node ID ba6577a196560d4a2925fc844520d75dedb28861 # Parent 1ce3f56b879f56c6640c54d9b6acbaffceaaffa5 get-with-headers: don't block indefinitely if the server had an internal error If the server had an internal error and returned 500, there's nothing to read, so "response.read()" blocks indefinitely. Only output the response if there's really a response. diff --git a/tests/get-with-headers.py b/tests/get-with-headers.py --- a/tests/get-with-headers.py +++ b/tests/get-with-headers.py @@ -43,8 +43,9 @@ def request(host, path, show): print "%s: %s" % (h, response.getheader(h)) if not headeronly: print - data = response.read() - sys.stdout.write(data) + if response.status != 500: + data = response.read() + sys.stdout.write(data) if twice and response.getheader('ETag', None): tag = response.getheader('ETag')