changeset 19865:ba6577a19656

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.
author Javi Merino <cibervicho@gmail.com>
date Wed, 02 Oct 2013 22:46:32 +0100
parents 1ce3f56b879f
children 993b24488679
files tests/get-with-headers.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/get-with-headers.py	Fri Jul 19 02:32:36 2013 +0200
+++ b/tests/get-with-headers.py	Wed Oct 02 22:46:32 2013 +0100
@@ -43,8 +43,9 @@
             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')