Mercurial > public > src > rhodecode
diff pylons_app/controllers/hg.py @ 37:707dfdb1c7a8
Bugfix when client is using old mercurial version and not setting http accept
author | marcink |
---|---|
date | Thu, 18 Mar 2010 14:37:05 +0100 |
parents | f93b523c0be3 |
children | 71ffa932799d |
line wrap: on
line diff
--- a/pylons_app/controllers/hg.py Sun Mar 14 13:38:47 2010 +0100 +++ b/pylons_app/controllers/hg.py Thu Mar 18 14:37:05 2010 +0100 @@ -11,6 +11,7 @@ from mercurial.error import RepoError from ConfigParser import ConfigParser import encodings +from pylons.controllers.util import abort log = logging.getLogger(__name__) class HgController(BaseController): @@ -20,8 +21,13 @@ def view(self, *args, **kwargs): response = g.hgapp(request.environ, self.start_response) + + http_accept = request.environ.get('HTTP_ACCEPT', False) + if not http_accept: + return abort(status_code=400, detail='no http accept in header') + #for mercurial protocols and raw files we can't wrap into mako - if request.environ['HTTP_ACCEPT'].find("mercurial") != -1 or \ + if http_accept.find("mercurial") != -1 or \ request.environ['PATH_INFO'].find('raw-file') != -1: return response try: