Open MichaIng opened 5 months ago
Here the updates I did:
main.rs
according to examples of flexible-hyper-server-tls
and Hyper itself.hyper::body::Incoming
http_body_util::combinators::BoxBody
, needed to wrap the different responses we sent, IIUC
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:
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 😅.&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.
@ravenclaw900 I merged
hyper
andflexible-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.to_bytes
has been removed: https://github.com/hyperium/hyper/blob/0eb1b6c/CHANGELOG.md?plain=1#L298Body
structure has been removedconn
was previously defined asconn: &flexible_hyper_server_tls::HttpOrHttpsConnection
TheStill needed, can be done just like before.loop
at the bottom ofmain.rs
is not required anymore, right?