3 <title>test proxied ws connection
</title>
5 <script type=
"text/javascript">
6 // Do connection test and check the headers arrive at the WebSocket.
8 var protocol
= location
.protocol
.replace('http', 'ws');
9 var url
= protocol
+ '//' + location
.host
+ '/echo-request-headers';
10 var ws
= new WebSocket(url
);
12 ws
.onmessage = function(evt
)
14 var headers
= JSON
.parse(evt
.data
);
15 for (var name
in headers
) {
16 // The keys in the serialized data are lower cased.
17 if (name
.startsWith('proxy-')) {
18 document
.title
= 'FAIL';
23 // Set document title to 'PASS'. The test observer catches this title changes
24 // to know the result.
25 document
.title
= 'PASS';
28 ws
.onclose = function()
30 document
.title
= 'FAIL';