mercurial/hgweb/hgweb_mod.py
changeset 6777 44c5157474e7
parent 6776 39319a457dda
child 6779 d3147b4e3e8a
--- a/mercurial/hgweb/hgweb_mod.py	Sat Jun 28 09:28:01 2008 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Jun 28 15:28:43 2008 +0200
@@ -89,6 +89,16 @@
 
         self.refresh()
 
+        # process this if it's a protocol request
+        # protocol bits don't need to create any URLs
+        # and the clients always use the old URL structure
+
+        cmd = req.form.get('cmd', [''])[0]
+        if cmd and cmd in protocol.__all__:
+            method = getattr(protocol, cmd)
+            method(self, req)
+            return
+
         # work with CGI variables to create coherent structure
         # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
 
@@ -120,8 +130,10 @@
                 cmd = cmd[style+1:]
 
             # avoid accepting e.g. style parameter as command
-            if hasattr(webcommands, cmd) or hasattr(protocol, cmd):
+            if hasattr(webcommands, cmd):
                 req.form['cmd'] = [cmd]
+            else:
+                cmd = ''
 
             if args and args[0]:
                 node = args.pop(0)
@@ -139,14 +151,6 @@
                         req.form['node'] = [fn[:-len(ext)]]
                         req.form['type'] = [type_]
 
-        # process this if it's a protocol request
-
-        cmd = req.form.get('cmd', [''])[0]
-        if cmd in protocol.__all__:
-            method = getattr(protocol, cmd)
-            method(self, req)
-            return
-
         # process the web interface request
 
         try: