Commit Graph

8 Commits

Author SHA1 Message Date
Mads Kiilerich
d04afd8fe1 tests: fix toctou race in tinyproxy.py (issue3795)
test-http-proxy.t sometimes failed with:
    File ".../tests/tinyproxy.py", line 110, in _read_write
      data = i.recv(8192)
  error: (104, 'Connection reset by peer')

This might have started showing up with 9eb533d10f1a ... but it has apparently
also been seen before. I don't see anything in 9eb533d10f1a that can explain
it. It seems to be a race in test, in the tinyproxy helper:

Tinyproxy found an incoming socket using select(). It would break the loop if
an error had been detected on the socket, but there was no error and it tried
to recv() from the socket. That failed - apparently because it had been reset
after select().

Errors in the recv() will now be caught and will break the loop like errors
detected by select() would.

(send() could also fail in a similar way ... but using the same solution there
and losing data we have read doesn't feel right.)
2013-01-31 19:13:13 +01:00
Brodie Rao
46ce54af4d cleanup: replace more naked excepts with more specific ones 2012-05-13 13:17:31 +02:00
Matt Mackall
18bf05f2aa tests: fix startup/shutdown races in test-https
tinyproxy now writes its own pid when it's ready to accept connections
2012-03-28 19:23:25 -05:00
Augie Fackler
dfe2a9638f tests: use getattr instead of hasattr 2011-07-25 16:37:18 -05:00
Martin Geisler
af8a35e078 check-code: flag 0/1 used as constant Boolean expression 2011-06-01 12:38:46 +02:00
Steven Brown
c1075f3880 httprepo: long arguments support (issue2126)
Send the command arguments in the HTTP headers. The command is still part
of the URL. If the server does not have the 'httpheader' capability, the
client will send the command arguments in the URL as it did previously.

Web servers typically allow more data to be placed within the headers than
in the URL, so this approach will:
- Avoid HTTP errors due to using a URL that is too large.
- Allow Mercurial to implement a more efficient wire protocol.

An alternate approach is to send the arguments as part of the request body.
This approach has been rejected because it requires the use of POST
requests, so it would break any existing configuration that relies on the
request type for authentication or caching.

Extensibility:
- The header size is provided by the server, which makes it possible to
  introduce an hgrc setting for it.
- The client ignores the capability value after the first comma, which
  allows more information to be included in the future.
2011-05-01 01:04:37 +08:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Vadim Gelfer
46bfa5a813 http: fix many problems with url parsing and auth. added proxy test.
problems fixed:

- https scheme handled properly for real and proxy urls.

- url of form "http://user:password@host:port/path" now ok.

- no-proxy check uses proper host names.
2006-05-22 15:42:49 -07:00