[PATCH 3 of 6] tests: add tests for poorly behaving HTTP server

Danek Duvall danek.duvall at oracle.com
Tue Apr 18 17:41:23 EDT 2017


Gregory Szorc wrote:

> +Failure to accept() socket should result in connection related error message
> +
> +  $ hg --config badserver.closebeforeaccept=true serve -p $HGPORT -d --pid-file=hg.pid
> +  $ cat hg.pid > $DAEMON_PIDS
> +
> +  $ hg clone http://localhost:$HGPORT/ clone
> +  abort: error: Connection reset by peer
> +  [255]
> +
> +(The server exits on its own, but there is a race between that and starting a new server.
> +So ensure the process is dead.)
> +
> +  $ killdaemons.py $DAEMON_PIDS
> +
> +Failure immediately after accept() should yield connection related error message
> +
> +  $ hg --config badserver.closeafteraccept=true serve -p $HGPORT -d --pid-file=hg.pid
> +  $ cat hg.pid > $DAEMON_PIDS
> +
> +  $ hg clone http://localhost:$HGPORT/ clone
> +  abort: error: Connection reset by peer
> +  [255]

I'm seeing

      abort: error: ''

for this on Solaris (just the closeafteraccept case).  I've traced it back
to getting a BadStatusLine exception instead of a read (or whatever)
resulting in ECONNRESET:

   Traceback (most recent call last):
     File ".../mercurial/keepalive.py", line 239, in do_open
       r = h.getresponse()
     File ".../mercurial/url.py", line 158, in getresponse
       return keepalive.HTTPConnection.getresponse(self)
     File ".../mercurial/keepalive.py", line 578, in safegetresponse
       return cls.getresponse(self)
     File "/usr/lib/python2.7/httplib.py", line 1121, in getresponse
       response.begin()
     File "/usr/lib/python2.7/httplib.py", line 438, in begin
       version, status, reason = self._read_status()
     File "/usr/lib/python2.7/httplib.py", line 402, in _read_status
       raise BadStatusLine(line)

Any thoughts on this before I spend more time digging?

Thanks,
Danek


More information about the Mercurial-devel mailing list