1616#SANDBOX = "/tmp/webrepl/"
1717DEBUG = 0
1818
19- WEBREPL_FILE = "<2sBBQLH64s"
20-
19+ WEBREPL_REQ_S = "<2sBBQLH64s"
20+ WEBREPL_PUT_FILE = 1
21+ WEBREPL_GET_FILE = 2
2122
2223def debugmsg (msg ):
2324 if DEBUG :
@@ -102,7 +103,7 @@ def read_resp(ws):
102103def put_file (ws , local_file , remote_file ):
103104 sz = os .stat (local_file )[6 ]
104105 dest_fname = (SANDBOX + remote_file ).encode ("utf-8" )
105- rec = struct .pack (WEBREPL_FILE , b"WA" , 1 , 0 , 0 , sz , len (dest_fname ), dest_fname )
106+ rec = struct .pack (WEBREPL_REQ_S , b"WA" , WEBREPL_PUT_FILE , 0 , 0 , sz , len (dest_fname ), dest_fname )
106107 debugmsg ("%r %d" % (rec , len (rec )))
107108 ws .write (rec [:10 ])
108109 ws .write (rec [10 :])
@@ -122,7 +123,7 @@ def put_file(ws, local_file, remote_file):
122123
123124def get_file (ws , local_file , remote_file ):
124125 src_fname = (SANDBOX + remote_file ).encode ("utf-8" )
125- rec = struct .pack (WEBREPL_FILE , b"WA" , 2 , 0 , 0 , 0 , len (src_fname ), src_fname )
126+ rec = struct .pack (WEBREPL_REQ_S , b"WA" , WEBREPL_GET_FILE , 0 , 0 , 0 , len (src_fname ), src_fname )
126127 debugmsg ("%r %d" % (rec , len (rec )))
127128 ws .write (rec )
128129 assert read_resp (ws ) == 0
0 commit comments