Skip to content

Commit 8135bb4

Browse files
author
Paul Sokolovsky
committed
webrepl_cli.py: Switch to 32-bit length field.
1 parent 8dc5bfb commit 8135bb4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

webrepl_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#SANDBOX = "/tmp/webrepl/"
1616

1717

18-
WEBREPL_FILE = "<3sBBBHQH64s"
18+
WEBREPL_FILE = "<2sBBQLH64s"
1919

2020
if USE_BUILTIN_WEBSOCKET:
2121
from websocket import websocket
@@ -85,7 +85,7 @@ def read_resp(ws):
8585
def put_file(ws, local_file, remote_file):
8686
sz = os.stat(local_file)[6]
8787
dest_fname = bytes(SANDBOX + remote_file, "utf-8")
88-
rec = struct.pack(WEBREPL_FILE, b"WRA", 1, 0, 0, sz, 0, len(dest_fname), dest_fname)
88+
rec = struct.pack(WEBREPL_FILE, b"WA", 1, 0, 0, sz, len(dest_fname), dest_fname)
8989
print(rec, len(rec))
9090
ws.write(rec[:10])
9191
ws.write(rec[10:])
@@ -100,7 +100,7 @@ def put_file(ws, local_file, remote_file):
100100

101101
def get_file(ws, local_file, remote_file):
102102
src_fname = bytes(SANDBOX + remote_file, "utf-8")
103-
rec = struct.pack(WEBREPL_FILE, b"WRA", 2, 0, 0, 0, 0, len(src_fname), src_fname)
103+
rec = struct.pack(WEBREPL_FILE, b"WA", 2, 0, 0, 0, len(src_fname), src_fname)
104104
print(rec, len(rec))
105105
ws.write(rec)
106106
assert read_resp(ws) == 0

0 commit comments

Comments
 (0)