# HG changeset patch # User Yuya Nishihara # Date 1346857167 -32400 # Node ID 59a16801925590a7fb7c02a420b5450dd834fae0 # Parent 2212af23c9de1ab0404339c80f3570b3859d30fd hgweb: respond 403 forbidden for ssl required error It's preferable to report "ssl required" as an error, so that the client can detect error and exit with 255. Currently hg exits with 1, which is "nothing to push." diff -r 2212af23c9de -r 59a168019255 mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Wed Sep 05 23:58:43 2012 +0900 +++ b/mercurial/hgweb/common.py Wed Sep 05 23:59:27 2012 +0900 @@ -48,7 +48,7 @@ # and replayed scheme = req.env.get('wsgi.url_scheme') if hgweb.configbool('web', 'push_ssl', True) and scheme != 'https': - raise ErrorResponse(HTTP_OK, 'ssl required') + raise ErrorResponse(HTTP_FORBIDDEN, 'ssl required') deny = hgweb.configlist('web', 'deny_push') if deny and (not user or deny == ['*'] or user in deny): diff -r 2212af23c9de -r 59a168019255 tests/test-push-http.t --- a/tests/test-push-http.t Wed Sep 05 23:58:43 2012 +0900 +++ b/tests/test-push-http.t Wed Sep 05 23:59:27 2012 +0900 @@ -29,11 +29,9 @@ $ req pushing to http://localhost:$HGPORT/ searching for changes - remote: ssl required - remote: ssl required - updating cb9a9f314b8b to public failed! + abort: HTTP Error 403: ssl required % serve errors - [1] + [255] expect authorization error