-
Notifications
You must be signed in to change notification settings - Fork 38
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
Read only the http header #28
base: main
Are you sure you want to change the base?
Conversation
Hi @flx5, thanks for taking the time to contribute. I've been taking some time off but I'll look at this later this week. |
No worries. I've just realized that this branch also includes a few other changes (sorry about that):
If those are problematic for you I guess I can try to create patch files for each of those. Also a bit of background about why the change to reading the http request: The unpatched version read the following (on XCP-ng 8.2):
The To fix this only the http header should be read from the connection before passing the connection on to the vnc client. I haven't figured out how to avoid unbuffered reading though. Wrapping the connection in a bufio reader probably won't work because then the buffer contains the version string and the vnc client once again won't be capable of reading it directly from the tls connection. |
I took a longer break than expected, but I'm getting back on things this week and will review this soon. Apologies for the long delay. Your contribution is very much appreciated! |
Apologies once again but I've actually taken a look at your code this time :) @flx5 can we please split the firmware changes outside of this PR? It will be easier to review that way. As for the unbuffered reading, we should be able to accomplish that with Reader.Peek and Reader.ReadString. I've written this example below that compiles, but is untested. Please give that approach a try
|
|
||
vncClient, err := vnc.Client(tlsConn, &vnc.ClientConfig{Exclusive: true}) | ||
vncClient, err := vnc.Client(tlsConn, &vnc.ClientConfig{Exclusive: false}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you notice any bad behavior with the previous setting?
@@ -10,13 +10,11 @@ import ( | |||
"log" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the /* Heavily borrowed from builder/quemu/step_type_boot_command.go */
comment at the top of this file? That shouldn't be the case now that we are using the bootcommand
package :)
// Look for \r\n\r\n sequence. Everything after the HTTP Header is for the vnc client. | ||
|
||
builder := strings.Builder{} | ||
buffer := make([]byte, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment elsewhere with a git diff that shows how to avoid the unbuffered reading without consuming the buffer. Please give that a try.
I extracted the changes as-is from ddelnano#28.
The VNC client won't connect if the version string has already been read.