255 proto = resp.getheader('content-type') |
255 proto = resp.getheader('content-type') |
256 except AttributeError: |
256 except AttributeError: |
257 proto = resp.headers['content-type'] |
257 proto = resp.headers['content-type'] |
258 |
258 |
259 # accept old "text/plain" and "application/hg-changegroup" for now |
259 # accept old "text/plain" and "application/hg-changegroup" for now |
260 if not proto.startswith('application/mercurial') and \ |
260 if not proto.startswith('application/mercurial-') and \ |
261 not proto.startswith('text/plain') and \ |
261 not proto.startswith('text/plain') and \ |
262 not proto.startswith('application/hg-changegroup'): |
262 not proto.startswith('application/hg-changegroup'): |
263 raise hg.RepoError(_("'%s' does not appear to be an hg repository") % |
263 raise hg.RepoError(_("'%s' does not appear to be an hg repository") % |
264 self._url) |
264 self._url) |
265 |
265 |
266 if proto.startswith('application/mercurial'): |
266 if proto.startswith('application/mercurial-'): |
267 version = proto[22:] |
267 try: |
268 if float(version) > 0.1: |
268 version = float(proto[22:]) |
|
269 except ValueError: |
|
270 raise hg.RepoError(_("'%s' sent a broken Content-type " |
|
271 "header (%s)") % (self._url, proto)) |
|
272 if version > 0.1: |
269 raise hg.RepoError(_("'%s' uses newer protocol %s") % |
273 raise hg.RepoError(_("'%s' uses newer protocol %s") % |
270 (self._url, version)) |
274 (self._url, version)) |
271 |
275 |
272 return resp |
276 return resp |
273 |
277 |