From cde806846bf6afb5979b1d588ea00be2cacb4673 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 9 Jan 2013 14:57:17 +0100 Subject: test: Add test case for Dav not handling redirections Updated to master by Ondrej Holy . https://gitlab.gnome.org/GNOME/gvfs/issues/177 --- test/gvfs-test | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/gvfs-test b/test/gvfs-test index 8beb7266..8839baf2 100755 --- a/test/gvfs-test +++ b/test/gvfs-test @@ -1386,7 +1386,7 @@ class Dav(GvfsTestCase): # some distros have some extra modules which we need to load modules = '' - for m in ['authn_core', 'authz_core', 'authz_user', 'auth_basic', + for m in ['alias', 'authn_core', 'authz_core', 'authz_user', 'auth_basic', 'authn_file', 'mpm_prefork', 'unixd', 'dav', 'dav_fs', 'ssl']: if os.path.exists(os.path.join(klass.mod_dir, 'mod_%s.so' % m)): modules += 'LoadModule %s_module %s/mod_%s.so\n' % (m, klass.mod_dir, m) @@ -1420,6 +1420,11 @@ DAVLockDB DAVLock AuthUserFile htpasswd Require valid-user + +Redirect temp /public_tmpredir /public +Redirect permanent /public_permredir /public +Redirect temp /secret_tmpredir /secret +Redirect permanent /secret_permredir /secret ''' % {'mod_dir': klass.mod_dir, 'root': klass.httpd_sandbox, 'modules': modules, 'mydir': my_dir}) # start server @@ -1489,6 +1494,14 @@ DAVLockDB DAVLock subprocess.check_call(['gio', 'mount', uri]) self.do_mount_check(uri, 'hello.txt', 'hi\n') + def test_http_noauth_redirect(self): + '''dav://localhost without credentials and server redirection''' + + for d in ['public_permredir', 'public_tmpredir']: + uri = 'dav://localhost:8088/' + d + subprocess.check_call(['gio', 'mount', uri]) + self.do_mount_check(uri, 'hello.txt', 'hi\n') + def test_https_noauth(self): '''davs://localhost without credentials''' @@ -1527,6 +1540,23 @@ DAVLockDB DAVLock self.do_mount_check(uri, 'restricted.txt', 'dont tell anyone\n') + def test_http_auth_redirect(self): + '''dav://localhost with credentials and server redirection''' + + for d in ['secret_tmpredir', 'secret_permredir']: + uri = 'dav://localhost:8088/' + d + + mount = subprocess.Popen(['gio', 'mount', uri], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + + (out, err) = mount.communicate(b's3kr1t\n') + self.assertEqual(mount.returncode, 0) + self.assertEqual(err, b'') + + self.do_mount_check(uri, 'restricted.txt', 'dont tell anyone\n') + def test_https_auth(self): '''davs://localhost with credentials''' -- cgit v1.2.1