# HG changeset patch # User Arthur Lutz # Date 1353063126 -3600 # Node ID 01e1e44f1eb3ca2ccdd69d29f12839bc03c46e46 # Parent 001159e2e4f3be8283e197e8fec2ce4ab5c5381f [server] implement base_url with secure=True (closes #2508638) diff -r 001159e2e4f3 -r 01e1e44f1eb3 req.py --- a/req.py Fri Nov 16 11:41:38 2012 +0100 +++ b/req.py Fri Nov 16 11:52:06 2012 +0100 @@ -427,7 +427,7 @@ """return the root url of the instance """ if secure: - raise NotImplementedError() + return self.vreg.config.get('https-url', self.vreg.config['base-url']) return self.vreg.config['base-url'] # abstract methods to override according to the web front-end ############# diff -r 001159e2e4f3 -r 01e1e44f1eb3 test/unittest_rset.py --- a/test/unittest_rset.py Fri Nov 16 11:41:38 2012 +0100 +++ b/test/unittest_rset.py Fri Nov 16 11:52:06 2012 +0100 @@ -112,6 +112,17 @@ # '%stask/title/go' % baseurl) # empty _restpath should not crash self.compare_urls(req.build_url('view', _restpath=''), baseurl) + self.assertNotIn('https', req.build_url('view', vid='foo', rql='yo', + __secure__=True)) + try: + self.config.global_set_option('https-url', 'https://testing.fr/') + self.assertTrue('https', req.build_url('view', vid='foo', rql='yo', + __secure__=True)) + self.compare_urls(req.build_url('view', vid='foo', rql='yo', + __secure__=True), + '%sview?vid=foo&rql=yo' % req.base_url(secure=True)) + finally: + self.config.global_set_option('https-url', None) def test_build(self):