Show More
@@ -20,7 +20,7 b' fixes' | |||||
20 | - fixed git protocol issues with repos-groups |
|
20 | - fixed git protocol issues with repos-groups | |
21 | - fixed git remote repos validator that prevented from cloning remote git repos |
|
21 | - fixed git remote repos validator that prevented from cloning remote git repos | |
22 | - fixes #370 ending slashes fixes for repo and groups |
|
22 | - fixes #370 ending slashes fixes for repo and groups | |
23 | - fixes #368 improved git-protocol detection to handle other clients |
|
23 | #- fixes #368 improved git-protocol detection to handle other clients | |
24 | - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be |
|
24 | - fixes #366 When Setting Repository Group To Blank Repo Group Wont Be | |
25 | Moved To Root |
|
25 | Moved To Root | |
26 |
|
26 |
@@ -83,19 +83,22 b' log = logging.getLogger(__name__)' | |||||
83 | GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') |
|
83 | GIT_PROTO_PAT = re.compile(r'git-upload-pack|git-receive-pack|info\/refs') | |
84 |
|
84 | |||
85 |
|
85 | |||
86 |
def is_git( |
|
86 | def is_git(environ): | |
87 | return action in ['pull','push'] |
|
87 | """Returns True if request's target is git server. | |
|
88 | ``HTTP_USER_AGENT`` would then have git client version given. | |||
|
89 | ||||
|
90 | :param environ: | |||
|
91 | """ | |||
|
92 | http_user_agent = environ.get('HTTP_USER_AGENT') | |||
|
93 | if http_user_agent and http_user_agent.startswith('git'): | |||
|
94 | return True | |||
|
95 | return False | |||
88 |
|
96 | |||
89 |
|
97 | |||
90 | class SimpleGit(BaseVCSController): |
|
98 | class SimpleGit(BaseVCSController): | |
91 |
|
99 | |||
92 | def _handle_request(self, environ, start_response): |
|
100 | def _handle_request(self, environ, start_response): | |
93 | #====================================================================== |
|
101 | if not is_git(environ): | |
94 | # GET ACTION PULL or PUSH |
|
|||
95 | #====================================================================== |
|
|||
96 | action = self.__get_action(environ) |
|
|||
97 |
|
||||
98 | if not is_git(action): |
|
|||
99 | return self.application(environ, start_response) |
|
102 | return self.application(environ, start_response) | |
100 |
|
103 | |||
101 | proxy_key = 'HTTP_X_REAL_IP' |
|
104 | proxy_key = 'HTTP_X_REAL_IP' | |
@@ -114,6 +117,10 b' class SimpleGit(BaseVCSController):' | |||||
114 | except: |
|
117 | except: | |
115 | return HTTPInternalServerError()(environ, start_response) |
|
118 | return HTTPInternalServerError()(environ, start_response) | |
116 |
|
119 | |||
|
120 | #====================================================================== | |||
|
121 | # GET ACTION PULL or PUSH | |||
|
122 | #====================================================================== | |||
|
123 | action = self.__get_action(environ) | |||
117 |
|
124 | |||
118 | #====================================================================== |
|
125 | #====================================================================== | |
119 | # CHECK ANONYMOUS PERMISSION |
|
126 | # CHECK ANONYMOUS PERMISSION |
General Comments 0
You need to be logged in to leave comments.
Login now