Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(deps): apply updates for hyper v1 #853

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

fix(deps): apply updates for hyper v1 #853

wants to merge 3 commits into from

Conversation

MichaIng
Copy link
Collaborator

@MichaIng MichaIng commented Jun 13, 2024

@ravenclaw900 I merged hyper and flexible-hyper-server-tls here, as well as my draft for needed code changes.

The hyper module structure has changed a little, and I should be able to fix/add all needed imports, but code-wise likely not, especially now that I see routes.rs needs to be updated as well.


@MichaIng MichaIng added dependencies Pull requests that update a dependency file rust Pull requests that update Rust code labels Jun 13, 2024
@MichaIng MichaIng requested a review from ravenclaw900 June 13, 2024 19:33
@MichaIng MichaIng force-pushed the hyperv1 branch 7 times, most recently from fb17cbd to 63d74fc Compare June 13, 2024 20:40
@MichaIng MichaIng force-pushed the hyperv1 branch 11 times, most recently from cecd38c to d7e05ae Compare June 16, 2024 17:49
@MichaIng
Copy link
Collaborator Author

MichaIng commented Jun 16, 2024

Here the updates I did:

  • General update of main.rs according to examples of flexible-hyper-server-tls and Hyper itself.
  • Request type => hyper::body::Incoming
  • Response type => http_body_util::combinators::BoxBody, needed to wrap the different responses we sent, IIUC
    • Used http_body_util's Full and Empty with bytes::Bytes accordingly, with functions suggested by Hyper examples.
  • http_body_util::BodyExt allowed a simple hyper::body::to_bytes replacement.

This is still missing:

  • Updating the websocket handler
  • We added the remote_addr to the info_span, passed to the router. I am however not sure if or whether it can be derived, and whether it is actually needed, or informational only? For now, I hardcoded it, just to leave that part in the code, and at least the build does not complain about it 😅.
  • There is some build warning about a "borrow of moved value" &req, which I do not understand. Switching to http_body_util::BodyExt's to_bytes() lead to &hyper::body::to_bytes(req.body_mut()).await? => &req.collect().await?.to_bytes(), with & still required, but there is another &req call, which seems to collide now. Not sure how to resolve this.

Signed-off-by: MichaIng <micha@dietpi.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
dependencies Pull requests that update a dependency file rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant