-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathhandshake.t
107 lines (91 loc) · 1.96 KB
/
handshake.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
use Test::Nginx::Socket;
plan tests => 13;
log_level('debug');
run_tests();
__DATA__
=== TEST 1: websocket handshake
--- config
location /websockify {
websockify_pass 127.0.0.1:5901;
}
--- tcp_listen: 5901
--- tcp_reply: RFB
--- request
GET /websockify
--- more_headers
Origin:http://0
Sec-WebSocket-Key:n2wfgJF+qto2ahU4+aoNkQ==
Sec-WebSocket-Protocol:base64
Sec-WebSocket-Version:13
Upgrade:websocket
--- error_code: 101
--- response_headers
Connection:upgrade
Sec-WebSocket-Accept:avyE+tn9ibLdRUFx8CXeJlSusVA=
Sec-WebSocket-Protocol:base64
Upgrade:websocket
--- abort
=== TEST 2: bad upstream
--- config
location /websockify {
websockify_pass 127.0.0.1:5901;
}
--- request
GET /websockify
--- more_headers
Origin:http://0
Sec-WebSocket-Key:n2wfgJF+qto2ahU4+aoNkQ==
Sec-WebSocket-Protocol:base64
Sec-WebSocket-Version:13
Upgrade:websocket
--- error_code: 502
=== TEST 3: bad handshake header
--- config
location /websockify {
websockify_pass 127.0.0.1:5901;
}
--- tcp_listen: 5901
--- tcp_reply: RFB
--- request
GET /websockify
--- error_code: 400
--- abort
=== TEST 4: select protocol
--- config
location /websockify {
websockify_pass 127.0.0.1:5901;
}
--- tcp_listen: 5901
--- tcp_reply: RFB
--- request
GET /websockify
--- more_headers
Origin:http://0
Sec-WebSocket-Key:n2wfgJF+qto2ahU4+aoNkQ==
Sec-WebSocket-Protocol:base64, binary
Sec-WebSocket-Version:13
Upgrade:websocket
--- error_code: 101
--- response_headers
Connection:upgrade
Sec-WebSocket-Accept:avyE+tn9ibLdRUFx8CXeJlSusVA=
Sec-WebSocket-Protocol:binary
Upgrade:websocket
--- abort
=== TEST 5: unsupported protocol
--- config
location /websockify {
websockify_pass 127.0.0.1:5901;
}
--- tcp_listen: 5901
--- tcp_reply: RFB
--- request
GET /websockify
--- more_headers
Origin:http://0
Sec-WebSocket-Key:n2wfgJF+qto2ahU4+aoNkQ==
Sec-WebSocket-Protocol: unsupported
Sec-WebSocket-Version:13
Upgrade:websocket
--- error_code: 400
--- abort