diff mercurial/httprepo.py @ 4016:a195f11ed1a2

sync with -stable
author Thomas Arendsen Hein <thomas@intevation.de>
date Tue, 02 Jan 2007 22:40:52 +0100
parents 6b4127c7d52a d1e31d7f7d44
children 9210fba03d16
line wrap: on
line diff
--- a/mercurial/httprepo.py
+++ b/mercurial/httprepo.py
@@ -256,15 +256,19 @@ class httprepository(remoterepository):
             proto = resp.headers['content-type']
 
         # accept old "text/plain" and "application/hg-changegroup" for now
-        if not proto.startswith('application/mercurial') and \
+        if not proto.startswith('application/mercurial-') and \
                not proto.startswith('text/plain') and \
                not proto.startswith('application/hg-changegroup'):
             raise hg.RepoError(_("'%s' does not appear to be an hg repository") %
                                self._url)
 
-        if proto.startswith('application/mercurial'):
-            version = proto[22:]
-            if float(version) > 0.1:
+        if proto.startswith('application/mercurial-'):
+            try:
+                version = float(proto[22:])
+            except ValueError:
+                raise hg.RepoError(_("'%s' sent a broken Content-type "
+                                     "header (%s)") % (self._url, proto))
+            if version > 0.1:
                 raise hg.RepoError(_("'%s' uses newer protocol %s") %
                                    (self._url, version))