Encryption suppport for wstest.
This commit is contained in:
parent
95ef30a167
commit
f8ee7b489d
12
wstest.html
12
wstest.html
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
Host: <input id='host' style='width:100'>
|
Host: <input id='host' style='width:100'>
|
||||||
Port: <input id='port' style='width:50'>
|
Port: <input id='port' style='width:50'>
|
||||||
|
Encrypt: <input id='encrypt' type='checkbox'>
|
||||||
Send Delay (ms): <input id='sendDelay' style='width:50' value="100">
|
Send Delay (ms): <input id='sendDelay' style='width:50' value="100">
|
||||||
<input id='connectButton' type='button' value='Start' style='width:100px'
|
<input id='connectButton' type='button' value='Start' style='width:100px'
|
||||||
onclick="connect();">
|
onclick="connect();">
|
||||||
|
@ -151,9 +152,17 @@
|
||||||
|
|
||||||
function init_ws() {
|
function init_ws() {
|
||||||
console.log(">> init_ws");
|
console.log(">> init_ws");
|
||||||
var uri = "ws://" + host + ":" + port;
|
var scheme = "ws://";
|
||||||
|
if ($('encrypt').checked) {
|
||||||
|
scheme = "wss://";
|
||||||
|
}
|
||||||
|
var uri = scheme + host + ":" + port + "/?b64encode";
|
||||||
|
//if (RFB.use_seq) {
|
||||||
|
// uri += "&seq_num";
|
||||||
|
//}
|
||||||
console.log("connecting to " + uri);
|
console.log("connecting to " + uri);
|
||||||
ws = new WebSocket(uri);
|
ws = new WebSocket(uri);
|
||||||
|
|
||||||
ws.onmessage = function(e) {
|
ws.onmessage = function(e) {
|
||||||
//console.log(">> WebSockets.onmessage");
|
//console.log(">> WebSockets.onmessage");
|
||||||
check_respond(e.data);
|
check_respond(e.data);
|
||||||
|
@ -206,6 +215,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$clear(update_ref);
|
$clear(update_ref);
|
||||||
|
recv_cnt = 0;
|
||||||
update_stats(); // Final numbers
|
update_stats(); // Final numbers
|
||||||
|
|
||||||
$('connectButton').value = "Start";
|
$('connectButton').value = "Start";
|
||||||
|
|
|
@ -85,8 +85,7 @@ def generate():
|
||||||
data = "^%d:%d:%d:%s$" % (send_cnt, length, chksum, nums)
|
data = "^%d:%d:%d:%s$" % (send_cnt, length, chksum, nums)
|
||||||
send_cnt += 1
|
send_cnt += 1
|
||||||
|
|
||||||
buf = "\x00" + b64encode(data) + "\xff"
|
return encode(data)
|
||||||
return buf
|
|
||||||
|
|
||||||
def responder(client, delay=10):
|
def responder(client, delay=10):
|
||||||
global errors
|
global errors
|
||||||
|
|
Loading…
Reference in New Issue