/
remote_passwd.t
67 lines (53 loc) · 1.04 KB
/
remote_passwd.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# vi:filetype=perl
use lib 'lib';
use Test::Nginx::Socket;
repeat_each(2);
plan tests => repeat_each() * (blocks() * 3);
worker_connections(128);
run_tests();
no_diff();
__DATA__
=== TEST 1: sanity
--- config
location /echo {
echo -n $remote_passwd;
}
--- more_headers
Authorization: Basic bW9udHk6c29tZV9wYXNz
--- request
GET /echo
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body chop
some_pass
--- timeout: 10
=== TEST 2: sanity (without Authorization header)
--- config
location /echo {
echo -n $remote_passwd;
}
--- request
GET /echo
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body:
--- timeout: 10
=== TEST 3: accessible from within lua
--- config
location /echo {
content_by_lua '
ngx.say(ngx.var.remote_passwd)
';
}
--- more_headers
Authorization: Basic bW9udHk6c29tZV9wYXNz
--- request
GET /echo
--- error_code: 200
--- response_headers
Content-Type: text/plain
--- response_body
some_pass
--- timeout: 10