##// END OF EJS Templates
hgweb: fail if an invalid command was supplied in url path (issue4071)...
Anton Shestakov -
r22506:6e1fbcb1 stable
parent child Browse files
Show More
@@ -200,8 +200,6 b' class hgweb(object):'
200 # avoid accepting e.g. style parameter as command
200 # avoid accepting e.g. style parameter as command
201 if util.safehasattr(webcommands, cmd):
201 if util.safehasattr(webcommands, cmd):
202 req.form['cmd'] = [cmd]
202 req.form['cmd'] = [cmd]
203 else:
204 cmd = ''
205
203
206 if cmd == 'static':
204 if cmd == 'static':
207 req.form['file'] = ['/'.join(args)]
205 req.form['file'] = ['/'.join(args)]
@@ -122,6 +122,24 b' should give a 400 - bad command'
122 error: no such method: spam
122 error: no such method: spam
123 [1]
123 [1]
124
124
125 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT '?cmd=spam'
126 400 no such method: spam
127 [1]
128
129 should give a 400 - bad command as a part of url path (issue4071)
130
131 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'spam'
132 400 no such method: spam
133 [1]
134
135 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'raw-spam'
136 400 no such method: spam
137 [1]
138
139 $ "$TESTDIR/get-with-headers.py" --headeronly localhost:$HGPORT 'spam/tip/foo'
140 400 no such method: spam
141 [1]
142
125 should give a 404 - file does not exist
143 should give a 404 - file does not exist
126
144
127 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'file/tip/bork?style=raw'
145 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'file/tip/bork?style=raw'
@@ -308,7 +326,7 b' stop and restart'
308 Test the access/error files are opened in append mode
326 Test the access/error files are opened in append mode
309
327
310 $ python -c "print len(file('access.log').readlines()), 'log lines written'"
328 $ python -c "print len(file('access.log').readlines()), 'log lines written'"
311 10 log lines written
329 14 log lines written
312
330
313 static file
331 static file
314
332
General Comments 0
You need to be logged in to leave comments. Login now