Skip to content

Commit

Permalink
修复下载问题
Browse files Browse the repository at this point in the history
  • Loading branch information
XiaoXianNv-boot committed Mar 5, 2024
1 parent 53d3032 commit eb9c1b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/APP/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def crul(ip,dk,dir,prin,new_client_socket,file):
if file != '':
fs = open(file,'wb')
while run == 0:
dowon = 0
try:
d = client.recv(10240000)
except Exception as e:
Expand All @@ -207,6 +208,7 @@ def crul(ip,dk,dir,prin,new_client_socket,file):
if dowscharcd == 0:
data = data + d
if len(data.split(b'\r\n\r\n')) > 1:
dowon = 1
for ddd in data.split(b'\r\n\r\n')[0].split(b'\r\n'):
dddd = ddd.split(b': ')
if dddd[0] == b'Content-Length':
Expand All @@ -218,10 +220,11 @@ def crul(ip,dk,dir,prin,new_client_socket,file):
cd = len(data[len(data.split(b'\r\n\r\n')[0])+4:])

else:
if cd == 0:
if dowon == 1:
cd = len(data[len(data.split(b'\r\n\r\n')[0])+4:])
datas = data[len(data.split(b'\r\n\r\n')[0])+4:]
fs.write(datas)
dowon = 0
else:
cd += len(d)
fs.write(d)
Expand Down

0 comments on commit eb9c1b4

Please sign in to comment.