Mercurial > kallithea
changeset 2056:851ea1139169 beta
No more relying on user agent to check if the request is for a git action. Patch candidate for issue #368
author | Tony Bussieres <t.bussieres@gmail.com> |
---|---|
date | Mon, 27 Feb 2012 17:35:12 -0800 |
parents | c8a8684efc74 |
children | 766696ee9487 |
files | rhodecode/lib/middleware/simplegit.py |
diffstat | 1 files changed, 6 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- 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