# HG changeset patch # User Mads Kiilerich # Date 1299505650 -3600 # Node ID 091c86a77d19b6183af07263758cc1cb2534fe0f # Parent cc9366a3751b913323a198797972c187e56f51bd httprepo: proper handling of invalid responses without content-type (issue2019) This can currently be tested on http://sf.net/ diff -r cc9366a3751b -r 091c86a77d19 mercurial/httprepo.py --- a/mercurial/httprepo.py Mon Mar 07 22:50:55 2011 +0100 +++ b/mercurial/httprepo.py Mon Mar 07 14:47:30 2011 +0100 @@ -128,7 +128,7 @@ try: proto = resp.getheader('content-type') except AttributeError: - proto = resp.headers['content-type'] + proto = resp.headers.get('content-type', '') safeurl = util.hidepassword(self._url) # accept old "text/plain" and "application/hg-changegroup" for now @@ -139,7 +139,7 @@ raise error.RepoError( _("'%s' does not appear to be an hg repository:\n" "---%%<--- (%s)\n%s\n---%%<---\n") - % (safeurl, proto, resp.read())) + % (safeurl, proto or 'no content-type', resp.read())) if proto.startswith('application/mercurial-'): try: