tokio-rs / axum

Ergonomic and modular web framework built with Tokio, Tower, and Hyper
19.21k stars 1.06k forks source link

Update remaining examples to axum 0.7 #2356

Closed davidpdrsn closed 10 months ago

davidpdrsn commented 11 months ago

This tracks the examples that haven't yet been updated to axum 0.7:

rsdlt commented 11 months ago

Hi David, I'll have some time the next couple of weeks and would like to help with this one, if possible.

Cheers

davidpdrsn commented 11 months ago

Go ahead! Just post here which example you’re working on so others know.

takkuumi commented 11 months ago

I'll fix rest-grpc-multiplex example until tonic support http 1.0.

davidpdrsn commented 11 months ago

@takkuumi what do you mean? The example can't be updated yet.

takkuumi commented 11 months ago

@takkuumi what do you mean? The example can't be updated yet.

Not this mean, I’d wrote this example and I think that i can help on it.

davidpdrsn commented 11 months ago

I'm pretty sure the example can't be updated yet because tonic uses http 0.2 and axum now requires http 1.0. You can't convert requests/responses from 0.2 to 1.0 because extensions are totally opaque. Having to put a bunch of conversion code in an example isn't appropriate either.

I think people using axum with tonic will have to wait until tonic has been updated.

sam-kirby commented 11 months ago

It looks like the tls-graceful-shutdown example is missing from this list.

fan-tastic-z commented 11 months ago

axum 0.7 is really a big breaking

rsdlt commented 11 months ago

Go ahead! Just post here which example you’re working on so others know.

Thanks. Working on http-proxy first.

Will update here. Cheers.

erebe commented 11 months ago

Made a PR https://github.com/tokio-rs/axum/pull/2375 to update low-level-rustls and https://github.com/tokio-rs/axum/pull/2376 to update low-level-openssl

erebe commented 11 months ago

Made a PR https://github.com/tokio-rs/axum/pull/2384 to update tls-graceful-shutdown

markussilvan commented 11 months ago

Here's my shot at reverse_proxy example.

hanusek commented 11 months ago

https://github.com/tokio-rs/axum/blob/axum-v0.7.2/examples/tls-rustls/src/main.rs#L30 ?

prorealize commented 11 months ago

Not sure this is the best place to report as I see testing is already updated.

I run with the following when running the example testing (with 0.7.1 and fresh git pull)

$cargo test -p example-testing
   Compiling hyper-util v0.1.1
error[E0599]: no method named `with_retries` found for struct `TcpKeepalive` in the current scope
   --> .cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-util-0.1.1/src/client/legacy/connect/http.rs:130:12
    |
130 |         ka.with_retries(retries)
    |            ^^^^^^^^^^^^ help: there is a method with a similar name: `with_time`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `hyper-util` (lib) due to previous error
jplatte commented 11 months ago

Sounds like hyper-util has one of its dependency specifications wrong. cargo update should work around it.

gerardcl commented 11 months ago

@davidpdrsn I just realised I did update the only commit in the PR #2430 after you merged so the changes on the comments here https://github.com/gerardcl/axum/commit/93799cf24d56e9140ca2850b69716d59865002e0#diff-60c9dfa63b6f41b8064cb70bbde4726a91cc3895257ef8b6c39c73c46b223b8eR65 and here https://github.com/gerardcl/axum/commit/93799cf24d56e9140ca2850b69716d59865002e0#diff-60c9dfa63b6f41b8064cb70bbde4726a91cc3895257ef8b6c39c73c46b223b8eR75 , did not get in. Let me know if you want me to fix it somehow. Thanks!

davidpdrsn commented 11 months ago

The code looks okay to me https://github.com/tokio-rs/axum/blob/main/examples/reqwest-response/src/main.rs#L67. Am I missing something?

gerardcl commented 11 months ago

hi @davidpdrsn , that is correct, but not the comment above and below, see the difference in the links in my previous comment. The first comment would be still fine but not the second IMHO.

davidpdrsn commented 11 months ago

Ah I see. You're free to submit a PR to clean that up :)

davidpdrsn commented 10 months ago

I think I'll close this issue now for now. All examples except rest-grpc-multiplex has been updated and that is blocked by tonic being updated. Nothing really we can do about that here. Follow https://github.com/hyperium/tonic/issues/1579 for more updates.

Thanks to everyone who helped porting examples ❤️