##// END OF EJS Templates
hgweb: deny cloning a subpath of a repo
Benoit Boissinot -
r8860:36654238 default
parent child Browse files
Show More
@@ -82,28 +82,6 b' class hgweb(object):'
82
82
83 self.refresh()
83 self.refresh()
84
84
85 # process this if it's a protocol request
86 # protocol bits don't need to create any URLs
87 # and the clients always use the old URL structure
88
89 cmd = req.form.get('cmd', [''])[0]
90 if cmd and cmd in protocol.__all__:
91 try:
92 if cmd in perms:
93 try:
94 self.check_perm(req, perms[cmd])
95 except ErrorResponse, inst:
96 if cmd == 'unbundle':
97 req.drain()
98 raise
99 method = getattr(protocol, cmd)
100 return method(self.repo, req)
101 except ErrorResponse, inst:
102 req.respond(inst, protocol.HGTYPE)
103 if not inst.message:
104 return []
105 return '0\n%s\n' % inst.message,
106
107 # work with CGI variables to create coherent structure
85 # work with CGI variables to create coherent structure
108 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
86 # use SCRIPT_NAME, PATH_INFO and QUERY_STRING as well as our REPO_NAME
109
87
@@ -123,6 +101,30 b' class hgweb(object):'
123 query = req.env['QUERY_STRING'].split('&', 1)[0]
101 query = req.env['QUERY_STRING'].split('&', 1)[0]
124 query = query.split(';', 1)[0]
102 query = query.split(';', 1)[0]
125
103
104 # process this if it's a protocol request
105 # protocol bits don't need to create any URLs
106 # and the clients always use the old URL structure
107
108 cmd = req.form.get('cmd', [''])[0]
109 if cmd and cmd in protocol.__all__:
110 if query:
111 raise ErrorResponse(HTTP_NOT_FOUND)
112 try:
113 if cmd in perms:
114 try:
115 self.check_perm(req, perms[cmd])
116 except ErrorResponse, inst:
117 if cmd == 'unbundle':
118 req.drain()
119 raise
120 method = getattr(protocol, cmd)
121 return method(self.repo, req)
122 except ErrorResponse, inst:
123 req.respond(inst, protocol.HGTYPE)
124 if not inst.message:
125 return []
126 return '0\n%s\n' % inst.message,
127
126 # translate user-visible url structure to internal structure
128 # translate user-visible url structure to internal structure
127
129
128 args = query.split('/', 2)
130 args = query.split('/', 2)
General Comments 0
You need to be logged in to leave comments. Login now