programatik29 / axum-server

High level server designed to be used with axum framework.
MIT License
166 stars 54 forks source link

axum-server rustls & openssl tests don't compile #104

Closed eric-seppanen closed 6 months ago

eric-seppanen commented 6 months ago

It looks like there's some pre-1.0 hyper code in the tests for code using the tls-rustls and tls-openssl features.

axum-server$ cargo test -q --all-features
error[E0432]: unresolved imports `hyper::client::conn::handshake`, `hyper::client::conn::SendRequest`, `hyper::Body`
   --> src/tls_rustls/mod.rs:363:24
    |
363 |         client::conn::{handshake, SendRequest},
    |                        ^^^^^^^^^  ^^^^^^^^^^^ no `SendRequest` in `client::conn`
    |                        |
    |                        no `handshake` in `client::conn`
364 |         Body,
    |         ^^^^
    |         |
    |         no `Body` in the root
    |         help: a similar name exists in the module: `body`
    |
    = help: consider importing this module instead:
            rustls::internal::msgs::handshake
    = help: consider importing one of these items instead:
            hyper::client::conn::http1::SendRequest
            hyper::client::conn::http2::SendRequest
    = help: consider importing one of these items instead:
            axum::body::Body
            http_body::Body
            hyper::body::Body

error[E0432]: unresolved imports `rustls::client::ServerCertVerified`, `rustls::client::ServerCertVerifier`
   --> src/tls_rustls/mod.rs:367:18
    |
367 |         client::{ServerCertVerified, ServerCertVerifier},
    |                  ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^ no `ServerCertVerifier` in `client`
    |                  |
    |                  no `ServerCertVerified` in `client`
    |
note: found an item that was configured out
   --> /home/eric/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.21.10/src/lib.rs:436:65
    |
436 |         CertificateTransparencyPolicy, HandshakeSignatureValid, ServerCertVerified,
    |                                                                 ^^^^^^^^^^^^^^^^^^
    = note: the item is gated behind the `dangerous_configuration` feature
note: found an item that was configured out
   --> /home/eric/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.21.10/src/lib.rs:437:9
    |
437 |         ServerCertVerifier, WebPkiVerifier,
    |         ^^^^^^^^^^^^^^^^^^
    = note: the item is gated behind the `dangerous_configuration` feature

error[E0432]: unresolved imports `hyper::client::conn::handshake`, `hyper::client::conn::SendRequest`, `hyper::Body`
   --> src/tls_openssl/mod.rs:332:24
    |
332 |         client::conn::{handshake, SendRequest},
    |                        ^^^^^^^^^  ^^^^^^^^^^^ no `SendRequest` in `client::conn`
    |                        |
    |                        no `handshake` in `client::conn`
333 |         Body,
    |         ^^^^
    |         |
    |         no `Body` in the root
    |         help: a similar name exists in the module: `body`
    |
    = help: consider importing this module instead:
            rustls::internal::msgs::handshake
    = help: consider importing one of these items instead:
            hyper::client::conn::http1::SendRequest
            hyper::client::conn::http2::SendRequest
    = help: consider importing one of these items instead:
            axum::body::Body
            http_body::Body
            hyper::body::Body

error[E0425]: cannot find function `to_bytes` in module `hyper::body`
   --> src/tls_rustls/mod.rs:593:33
    |
593 |         let body = hyper::body::to_bytes(body).await.unwrap();
    |                                 ^^^^^^^^ not found in `hyper::body`
    |
help: consider importing this function
    |
355 +     use axum::body::to_bytes;
    |
help: if you import `to_bytes`, refer to it directly
    |
593 -         let body = hyper::body::to_bytes(body).await.unwrap();
593 +         let body = to_bytes(body).await.unwrap();
    |

error[E0425]: cannot find function `to_bytes` in module `hyper::body`
   --> src/tls_openssl/mod.rs:535:33
    |
535 |         let body = hyper::body::to_bytes(body).await.unwrap();
    |                                 ^^^^^^^^ not found in `hyper::body`
    |
help: consider importing this function
    |
324 +     use axum::body::to_bytes;
    |
help: if you import `to_bytes`, refer to it directly
    |
535 -         let body = hyper::body::to_bytes(body).await.unwrap();
535 +         let body = to_bytes(body).await.unwrap();
    |

Some errors have detailed explanations: E0425, E0432.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `axum-server` (lib test) due to 5 previous errors
abs0luty commented 6 months ago

Thanks for pointing this out. I will fix it today.