Skip to content
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

update examples. #1033

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ jobs:
with:
tool: cargo-hack

- name: [test][linux][other]
- name: test-linux-other
if: matrix.target.os == 'ubuntu-latest'
run: |
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-other"

- name: [test][linux][xitca_test]
- name: test-linux-test
if: matrix.target.os == 'ubuntu-latest'
run: |
sudo bash -c "ulimit -Sl 512 && ulimit -Hl 512 && PATH=$PATH:/usr/share/rust/.cargo/bin && RUSTUP_TOOLCHAIN=${{ matrix.version }} cargo ci-test-test"
Expand Down
4 changes: 2 additions & 2 deletions examples/cloudflare-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ edition = "2021"
crate-type = ["cdylib"]

[dependencies]
xitca-web = { version = "0.4", default-features = false }
xitca-web = { version = "0.5", default-features = false }
xitca-unsafe-collection = "0.1"

http-file = { version = "0.1", default-features = false }

cfg-if = "1.0.0"
futures-core = "0.3"
rust-embed = "8"
worker = { version = "0.0.24", features = ["http"] }
worker = { version = "0.3.0", features = ["http"] }

[package.metadata.wasm-pack.profile.release]
wasm-opt = false
Expand Down
4 changes: 2 additions & 2 deletions examples/compression/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["compress-br", "compress-de", "compress-gz", "logger"] }
xitca-web = { version = "0.5", features = ["compress-br", "compress-de", "compress-gz", "logger"] }

tracing = "0.1"
tracing = "0.1"
2 changes: 1 addition & 1 deletion examples/cookie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["cookie"] }
xitca-web = { version = "0.5", features = ["cookie"] }
2 changes: 1 addition & 1 deletion examples/dependency-injection/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2021"

[dependencies]
xitca-web = "0.4"
xitca-web = "0.5"
2 changes: 1 addition & 1 deletion examples/error-handle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["codegen", "nightly"] }
xitca-web = { version = "0.5", features = ["codegen", "nightly"] }

thiserror = "1"
4 changes: 2 additions & 2 deletions examples/file/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["compress-br", "file", "logger"] }
xitca-web = { version = "0.5", features = ["compress-br", "file", "logger"] }

tracing = "0.1"
tracing = "0.1"
4 changes: 2 additions & 2 deletions examples/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-http = { version = "0.4", default-features = false, features = ["http2", "router"] }
xitca-server = "0.2"
xitca-http = { version = "0.5", default-features = false, features = ["http2", "router"] }
xitca-server = "0.3"
xitca-service = "0.1"

anyhow = "1.0.66"
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = "0.4"
xitca-web = "0.5"
4 changes: 2 additions & 2 deletions examples/io-uring/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-http = { version = "0.4", features = ["io-uring", "router", "rustls-uring"] }
xitca-server = { version = "0.2", features = ["io-uring"] }
xitca-http = { version = "0.5", features = ["io-uring", "router", "rustls-uring"] }
xitca-server = { version = "0.3", features = ["io-uring"] }
xitca-service = "0.1"

rcgen = "0.13"
Expand Down
2 changes: 1 addition & 1 deletion examples/macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["codegen", "logger"] }
xitca-web = { version = "0.5", features = ["codegen", "logger"] }

thiserror = "1"
tokio = { version = "1", features = ["macros", "rt"] }
Expand Down
10 changes: 5 additions & 5 deletions examples/multi-http-services/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-http = { version = "0.4", features = ["http2", "http3", "openssl", "rustls"] }
xitca-server = { version = "0.2", features = ["http3"] }
xitca-http = { version = "0.5", features = ["http2", "http3", "openssl", "rustls"] }
xitca-server = { version = "0.3", features = ["quic"] }
xitca-service = "0.1"

openssl = "0.10.44"
quinn = "0.10"
rustls = "0.21"
rustls-pemfile = "1.0.1"
quinn = { version = "0.11", features = ["ring"] }
rustls = "0.23"
rustls-pemfile = "2"
tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.16", default-features = false, features = ["env-filter", "fmt"] }
20 changes: 8 additions & 12 deletions examples/multi-http-services/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::{convert::Infallible, fs, io, sync::Arc};

use openssl::ssl::{AlpnError, SslAcceptor, SslFiletype, SslMethod};
use quinn::ServerConfig;
use rustls::{Certificate, PrivateKey};
use xitca_http::{
h1, h2, h3,
http::{const_header_value::TEXT_UTF8, header::CONTENT_TYPE, Request, RequestExt, Response, Version},
Expand Down Expand Up @@ -119,22 +118,19 @@ fn h3_config() -> io::Result<ServerConfig> {
let cert = fs::read("../cert/cert.pem")?;
let key = fs::read("../cert/key.pem")?;

let key = rustls_pemfile::pkcs8_private_keys(&mut &*key).unwrap().remove(0);
let key = PrivateKey(key);
let key = rustls_pemfile::pkcs8_private_keys(&mut &*key).next().unwrap().unwrap();
let key = quinn::rustls::pki_types::PrivateKeyDer::from(key);

let cert = rustls_pemfile::certs(&mut &*cert)
.unwrap()
.into_iter()
.map(Certificate)
.collect();
let cert = rustls_pemfile::certs(&mut &*cert).collect::<Result<_, _>>().unwrap();

let mut acceptor = rustls::ServerConfig::builder()
.with_safe_defaults()
let mut config = quinn::rustls::ServerConfig::builder()
.with_no_client_auth()
.with_single_cert(cert, key)
.unwrap();

acceptor.alpn_protocols = vec![b"h3".to_vec()];
config.alpn_protocols = vec![b"h3".to_vec()];

Ok(ServerConfig::with_crypto(Arc::new(acceptor)))
let config = quinn::crypto::rustls::QuicServerConfig::try_from(config).unwrap();

Ok(ServerConfig::with_crypto(Arc::new(config)))
}
2 changes: 1 addition & 1 deletion examples/multipart/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["logger", "multipart"] }
xitca-web = { version = "0.5", features = ["logger", "multipart"] }

tracing = { version = "0.1.40", default-features = false }
tracing-subscriber = { version = "0.3.16", default-features = false, features = ["env-filter", "fmt"] }
2 changes: 1 addition & 1 deletion examples/streaming/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2024"

[dependencies]
xitca-web = { version = "0.4", features = ["nightly"] }
xitca-web = { version = "0.5", features = ["nightly"] }
futures = "0.3"
async-stream = "0.3"
2 changes: 1 addition & 1 deletion examples/sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = "0.4"
xitca-web = "0.5"
2 changes: 1 addition & 1 deletion examples/tower-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["tower-http-compat"] }
xitca-web = { version = "0.5", features = ["tower-http-compat"] }

tower-http = { version = "0.5", features = ["fs", "compression-gzip"] }
2 changes: 1 addition & 1 deletion examples/unix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = "0.4"
xitca-web = "0.5"
2 changes: 1 addition & 1 deletion examples/wasi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = "0.4"
xitca-web = "0.5"
2 changes: 1 addition & 1 deletion examples/websocket/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = ["fakeshadow <[email protected]>"]
edition = "2021"

[dependencies]
xitca-web = { version = "0.4", features = ["websocket"] }
xitca-web = { version = "0.5", features = ["websocket"] }
Loading