Skip to content

Commit

Permalink
optimization webssh sz
Browse files Browse the repository at this point in the history
  • Loading branch information
leffss committed Mar 25, 2021
1 parent 6ba0f20 commit e12b314
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ systemctl start nginx


# 升级日志
### ver2.2.3
修复部分 linux 发行版 webssh 使用 sz 无法连续下载文件的问题;

### ver2.2.2
优化 supervisord 日志输出配置;

Expand Down
8 changes: 6 additions & 2 deletions apps/webssh/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,19 @@ def websocket_to_django(self):
try:
while 1:
if self.zmodemOO:
# 部分 lrzsz 版本(如 0.12.21rc),在 sz 结束后不会发送 b'OO',这样会导致
# 前端 zmodemjs 库认为 sz 下载未结束,故根据情况需要手动发送 b'OO'
self.zmodemOO = False
x = self.channel.recv(2)
if not len(x):
return

if x == b'OO':
self.websocker.send(bytes_data=x)
self.websocker.send(bytes_data=b'OO')
continue
else:
x += self.channel.recv(BufferSize)
self.websocker.send(bytes_data=b'OO')

else:
x = self.channel.recv(BufferSize)
if not len(x):
Expand Down

0 comments on commit e12b314

Please sign in to comment.