Skip to content

Commit

Permalink
just remove legacy mode, clients should have been updated by now
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@26615 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Jun 4, 2020
1 parent 6d6fe62 commit 731b777
Showing 1 changed file with 3 additions and 41 deletions.
44 changes: 3 additions & 41 deletions src/xpra/net/websockets/protocol.py
@@ -1,5 +1,5 @@
# This file is part of Xpra.
# Copyright (C) 2019 Antoine Martin <antoine@xpra.org>
# Copyright (C) 2019-2020 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

Expand Down Expand Up @@ -29,9 +29,6 @@
OPCODE_PONG : "pong",
}

#default to legacy mode until we parse the remote caps:
#(this can be removed in the future once all html5 clients have been updated)
LEGACY_FRAME_PER_CHUNK = envbool("XPRA_WEBSOCKET_LEGACY", False)
MASK = envbool("XPRA_WEBSOCKET_MASK", False)


Expand All @@ -48,12 +45,8 @@ def __init__(self, *args, **kwargs):
self.ws_payload_opcode = 0
self.ws_mask = MASK
self._process_read = self.parse_ws_frame
self.legacy_frame_per_chunk = LEGACY_FRAME_PER_CHUNK in (None, True)
if self.legacy_frame_per_chunk:
self.make_chunk_header = self.make_wschunk_header
else:
self.make_chunk_header = self.make_xpra_header
self.make_frame_header = self.make_wsframe_header
self.make_chunk_header = self.make_xpra_header
self.make_frame_header = self.make_wsframe_header

def __repr__(self):
return "WebSocket(%s)" % self._conn
Expand All @@ -64,37 +57,6 @@ def close(self):
self.ws_payload = []


def get_info(self, alias_info=True):
info = super().get_info(alias_info)
info["legacy-frames"] = self.legacy_frame_per_chunk
return info


def parse_remote_caps(self, caps):
super().parse_remote_caps(caps)
if LEGACY_FRAME_PER_CHUNK is None:
may_have_bug = caps.strget("client_type", "")=="HTML5"
self.legacy_frame_per_chunk = not caps.boolget("websocket.multi-packet", not may_have_bug)
log("parse_remote_caps() may_have_bug=%s, legacy_frame_per_chunk=%s",
may_have_bug, self.legacy_frame_per_chunk)
if self.legacy_frame_per_chunk:
log.warn("Warning: using slower legacy websocket frames")
log.warn(" the other end is probably out of date")
#websocker header for every chunk:
self.make_chunk_header = self.make_wschunk_header
#no frame header:
self.make_frame_header = self.noframe_header
else:
#just the regular xpra header for each chunk:
self.make_chunk_header = self.make_xpra_header
#and one websocket header for all the chunks:
self.make_frame_header = self.make_wsframe_header

def make_wschunk_header(self, packet_type, proto_flags, level, index, payload_size):
header = super().make_xpra_header(packet_type, proto_flags, level, index, payload_size)
log("make_wschunk_header(%s)", (packet_type, proto_flags, level, index, payload_size))
return encode_hybi_header(OPCODE_BINARY, payload_size+len(header))+header

def make_wsframe_header(self, packet_type, items):
payload_len = sum(len(item) for item in items)
log("make_wsframe_header(%s, %i items) %i bytes, ms_mask=%s",
Expand Down

0 comments on commit 731b777

Please sign in to comment.