# HG changeset patch # User Matt Mackall # Date 1361133293 21600 # Node ID 56f8522c35915ed0a0e809ce97cee94dc9df5a48 # Parent f12804d3ff801b989cb2aab1aad93047a8db46f1 httppeer: improve protocol check Pre-0.6c hgweb used text/plain for protocol responses. This meant that a web server could serve a static file and confuse a client into generating a nasty traceback. Now we insist that text/plain protocol responses not include a Content-Length, which older hgweb didn't generate but will typically be produced for static files. diff -r f12804d3ff80 -r 56f8522c3591 mercurial/httppeer.py --- a/mercurial/httppeer.py Mon Feb 11 14:50:54 2013 -0800 +++ b/mercurial/httppeer.py Sun Feb 17 14:34:53 2013 -0600 @@ -145,7 +145,8 @@ raise error.OutOfBandError(resp.read()) # accept old "text/plain" and "application/hg-changegroup" for now if not (proto.startswith('application/mercurial-') or - proto.startswith('text/plain') or + (proto.startswith('text/plain') + and not resp.headers.get('content-length')) or proto.startswith('application/hg-changegroup')): self.ui.debug("requested URL: '%s'\n" % util.hidepassword(cu)) raise error.RepoError(