@@ -6,7 +6,7 @@ cleanup() {
66
77source " $root " /lib.bash
88
9- " $ghfs " -l 3003 -r " $fs " /vhost2 --archive /a --archive-dir " $fs " /vhost2/b --archive /c --auth /c/sub &
9+ " $ghfs " -l 3003 -r " $fs " /vhost2 --archive /a --archive-dir " $fs " /vhost2/b --archive /c --auth /c/sub -a :/hello: " $fs " /vhost1/hello -a :/world: " $fs " /vhost1/world --archive-user :/hello:alice --archive-dir-user : " $fs " /vhost1/world:bob --user alice:AliceSecret bob:BobSecret &
1010sleep 0.05 # wait server ready
1111cleanup
1212
@@ -32,5 +32,21 @@ curl_get_body 'http://127.0.0.1:3003/c/?tar' > "$archive"
3232(tar -tf " $archive " | grep -q ' ^sub/sub1.txt$' ) && fail " sub/sub1.txt should not in $( basename $archive ) "
3333(tar -tf " $archive " | grep -q ' ^sub/sub2.txt$' ) && fail " sub/sub1.txt should not in $( basename $archive ) "
3434
35+ assert $( curl_head_status ' http://127.0.0.1:3003/hello/?tar' ) ' 400'
36+ assert $( curl_head_status ' http://eve:EveSecret@127.0.0.1:3003/hello/?tar' ) ' 400'
37+ assert $( curl_head_status ' http://alice:WrongPass@127.0.0.1:3003/hello/?tar' ) ' 400'
38+ assert $( curl_head_status ' http://alice:AliceSecret@127.0.0.1:3003/hello/?tar' ) ' 200'
39+ archive=" $fs " /downloaded/hello.tar.tmp
40+ curl_get_body ' http://alice:AliceSecret@127.0.0.1:3003/hello/?tar' > " $archive "
41+ (tar -tf " $archive " | grep -q ' ^index.txt$' ) || fail " index.txt should in $( basename $archive ) "
42+
43+ assert $( curl_head_status ' http://127.0.0.1:3003/world/?tar' ) ' 400'
44+ assert $( curl_head_status ' http://eve:EveSecret@127.0.0.1:3003/world/?tar' ) ' 400'
45+ assert $( curl_head_status ' http://bob:WrongPass@127.0.0.1:3003/world/?tar' ) ' 400'
46+ assert $( curl_head_status ' http://bob:BobSecret@127.0.0.1:3003/world/?tar' ) ' 200'
47+ archive=" $fs " /downloaded/world.tar.tmp
48+ curl_get_body ' http://bob:BobSecret@127.0.0.1:3003/world/?tar' > " $archive "
49+ (tar -tf " $archive " | grep -q ' ^index.txt$' ) || fail " index.txt should in $( basename $archive ) "
50+
3551cleanup
3652jobs -p | xargs kill & > /dev/null
0 commit comments