# HG changeset patch # User Tony Bussieres # Date 1330392912 28800 # Node ID 851ea1139169bf29dc1f57439e280db879a793aa # Parent c8a8684efc74732d8a0109e13b83af96aee3a350 No more relying on user agent to check if the request is for a git action. Patch candidate for issue #368 diff -r c8a8684efc74 -r 851ea1139169 rhodecode/lib/middleware/simplegit.py --- a/rhodecode/lib/middleware/simplegit.py Tue Feb 28 01:37:20 2012 +0200 +++ b/rhodecode/lib/middleware/simplegit.py Mon Feb 27 17:35:12 2012 -0800 @@ -83,22 +83,15 @@ GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') -def is_git(environ): - """Returns True if request's target is git server. - ``HTTP_USER_AGENT`` would then have git client version given. - - :param environ: - """ - http_user_agent = environ.get('HTTP_USER_AGENT') - if http_user_agent and http_user_agent.startswith('git'): - return True - return False - - class SimpleGit(BaseVCSController): def _handle_request(self, environ, start_response): - if not is_git(environ): + #====================================================================== + # GET ACTION PULL or PUSH + #====================================================================== + action = self.__get_action(environ) + + if not action in ['pull','push']: return self.application(environ, start_response) proxy_key = 'HTTP_X_REAL_IP' @@ -117,10 +110,6 @@ except: return HTTPInternalServerError()(environ, start_response) - #====================================================================== - # GET ACTION PULL or PUSH - #====================================================================== - action = self.__get_action(environ) #====================================================================== # CHECK ANONYMOUS PERMISSION