Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled header! #10

Closed
walirt opened this issue Mar 3, 2020 · 15 comments
Closed

Unhandled header! #10

walirt opened this issue Mar 3, 2020 · 15 comments

Comments

@walirt
Copy link

walirt commented Mar 3, 2020

I try to implement zmodem protocol using zmodemjs on websocket
And follow the zmodemjs documentation
But when I input rz and sz commands, I get an error. I do n’t know how to solve it.
Can you give me some suggestions or solutions?
Thank you

Platform and software version

Ubuntu 18.04.3 LTS
lrzsz version 0.12.21rc

Console error output

When running rz
image
When running sz
image

This problem has troubled me for a long time
Thanks again

@FGasper
Copy link
Owner

FGasper commented Mar 7, 2020

Best advice I can offer is to refer to existing implementations (e.g., ttyd). There’s also an example sz CLI implementation in the repo.

@walirt
Copy link
Author

walirt commented Mar 15, 2020

The code implementation completely refers to the existing implementation, but it still reports an error
Is this a back-end problem?

@FGasper
Copy link
Owner

FGasper commented Mar 15, 2020

Can you provide a test case that fails?

@walirt
Copy link
Author

walirt commented Mar 22, 2020

yes
the test case in this repository can reproduce this situation
you can enter rz and sz commands in the terminal
then you will find the error in the console
thanks

@FGasper
Copy link
Owner

FGasper commented Mar 22, 2020

Can you please rework that to a test case for this repository, some JS code that demonstrates how the library as it stands is behaving contrary to its documentation?

@walirt
Copy link
Author

walirt commented Mar 28, 2020

I found out why I didn't set the sender callback
I'm sorry
But then there's a new error. SZ sometimes returns an error
image
Does this mean that I need to send "OO" after saving the file to disk
Like this

Zmodem.Browser.save_to_disk(
xfer._spool,
xfer.get_details().name
)
that.ws.send(new Uint8Array([79, 79]))

@FGasper
Copy link
Owner

FGasper commented Mar 28, 2020

I’m closing this, as there hasn’t yet materialized a test case that shows a reproducible bug.

I do recognize that it’s hard to get use of this library correct. I’d also accept a PR to add examples of correct usage.

@FGasper FGasper closed this as completed Mar 28, 2020
@Lvyc1995
Copy link

Lvyc1995 commented Sep 9, 2020

@walirt Hello, I encountered the same problem as you, how did you solve it? Where do you mean to set the sender callback? How to solve the subsequent OO problem? Can you provide an simple example? thanks

@FGasper
Copy link
Owner

FGasper commented Sep 9, 2020

@Lvyc1995
Copy link

Lvyc1995 commented Sep 9, 2020

@xiaowang04821
Copy link

@walirt Hi,I encountered the same problem as you, Have you solved it, I want to see your example,thanks.

@Lvyc1995
Copy link

建议参考一下这个项目,逻辑是一样的:https://github.com/huyuan1999/django-webssh

@hessonsu
Copy link

I have solved the problem!
copy for example

let zsentry = new Zmodem.Sentry( {
to_terminal(octets) { .. }, //i.e. send to the terminal

sender(octets) { .. },  //i.e. send to the ZMODEM peer

on_detect(detection) { .. },  //for when Sentry detects a new ZMODEM

on_retract() { .. },  //for when Sentry retracts a Detection

} );

modify code
sender(octets) { websocket.send(new Uint8Array(octets) }

@walirt
Copy link
Author

walirt commented Oct 24, 2020

I have solved the problem!

copy for example
let zsentry = new Zmodem.Sentry( {
to_terminal(octets) { .. }, //i.e. send to the terminal

sender(octets) { .. },  //i.e. send to the ZMODEM peer

on_detect(detection) { .. },  //for when Sentry detects a new ZMODEM

on_retract() { .. },  //for when Sentry retracts a Detection

} );

modify code
sender(octets) { websocket.send(new Uint8Array(octets) }

My code is the same as yours, but it still reports errors
Uncaught PROTOCOL: Only thing after ZFIN should be “OO” (79,79)

@Lvyc1995
Copy link

Your back-end code needs to process the'OO' code returned by the server. This process requires the cooperation of the front and back ends.You can refer to this project: https://github.com/huyuan 1999/django-webssh, the relevant logic in ssh.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants