tsl0922 / ttyd

Share your terminal over the web
https://tsl0922.github.io/ttyd
MIT License
8.02k stars 880 forks source link

^C does not work as expected when using lrzsz #282

Open ghost opened 4 years ago

ghost commented 4 years ago

Describe the bug

Environment:

Additional context

Related to #99

I thought lrzsz used Ctrl + X to cancel the action.

tsl0922 commented 4 years ago

You may need to press Ctrl + C multiple times, I'm not sure if it is an upstream bug.

tsl0922 commented 4 years ago

rttyd uses a custom protocol without crc check which isn't reliable, you may get corrupted data.

tsl0922 commented 4 years ago

I don't want to invent a new protocol for file transferring. someone may ssh to another host in a ttyd terminal, if ttyd uses a custom protocol, the user will need to install ttyd on the host to send/recv files.

zmodem is a standard protocol, which means it's package exists in most popular systems, and is easier to install. I agree that the user experience of zmodem on ttyd is not good for now, but I prefer to use it, and will keep improving it.

ghost commented 4 years ago

On the wire, Ctrl-C is not the method to cancel a Zmodem transfer, it is per the spec (see page 6) five ASCII CAN's (Ctrl-X).

Reading the issue, it sounds like Ctrl-C will cancel the zmodem.js UI part of the transfer, leaving the remote side still trying to send. Press Ctrl-X 5 or more times and that should terminate the remote (l)rzsz.

zmodem is a standard protocol, which means it's package exists in most popular systems, and is easier to install. I agree that the user experience of zmodem on ttyd is not good for now, but I prefer to use it, and will keep improving it.

Zmodem does have one drawback on today's systems: it cannot prevent either side from emitting the ssh termination sequence (\~.). It's not too likely to happen in the wild, but I usually ensure I do 'ssh -e none' when I know I might be using Zmodem in a session.

(Kermit can be made ssh-safe, and also terminates with three Ctrl-C's.)