change max tls record size to make it look like complying https://tools.ietf.org/html/rfc8446\#section-5.2 instead of the section 5.1

This commit is contained in:
Alexander Bersenev
2019-08-17 14:42:49 +05:00
parent 015d0a2012
commit fdf5efe3d2

View File

@@ -430,7 +430,7 @@ class FakeTLSStreamWriter(LayeredStreamWriterBase):
self.upstream = upstream
def write(self, data, extra={}):
MAX_CHUNK_SIZE = 16384
MAX_CHUNK_SIZE = 16384 + 24
for start in range(0, len(data), MAX_CHUNK_SIZE):
end = min(start+MAX_CHUNK_SIZE, len(data))
self.upstream.write(b"\x17\x03\x03" + int.to_bytes(end-start, 2, "big"))