Skip to content

Commit

Permalink
#2289 support brotli in html5 client
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@22644 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 6, 2019
1 parent f65c11e commit 75467a7
Show file tree
Hide file tree
Showing 3 changed files with 1,723 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,13 @@ XpraClient.prototype._make_hello_base = function() {
});
}

if(BrotliDecode) {
console.log("BROTLI!", BrotliDecode);
this._update_capabilities({
"brotli" : true,
});
}

if(this.encryption) {
this.cipher_in_caps = {
"cipher" : this.encryption,
Expand Down
6 changes: 5 additions & 1 deletion src/html5/js/Protocol.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2017 Antoine Martin <antoine@xpra.org>
* Copyright (c) 2013-2019 Antoine Martin <antoine@xpra.org>
* Copyright (c) 2016 David Brushinski <dbrushinski@spikes.com>
* Copyright (c) 2014 Joshua Higgins <josh@kxes.net>
* Copyright (c) 2015 Spikes, Inc.
Expand All @@ -14,6 +14,7 @@
* bencode.js
* inflate.js
* lz4.js
* brotli_decode.js
*/


Expand Down Expand Up @@ -311,6 +312,8 @@ XpraProtocol.prototype.do_process_receive_queue = function() {
this.protocol_error("failed to decompress lz4 data, error code: "+uncompressedSize);
return false;
}
} else if (level & 0x40) {
inflated = BrotliDecode(packet_data);
} else {
// zlib
var inflated = new Zlib.Inflate(packet_data).decompress();
Expand Down Expand Up @@ -480,6 +483,7 @@ if (!(typeof window == "object" && typeof document == "object" && window.documen
'lib/bencode.js',
'lib/zlib.js',
'lib/lz4.js',
'lib/brotli_decode.js',
'lib/forge.js');
// make protocol instance
var protocol = new XpraProtocol();
Expand Down
Loading

0 comments on commit 75467a7

Please sign in to comment.