[PATCH] get-with-headers: don't block indefinitely if the server had an internal error

Augie Fackler raf at durin42.com
Thu Oct 3 09:45:51 CDT 2013


On Wed, Oct 02, 2013 at 11:03:19PM +0100, Javi Merino wrote:
> # HG changeset patch
> # User Javi Merino <cibervicho at gmail.com>
> # Date 1380750392 -3600
> #      Wed Oct 02 22:46:32 2013 +0100
> # Node ID c135513fb69b57d869eb98c23cef2f5c3fab54e7
> # Parent  1935e8383a9e1bd1ac6809ad1ecafd42dd7d58b2
> 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.

Bwuh? There can be a body on a 500. This strikes me as probably
wrong. Can you give an example of a case that hangs?

>
> 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')
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list