##// END OF EJS Templates
configitems: drop redundant default of web.allow<archtype>...
Yuya Nishihara -
r34655:4182d206 default
parent child Browse files
Show More
@@ -1113,7 +1113,7 b' def archive(web, req, tmpl):'
1113 raise ErrorResponse(HTTP_NOT_FOUND, msg)
1113 raise ErrorResponse(HTTP_NOT_FOUND, msg)
1114
1114
1115 if not ((type_ in allowed or
1115 if not ((type_ in allowed or
1116 web.configbool("web", "allow" + type_, False))):
1116 web.configbool("web", "allow" + type_))):
1117 msg = 'Archive type not allowed: %s' % type_
1117 msg = 'Archive type not allowed: %s' % type_
1118 raise ErrorResponse(HTTP_FORBIDDEN, msg)
1118 raise ErrorResponse(HTTP_FORBIDDEN, msg)
1119
1119
@@ -24,7 +24,15 b''
24 $ cp .hg/hgrc .hg/hgrc-base
24 $ cp .hg/hgrc .hg/hgrc-base
25 > test_archtype() {
25 > test_archtype() {
26 > echo "allow_archive = $1" >> .hg/hgrc
26 > echo "allow_archive = $1" >> .hg/hgrc
27 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
27 > test_archtype_run "$@"
28 > }
29 > test_archtype_deprecated() {
30 > echo "allow$1 = True" >> .hg/hgrc
31 > test_archtype_run "$@"
32 > }
33 > test_archtype_run() {
34 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log \
35 > --config extensions.blackbox= --config blackbox.track=develwarn
28 > cat hg.pid >> $DAEMON_PIDS
36 > cat hg.pid >> $DAEMON_PIDS
29 > echo % $1 allowed should give 200
37 > echo % $1 allowed should give 200
30 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
38 > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
@@ -33,6 +41,7 b''
33 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
41 > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
34 > killdaemons.py
42 > killdaemons.py
35 > cat errors.log
43 > cat errors.log
44 > hg blackbox --config extensions.blackbox= --config blackbox.track=
36 > cp .hg/hgrc-base .hg/hgrc
45 > cp .hg/hgrc-base .hg/hgrc
37 > }
46 > }
38
47
@@ -57,6 +66,27 b' check http return codes'
57 403 Archive type not allowed: gz
66 403 Archive type not allowed: gz
58 403 Archive type not allowed: bz2
67 403 Archive type not allowed: bz2
59
68
69 check http return codes (with deprecated option)
70
71 $ test_archtype_deprecated gz tar.gz tar.bz2 zip
72 % gz allowed should give 200
73 200 Script output follows
74 % tar.bz2 and zip disallowed should both give 403
75 403 Archive type not allowed: bz2
76 403 Archive type not allowed: zip
77 $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
78 % bz2 allowed should give 200
79 200 Script output follows
80 % zip and tar.gz disallowed should both give 403
81 403 Archive type not allowed: zip
82 403 Archive type not allowed: gz
83 $ test_archtype_deprecated zip zip tar.gz tar.bz2
84 % zip allowed should give 200
85 200 Script output follows
86 % tar.gz and tar.bz2 disallowed should both give 403
87 403 Archive type not allowed: gz
88 403 Archive type not allowed: bz2
89
60 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
90 $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
61 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
91 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
62 $ cat hg.pid >> $DAEMON_PIDS
92 $ cat hg.pid >> $DAEMON_PIDS
General Comments 0
You need to be logged in to leave comments. Login now