]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Always include ID marker in repeater protocol
authorPierre Ossman <ossman@cendio.se>
Sat, 14 Oct 2017 11:02:40 +0000 (13:02 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 9 Nov 2017 11:52:05 +0000 (12:52 +0100)
This makes sure we're always following the protocol, and the caller
doesn't have to care about the details.

core/rfb.js
tests/test.rfb.js

index 2fe251c2b9d96977b6d312676f154d1efca8b1c7..5b79d3c823c0e5026841b28588d9de7bb9e1f945 100644 (file)
@@ -732,7 +732,7 @@ RFB.prototype = {
         }
 
         if (is_repeater) {
-            var repeaterID = this._repeaterID;
+            var repeaterID = "ID:" + this._repeaterID;
             while (repeaterID.length < 250) {
                 repeaterID += "\0";
             }
index 9e606122aee9bba8133186d24923bc4515859064..9ccc2fad5d7a5041cef206280b1d1e95836f990e 100644 (file)
@@ -582,12 +582,12 @@ describe('Remote Frame Buffer Protocol Client', function() {
                 });
 
                 it('should interpret version 000.000 as a repeater', function () {
-                    client._repeaterID = '\x01\x02\x03\x04\x05';
+                    client._repeaterID = '12345';
                     send_ver('000.000', client);
                     expect(client._rfb_version).to.equal(0);
 
                     var sent_data = client._sock._websocket._get_sent_data();
-                    expect(new Uint8Array(sent_data.buffer, 0, 5)).to.array.equal(new Uint8Array([1, 2, 3, 4, 5]));
+                    expect(new Uint8Array(sent_data.buffer, 0, 9)).to.array.equal(new Uint8Array([73, 68, 58, 49, 50, 51, 52, 53, 0]));
                 });
 
                 it('should interpret version 003.003 as version 3.3', function () {
@@ -638,12 +638,12 @@ describe('Remote Frame Buffer Protocol Client', function() {
             });
 
             it('should handle two step repeater negotiation', function () {
-                client._repeaterID = '\x01\x02\x03\x04\x05';
+                client._repeaterID = '12345';
 
                 send_ver('000.000', client);
                 expect(client._rfb_version).to.equal(0);
                 var sent_data = client._sock._websocket._get_sent_data();
-                expect(new Uint8Array(sent_data.buffer, 0, 5)).to.array.equal(new Uint8Array([1, 2, 3, 4, 5]));
+                expect(new Uint8Array(sent_data.buffer, 0, 9)).to.array.equal(new Uint8Array([73, 68, 58, 49, 50, 51, 52, 53, 0]));
                 expect(sent_data).to.have.length(250);
 
                 send_ver('003.008', client);