changeset 2122:c137b8a81f8e beta

git+hg middleware do repo verification at earliest possible state, giving 404 as fast as possible. If repo is not found.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 12 Mar 2012 20:33:13 +0200
parents 47d7bcbe5503
children f47f27a6b54e
files rhodecode/lib/middleware/simplegit.py rhodecode/lib/middleware/simplehg.py
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/middleware/simplegit.py	Mon Mar 12 20:21:52 2012 +0200
+++ b/rhodecode/lib/middleware/simplegit.py	Mon Mar 12 20:33:13 2012 +0200
@@ -115,6 +115,10 @@
         except:
             return HTTPInternalServerError()(environ, start_response)
 
+        # quick check if that dir exists...
+        if is_valid_repo(repo_name, self.basepath) is False:
+            return HTTPNotFound()(environ, start_response)
+
         #======================================================================
         # GET ACTION PULL or PUSH
         #======================================================================
@@ -181,10 +185,6 @@
         repo_path = os.path.join(safe_str(self.basepath), safe_str(repo_name))
         log.debug('Repository path is %s' % repo_path)
 
-        # quick check if that dir exists...
-        if is_valid_repo(repo_name, self.basepath) is False:
-            return HTTPNotFound()(environ, start_response)
-
         try:
             #invalidate cache on push
             if action == 'push':
--- a/rhodecode/lib/middleware/simplehg.py	Mon Mar 12 20:21:52 2012 +0200
+++ b/rhodecode/lib/middleware/simplehg.py	Mon Mar 12 20:33:13 2012 +0200
@@ -85,6 +85,10 @@
         except:
             return HTTPInternalServerError()(environ, start_response)
 
+        # quick check if that dir exists...
+        if is_valid_repo(repo_name, self.basepath) is False:
+            return HTTPNotFound()(environ, start_response)
+
         #======================================================================
         # GET ACTION PULL or PUSH
         #======================================================================
@@ -163,10 +167,6 @@
         baseui = make_ui('db')
         self.__inject_extras(repo_path, baseui, extras)
 
-        # quick check if that dir exists...
-        if is_valid_repo(repo_name, self.basepath) is False:
-            return HTTPNotFound()(environ, start_response)
-
         try:
             # invalidate cache on push
             if action == 'push':