[PATCH 2 of 2] configitems: drop redundant default of web.allow<archtype>
Boris FELD
lothiraldan at gmail.com
Thu Oct 12 15:45:49 UTC 2017
Looks good to me, thank for the catch!
I'm gonna double-check the other patches that have landed.
Le jeu. 12 oct. 2017 à 17:37, Yuya Nishihara <yuya at tcha.org> a écrit :
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1507821774 -32400
> # Fri Oct 13 00:22:54 2017 +0900
> # Node ID 50217bf3f4f143488d91cce177f5447115b5277e
> # Parent 69b2780c454aa671eab506050f0dca555f40ee62
> configitems: drop redundant default of web.allow<archtype>
>
> Otherwise develwarn would be sent to stderr. I've added blackbox logging
> to capture warnings.
>
> diff --git a/mercurial/hgweb/webcommands.py
> b/mercurial/hgweb/webcommands.py
> --- a/mercurial/hgweb/webcommands.py
> +++ b/mercurial/hgweb/webcommands.py
> @@ -1113,7 +1113,7 @@ def archive(web, req, tmpl):
> raise ErrorResponse(HTTP_NOT_FOUND, msg)
>
> if not ((type_ in allowed or
> - web.configbool("web", "allow" + type_, False))):
> + web.configbool("web", "allow" + type_))):
> msg = 'Archive type not allowed: %s' % type_
> raise ErrorResponse(HTTP_FORBIDDEN, msg)
>
> diff --git a/tests/test-archive.t b/tests/test-archive.t
> --- a/tests/test-archive.t
> +++ b/tests/test-archive.t
> @@ -24,7 +24,15 @@
> $ cp .hg/hgrc .hg/hgrc-base
> > test_archtype() {
> > echo "allow_archive = $1" >> .hg/hgrc
> - > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
> + > test_archtype_run "$@"
> + > }
> + > test_archtype_deprecated() {
> + > echo "allow$1 = True" >> .hg/hgrc
> + > test_archtype_run "$@"
> + > }
> + > test_archtype_run() {
> + > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log \
> + > --config extensions.blackbox= --config
> blackbox.track=develwarn
> > cat hg.pid >> $DAEMON_PIDS
> > echo % $1 allowed should give 200
> > get-with-headers.py localhost:$HGPORT "archive/tip.$2" | head -n 1
> @@ -33,6 +41,7 @@
> > get-with-headers.py localhost:$HGPORT "archive/tip.$4" | head -n 1
> > killdaemons.py
> > cat errors.log
> + > hg blackbox --config extensions.blackbox= --config blackbox.track=
> > cp .hg/hgrc-base .hg/hgrc
> > }
>
> @@ -57,6 +66,27 @@ check http return codes
> 403 Archive type not allowed: gz
> 403 Archive type not allowed: bz2
>
> +check http return codes (with deprecated option)
> +
> + $ test_archtype_deprecated gz tar.gz tar.bz2 zip
> + % gz allowed should give 200
> + 200 Script output follows
> + % tar.bz2 and zip disallowed should both give 403
> + 403 Archive type not allowed: bz2
> + 403 Archive type not allowed: zip
> + $ test_archtype_deprecated bz2 tar.bz2 zip tar.gz
> + % bz2 allowed should give 200
> + 200 Script output follows
> + % zip and tar.gz disallowed should both give 403
> + 403 Archive type not allowed: zip
> + 403 Archive type not allowed: gz
> + $ test_archtype_deprecated zip zip tar.gz tar.bz2
> + % zip allowed should give 200
> + 200 Script output follows
> + % tar.gz and tar.bz2 disallowed should both give 403
> + 403 Archive type not allowed: gz
> + 403 Archive type not allowed: bz2
> +
> $ echo "allow_archive = gz bz2 zip" >> .hg/hgrc
> $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
> $ cat hg.pid >> $DAEMON_PIDS
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20171012/fd2d02f8/attachment-0002.html>
More information about the Mercurial-devel
mailing list