Update axum/reqwest for hyper 1.0

This commit is contained in:
Damien Elmes 2024-07-06 18:45:32 +07:00
parent dca962c81e
commit 227f790d8e
10 changed files with 487 additions and 176 deletions

394
Cargo.lock generated
View file

@ -117,6 +117,7 @@ dependencies = [
"async-trait", "async-trait",
"axum", "axum",
"axum-client-ip", "axum-client-ip",
"axum-extra",
"blake3", "blake3",
"bytes", "bytes",
"chrono", "chrono",
@ -136,7 +137,7 @@ dependencies = [
"futures", "futures",
"hex", "hex",
"htmlescape", "htmlescape",
"hyper", "hyper 0.14.29",
"id_tree", "id_tree",
"inflections", "inflections",
"itertools 0.12.1", "itertools 0.12.1",
@ -155,7 +156,7 @@ dependencies = [
"pulldown-cmark 0.9.6", "pulldown-cmark 0.9.6",
"rand 0.8.5", "rand 0.8.5",
"regex", "regex",
"reqwest", "reqwest 0.12.5",
"rusqlite", "rusqlite",
"rustls-pemfile 2.1.2", "rustls-pemfile 2.1.2",
"scopeguard", "scopeguard",
@ -426,20 +427,20 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]] [[package]]
name = "axum" name = "axum"
version = "0.6.20" version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"axum-core", "axum-core",
"axum-macros", "axum-macros",
"bitflags 1.3.2",
"bytes", "bytes",
"futures-util", "futures-util",
"headers", "http 1.1.0",
"http 0.2.12", "http-body 1.0.0",
"http-body", "http-body-util",
"hyper", "hyper 1.4.0",
"hyper-util",
"itoa", "itoa",
"matchit", "matchit",
"memchr", "memchr",
@ -452,18 +453,19 @@ dependencies = [
"serde_json", "serde_json",
"serde_path_to_error", "serde_path_to_error",
"serde_urlencoded", "serde_urlencoded",
"sync_wrapper", "sync_wrapper 1.0.1",
"tokio", "tokio",
"tower", "tower",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
"tracing",
] ]
[[package]] [[package]]
name = "axum-client-ip" name = "axum-client-ip"
version = "0.4.2" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ef117890a418b7832678d9ea1e1c08456dd7b2fd1dadb9676cd6f0fe7eb4b21" checksum = "72188bed20deb981f3a4a9fe674e5980fd9e9c2bd880baa94715ad5d60d64c67"
dependencies = [ dependencies = [
"axum", "axum",
"forwarded-header-value", "forwarded-header-value",
@ -472,26 +474,53 @@ dependencies = [
[[package]] [[package]]
name = "axum-core" name = "axum-core"
version = "0.3.4" version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bytes", "bytes",
"futures-util", "futures-util",
"http 0.2.12", "http 1.1.0",
"http-body", "http-body 1.0.0",
"http-body-util",
"mime", "mime",
"pin-project-lite",
"rustversion", "rustversion",
"sync_wrapper 0.1.2",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
"tracing",
]
[[package]]
name = "axum-extra"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0be6ea09c9b96cb5076af0de2e383bd2bc0c18f827cf1967bdd353e0b910d733"
dependencies = [
"axum",
"axum-core",
"bytes",
"futures-util",
"headers 0.4.0",
"http 1.1.0",
"http-body 1.0.0",
"http-body-util",
"mime",
"pin-project-lite",
"serde",
"tower",
"tower-layer",
"tower-service",
"tracing",
] ]
[[package]] [[package]]
name = "axum-macros" name = "axum-macros"
version = "0.3.8" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdca6a10ecad987bda04e95606ef85a5417dcaac1a78455242d72e031e2b6b62" checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa"
dependencies = [ dependencies = [
"heck 0.4.1", "heck 0.4.1",
"proc-macro2", "proc-macro2",
@ -2469,13 +2498,28 @@ checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"bytes", "bytes",
"headers-core", "headers-core 0.2.0",
"http 0.2.12", "http 0.2.12",
"httpdate", "httpdate",
"mime", "mime",
"sha1", "sha1",
] ]
[[package]]
name = "headers"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "322106e6bd0cba2d5ead589ddb8150a13d7c4217cf80d7c4f682ca994ccc6aa9"
dependencies = [
"base64 0.21.7",
"bytes",
"headers-core 0.3.0",
"http 1.1.0",
"httpdate",
"mime",
"sha1",
]
[[package]] [[package]]
name = "headers-core" name = "headers-core"
version = "0.2.0" version = "0.2.0"
@ -2485,6 +2529,15 @@ dependencies = [
"http 0.2.12", "http 0.2.12",
] ]
[[package]]
name = "headers-core"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4"
dependencies = [
"http 1.1.0",
]
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.4.1" version = "0.4.1"
@ -2601,10 +2654,27 @@ dependencies = [
] ]
[[package]] [[package]]
name = "http-range-header" name = "http-body"
version = "0.3.1" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
dependencies = [
"bytes",
"http 1.1.0",
]
[[package]]
name = "http-body-util"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
dependencies = [
"bytes",
"futures-util",
"http 1.1.0",
"http-body 1.0.0",
"pin-project-lite",
]
[[package]] [[package]]
name = "http-types" name = "http-types"
@ -2657,7 +2727,7 @@ dependencies = [
"futures-util", "futures-util",
"h2", "h2",
"http 0.2.12", "http 0.2.12",
"http-body", "http-body 0.4.6",
"httparse", "httparse",
"httpdate", "httpdate",
"itoa", "itoa",
@ -2669,6 +2739,26 @@ dependencies = [
"want", "want",
] ]
[[package]]
name = "hyper"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http 1.1.0",
"http-body 1.0.0",
"httparse",
"httpdate",
"itoa",
"pin-project-lite",
"smallvec",
"tokio",
"want",
]
[[package]] [[package]]
name = "hyper-rustls" name = "hyper-rustls"
version = "0.24.2" version = "0.24.2"
@ -2677,10 +2767,29 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
dependencies = [ dependencies = [
"futures-util", "futures-util",
"http 0.2.12", "http 0.2.12",
"hyper", "hyper 0.14.29",
"rustls 0.21.12", "rustls 0.21.12",
"tokio", "tokio",
"tokio-rustls", "tokio-rustls 0.24.1",
]
[[package]]
name = "hyper-rustls"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
dependencies = [
"futures-util",
"http 1.1.0",
"hyper 1.4.0",
"hyper-util",
"rustls 0.23.10",
"rustls-native-certs",
"rustls-pki-types",
"tokio",
"tokio-rustls 0.26.0",
"tower-service",
"webpki-roots 0.26.3",
] ]
[[package]] [[package]]
@ -2690,12 +2799,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [ dependencies = [
"bytes", "bytes",
"hyper", "hyper 0.14.29",
"native-tls", "native-tls",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
] ]
[[package]]
name = "hyper-tls"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [
"bytes",
"http-body-util",
"hyper 1.4.0",
"hyper-util",
"native-tls",
"tokio",
"tokio-native-tls",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http 1.1.0",
"http-body 1.0.0",
"hyper 1.4.0",
"pin-project-lite",
"socket2",
"tokio",
"tower",
"tower-service",
"tracing",
]
[[package]] [[package]]
name = "iana-time-zone" name = "iana-time-zone"
version = "0.1.60" version = "0.1.60"
@ -3078,7 +3223,7 @@ dependencies = [
"mdbook", "mdbook",
"pulldown-cmark 0.8.0", "pulldown-cmark 0.8.0",
"regex", "regex",
"reqwest", "reqwest 0.11.27",
"serde", "serde",
"thiserror", "thiserror",
"url", "url",
@ -3094,7 +3239,7 @@ dependencies = [
"lazy_static", "lazy_static",
"linkcheck", "linkcheck",
"regex", "regex",
"reqwest", "reqwest 0.12.5",
"strum 0.26.3", "strum 0.26.3",
"tokio", "tokio",
] ]
@ -3404,16 +3549,15 @@ dependencies = [
[[package]] [[package]]
name = "multer" name = "multer"
version = "2.1.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b"
dependencies = [ dependencies = [
"bytes", "bytes",
"encoding_rs", "encoding_rs",
"futures-util", "futures-util",
"http 0.2.12", "http 1.1.0",
"httparse", "httparse",
"log",
"memchr", "memchr",
"mime", "mime",
"spin 0.9.8", "spin 0.9.8",
@ -4415,6 +4559,53 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "quinn"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad"
dependencies = [
"bytes",
"pin-project-lite",
"quinn-proto",
"quinn-udp",
"rustc-hash",
"rustls 0.23.10",
"thiserror",
"tokio",
"tracing",
]
[[package]]
name = "quinn-proto"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe"
dependencies = [
"bytes",
"rand 0.8.5",
"ring 0.17.8",
"rustc-hash",
"rustls 0.23.10",
"slab",
"thiserror",
"tinyvec",
"tracing",
]
[[package]]
name = "quinn-udp"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46"
dependencies = [
"libc",
"once_cell",
"socket2",
"tracing",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.36" version = "1.0.36"
@ -4693,10 +4884,54 @@ dependencies = [
"futures-util", "futures-util",
"h2", "h2",
"http 0.2.12", "http 0.2.12",
"http-body", "http-body 0.4.6",
"hyper", "hyper 0.14.29",
"hyper-rustls", "hyper-rustls 0.24.2",
"hyper-tls", "hyper-tls 0.5.0",
"ipnet",
"js-sys",
"log",
"mime",
"native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
"rustls 0.21.12",
"rustls-pemfile 1.0.4",
"serde",
"serde_json",
"serde_urlencoded",
"sync_wrapper 0.1.2",
"system-configuration",
"tokio",
"tokio-native-tls",
"tokio-rustls 0.24.1",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots 0.25.4",
"winreg 0.50.0",
]
[[package]]
name = "reqwest"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37"
dependencies = [
"base64 0.22.1",
"bytes",
"futures-core",
"futures-util",
"http 1.1.0",
"http-body 1.0.0",
"http-body-util",
"hyper 1.4.0",
"hyper-rustls 0.27.2",
"hyper-tls 0.6.0",
"hyper-util",
"ipnet", "ipnet",
"js-sys", "js-sys",
"log", "log",
@ -4706,17 +4941,18 @@ dependencies = [
"once_cell", "once_cell",
"percent-encoding", "percent-encoding",
"pin-project-lite", "pin-project-lite",
"rustls 0.21.12", "quinn",
"rustls 0.23.10",
"rustls-native-certs", "rustls-native-certs",
"rustls-pemfile 1.0.4", "rustls-pemfile 2.1.2",
"rustls-pki-types",
"serde", "serde",
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"sync_wrapper", "sync_wrapper 1.0.1",
"system-configuration",
"tokio", "tokio",
"tokio-native-tls", "tokio-native-tls",
"tokio-rustls", "tokio-rustls 0.26.0",
"tokio-socks", "tokio-socks",
"tokio-util", "tokio-util",
"tower-service", "tower-service",
@ -4725,8 +4961,8 @@ dependencies = [
"wasm-bindgen-futures", "wasm-bindgen-futures",
"wasm-streams", "wasm-streams",
"web-sys", "web-sys",
"webpki-roots 0.25.4", "webpki-roots 0.26.3",
"winreg 0.50.0", "winreg 0.52.0",
] ]
[[package]] [[package]]
@ -4806,7 +5042,7 @@ dependencies = [
"clap", "clap",
"flate2", "flate2",
"junction", "junction",
"reqwest", "reqwest 0.12.5",
"sha2", "sha2",
"tar", "tar",
"termcolor", "termcolor",
@ -4883,13 +5119,28 @@ dependencies = [
] ]
[[package]] [[package]]
name = "rustls-native-certs" name = "rustls"
version = "0.6.3" version = "0.23.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402"
dependencies = [
"once_cell",
"ring 0.17.8",
"rustls-pki-types",
"rustls-webpki 0.102.5",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-native-certs"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba"
dependencies = [ dependencies = [
"openssl-probe", "openssl-probe",
"rustls-pemfile 1.0.4", "rustls-pemfile 2.1.2",
"rustls-pki-types",
"schannel", "schannel",
"security-framework", "security-framework",
] ]
@ -5486,6 +5737,12 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
[[package]]
name = "sync_wrapper"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
[[package]] [[package]]
name = "synstructure" name = "synstructure"
version = "0.13.1" version = "0.13.1"
@ -5783,6 +6040,17 @@ dependencies = [
"tokio", "tokio",
] ]
[[package]]
name = "tokio-rustls"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
dependencies = [
"rustls 0.23.10",
"rustls-pki-types",
"tokio",
]
[[package]] [[package]]
name = "tokio-socks" name = "tokio-socks"
version = "0.5.1" version = "0.5.1"
@ -5885,17 +6153,15 @@ dependencies = [
[[package]] [[package]]
name = "tower-http" name = "tower-http"
version = "0.4.4" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"bytes", "bytes",
"futures-core", "http 1.1.0",
"futures-util", "http-body 1.0.0",
"http 0.2.12", "http-body-util",
"http-body",
"http-range-header",
"pin-project-lite", "pin-project-lite",
"tower-layer", "tower-layer",
"tower-service", "tower-service",
@ -6006,7 +6272,7 @@ dependencies = [
"hex", "hex",
"log", "log",
"once_cell", "once_cell",
"reqwest", "reqwest 0.11.27",
"sha2", "sha2",
"tempfile", "tempfile",
"url", "url",
@ -6352,9 +6618,9 @@ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
"futures-util", "futures-util",
"headers", "headers 0.3.9",
"http 0.2.12", "http 0.2.12",
"hyper", "hyper 0.14.29",
"log", "log",
"mime", "mime",
"mime_guess", "mime_guess",
@ -6885,6 +7151,16 @@ dependencies = [
"windows-sys 0.48.0", "windows-sys 0.48.0",
] ]
[[package]]
name = "winreg"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
dependencies = [
"cfg-if",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "wiremock" name = "wiremock"
version = "0.5.22" version = "0.5.22"
@ -6898,7 +7174,7 @@ dependencies = [
"futures", "futures",
"futures-timer", "futures-timer",
"http-types", "http-types",
"hyper", "hyper 0.14.29",
"log", "log",
"once_cell", "once_cell",
"regex", "regex",

View file

@ -60,8 +60,9 @@ apple-bundles = "0.17.0"
async-compression = { version = "0.4.11", features = ["zstd", "tokio"] } async-compression = { version = "0.4.11", features = ["zstd", "tokio"] }
async-stream = "0.3.5" async-stream = "0.3.5"
async-trait = "0.1.80" async-trait = "0.1.80"
axum = { version = "0.6.20", features = ["multipart", "macros", "headers"] } axum = { version = "0.7", features = ["multipart", "macros"] }
axum-client-ip = "0.4.2" axum-client-ip = "0.6"
axum-extra = { version = "0.9.3", features = ["typed-header"] }
blake3 = "1.5.1" blake3 = "1.5.1"
bytes = "1.6.0" bytes = "1.6.0"
camino = "1.1.7" camino = "1.1.7"
@ -109,7 +110,7 @@ pulldown-cmark = "0.9.6"
pyo3 = { version = "0.20.3", features = ["extension-module", "abi3", "abi3-py39"] } pyo3 = { version = "0.20.3", features = ["extension-module", "abi3", "abi3-py39"] }
rand = "0.8.5" rand = "0.8.5"
regex = "1.10.5" regex = "1.10.5"
reqwest = { version = "0.11.27", default-features = false, features = ["json", "socks", "stream", "multipart"] } reqwest = { version = "0.12", default-features = false, features = ["json", "socks", "stream", "multipart"] }
rusqlite = { version = "0.30.0", features = ["trace", "functions", "collation", "bundled"] } rusqlite = { version = "0.30.0", features = ["trace", "functions", "collation", "bundled"] }
rustls-pemfile = "2.1.2" rustls-pemfile = "2.1.2"
scopeguard = "1.2.0" scopeguard = "1.2.0"
@ -129,7 +130,7 @@ tempfile = "3.10.1"
termcolor = "1.4.1" termcolor = "1.4.1"
tokio = { version = "1.38", features = ["fs", "rt-multi-thread", "macros", "signal"] } tokio = { version = "1.38", features = ["fs", "rt-multi-thread", "macros", "signal"] }
tokio-util = { version = "0.7.11", features = ["io"] } tokio-util = { version = "0.7.11", features = ["io"] }
tower-http = { version = "0.4.4", features = ["trace"] } tower-http = { version = "0.5", features = ["trace"] }
tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] } tracing = { version = "0.1.40", features = ["max_level_trace", "release_max_level_debug"] }
tracing-appender = "0.2.3" tracing-appender = "0.2.3"
tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] } tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] }

View file

@ -226,7 +226,7 @@
}, },
{ {
"name": "axum", "name": "axum",
"version": "0.6.20", "version": "0.7.5",
"authors": null, "authors": null,
"repository": "https://github.com/tokio-rs/axum", "repository": "https://github.com/tokio-rs/axum",
"license": "MIT", "license": "MIT",
@ -235,7 +235,7 @@
}, },
{ {
"name": "axum-client-ip", "name": "axum-client-ip",
"version": "0.4.2", "version": "0.6.0",
"authors": null, "authors": null,
"repository": "https://github.com/imbolc/axum-client-ip", "repository": "https://github.com/imbolc/axum-client-ip",
"license": "MIT", "license": "MIT",
@ -244,16 +244,25 @@
}, },
{ {
"name": "axum-core", "name": "axum-core",
"version": "0.3.4", "version": "0.4.3",
"authors": null, "authors": null,
"repository": "https://github.com/tokio-rs/axum", "repository": "https://github.com/tokio-rs/axum",
"license": "MIT", "license": "MIT",
"license_file": null, "license_file": null,
"description": "Core types and traits for axum" "description": "Core types and traits for axum"
}, },
{
"name": "axum-extra",
"version": "0.9.3",
"authors": null,
"repository": "https://github.com/tokio-rs/axum",
"license": "MIT",
"license_file": null,
"description": "Extra utilities for axum"
},
{ {
"name": "axum-macros", "name": "axum-macros",
"version": "0.3.8", "version": "0.4.1",
"authors": null, "authors": null,
"repository": "https://github.com/tokio-rs/axum", "repository": "https://github.com/tokio-rs/axum",
"license": "MIT", "license": "MIT",
@ -1657,7 +1666,7 @@
}, },
{ {
"name": "headers", "name": "headers",
"version": "0.3.9", "version": "0.4.0",
"authors": "Sean McArthur <sean@seanmonstar.com>", "authors": "Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/headers", "repository": "https://github.com/hyperium/headers",
"license": "MIT", "license": "MIT",
@ -1666,7 +1675,7 @@
}, },
{ {
"name": "headers-core", "name": "headers-core",
"version": "0.2.0", "version": "0.3.0",
"authors": "Sean McArthur <sean@seanmonstar.com>", "authors": "Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/headers", "repository": "https://github.com/hyperium/headers",
"license": "MIT", "license": "MIT",
@ -1754,6 +1763,15 @@
"license_file": null, "license_file": null,
"description": "A set of types for representing HTTP requests and responses." "description": "A set of types for representing HTTP requests and responses."
}, },
{
"name": "http",
"version": "1.1.0",
"authors": "Alex Crichton <alex@alexcrichton.com>|Carl Lerche <me@carllerche.com>|Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/http",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "A set of types for representing HTTP requests and responses."
},
{ {
"name": "http-body", "name": "http-body",
"version": "0.4.6", "version": "0.4.6",
@ -1764,13 +1782,22 @@
"description": "Trait representing an asynchronous, streaming, HTTP request or response body." "description": "Trait representing an asynchronous, streaming, HTTP request or response body."
}, },
{ {
"name": "http-range-header", "name": "http-body",
"version": "0.3.1", "version": "1.0.0",
"authors": null, "authors": "Carl Lerche <me@carllerche.com>|Lucio Franco <luciofranco14@gmail.com>|Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/MarcusGrass/parse-range-headers", "repository": "https://github.com/hyperium/http-body",
"license": "MIT", "license": "MIT",
"license_file": null, "license_file": null,
"description": "No-dep range header parser" "description": "Trait representing an asynchronous, streaming, HTTP request or response body."
},
{
"name": "http-body-util",
"version": "0.1.2",
"authors": "Carl Lerche <me@carllerche.com>|Lucio Franco <luciofranco14@gmail.com>|Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/http-body",
"license": "MIT",
"license_file": null,
"description": "Combinators and adapters for HTTP request or response bodies."
}, },
{ {
"name": "http-types", "name": "http-types",
@ -1808,9 +1835,18 @@
"license_file": null, "license_file": null,
"description": "A fast and correct HTTP library." "description": "A fast and correct HTTP library."
}, },
{
"name": "hyper",
"version": "1.4.0",
"authors": "Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/hyper",
"license": "MIT",
"license_file": null,
"description": "A fast and correct HTTP library."
},
{ {
"name": "hyper-rustls", "name": "hyper-rustls",
"version": "0.24.2", "version": "0.27.2",
"authors": null, "authors": null,
"repository": "https://github.com/rustls/hyper-rustls", "repository": "https://github.com/rustls/hyper-rustls",
"license": "Apache-2.0 OR ISC OR MIT", "license": "Apache-2.0 OR ISC OR MIT",
@ -1819,13 +1855,22 @@
}, },
{ {
"name": "hyper-tls", "name": "hyper-tls",
"version": "0.5.0", "version": "0.6.0",
"authors": "Sean McArthur <sean@seanmonstar.com>", "authors": "Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/hyper-tls", "repository": "https://github.com/hyperium/hyper-tls",
"license": "Apache-2.0 OR MIT", "license": "Apache-2.0 OR MIT",
"license_file": null, "license_file": null,
"description": "Default TLS implementation for use with hyper" "description": "Default TLS implementation for use with hyper"
}, },
{
"name": "hyper-util",
"version": "0.1.6",
"authors": "Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/hyperium/hyper-util",
"license": "MIT",
"license_file": null,
"description": "hyper utilities"
},
{ {
"name": "iana-time-zone", "name": "iana-time-zone",
"version": "0.1.60", "version": "0.1.60",
@ -2269,9 +2314,9 @@
}, },
{ {
"name": "multer", "name": "multer",
"version": "2.1.0", "version": "3.1.0",
"authors": "Rousan Ali <hello@rousan.io>", "authors": "Rousan Ali <hello@rousan.io>",
"repository": "https://github.com/rousan/multer-rs", "repository": "https://github.com/rwf2/multer",
"license": "MIT", "license": "MIT",
"license_file": null, "license_file": null,
"description": "An async parser for `multipart/form-data` content-type in Rust." "description": "An async parser for `multipart/form-data` content-type in Rust."
@ -2915,6 +2960,33 @@
"license_file": null, "license_file": null,
"description": "VERY fast encoder/decoder for QOI (Quite Okay Image) format" "description": "VERY fast encoder/decoder for QOI (Quite Okay Image) format"
}, },
{
"name": "quinn",
"version": "0.11.2",
"authors": null,
"repository": "https://github.com/quinn-rs/quinn",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "Versatile QUIC transport protocol implementation"
},
{
"name": "quinn-proto",
"version": "0.11.3",
"authors": null,
"repository": "https://github.com/quinn-rs/quinn",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "State machine for the QUIC transport protocol"
},
{
"name": "quinn-udp",
"version": "0.5.2",
"authors": null,
"repository": "https://github.com/quinn-rs/quinn",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "UDP sockets with ECN information for the QUIC transport protocol"
},
{ {
"name": "quote", "name": "quote",
"version": "1.0.36", "version": "1.0.36",
@ -3151,7 +3223,7 @@
}, },
{ {
"name": "reqwest", "name": "reqwest",
"version": "0.11.27", "version": "0.12.5",
"authors": "Sean McArthur <sean@seanmonstar.com>", "authors": "Sean McArthur <sean@seanmonstar.com>",
"repository": "https://github.com/seanmonstar/reqwest", "repository": "https://github.com/seanmonstar/reqwest",
"license": "Apache-2.0 OR MIT", "license": "Apache-2.0 OR MIT",
@ -3230,15 +3302,6 @@
"license_file": null, "license_file": null,
"description": "Safe Rust bindings to POSIX/Unix/Linux/Winsock-like syscalls" "description": "Safe Rust bindings to POSIX/Unix/Linux/Winsock-like syscalls"
}, },
{
"name": "rustls",
"version": "0.21.12",
"authors": null,
"repository": "https://github.com/rustls/rustls",
"license": "Apache-2.0 OR ISC OR MIT",
"license_file": null,
"description": "Rustls is a modern TLS library written in Rust."
},
{ {
"name": "rustls", "name": "rustls",
"version": "0.22.4", "version": "0.22.4",
@ -3249,23 +3312,23 @@
"description": "Rustls is a modern TLS library written in Rust." "description": "Rustls is a modern TLS library written in Rust."
}, },
{ {
"name": "rustls-native-certs", "name": "rustls",
"version": "0.6.3", "version": "0.23.10",
"authors": null, "authors": null,
"repository": "https://github.com/ctz/rustls-native-certs", "repository": "https://github.com/rustls/rustls",
"license": "Apache-2.0 OR ISC OR MIT",
"license_file": null,
"description": "Rustls is a modern TLS library written in Rust."
},
{
"name": "rustls-native-certs",
"version": "0.7.1",
"authors": null,
"repository": "https://github.com/rustls/rustls-native-certs",
"license": "Apache-2.0 OR ISC OR MIT", "license": "Apache-2.0 OR ISC OR MIT",
"license_file": null, "license_file": null,
"description": "rustls-native-certs allows rustls to use the platform native certificate store" "description": "rustls-native-certs allows rustls to use the platform native certificate store"
}, },
{
"name": "rustls-pemfile",
"version": "1.0.4",
"authors": null,
"repository": "https://github.com/rustls/pemfile",
"license": "Apache-2.0 OR ISC OR MIT",
"license_file": null,
"description": "Basic .pem file parser for keys and certificates"
},
{ {
"name": "rustls-pemfile", "name": "rustls-pemfile",
"version": "2.1.2", "version": "2.1.2",
@ -3284,15 +3347,6 @@
"license_file": null, "license_file": null,
"description": "Shared types for the rustls PKI ecosystem" "description": "Shared types for the rustls PKI ecosystem"
}, },
{
"name": "rustls-webpki",
"version": "0.101.7",
"authors": null,
"repository": "https://github.com/rustls/webpki",
"license": "ISC",
"license_file": null,
"description": "Web PKI X.509 Certificate Verification."
},
{ {
"name": "rustls-webpki", "name": "rustls-webpki",
"version": "0.102.5", "version": "0.102.5",
@ -3383,15 +3437,6 @@
"license_file": null, "license_file": null,
"description": "A RAII scope guard that will run a given closure when it goes out of scope, even if the code between panics (assuming unwinding panic). Defines the macros `defer!`, `defer_on_unwind!`, `defer_on_success!` as shorthands for guards with one of the implemented strategies." "description": "A RAII scope guard that will run a given closure when it goes out of scope, even if the code between panics (assuming unwinding panic). Defines the macros `defer!`, `defer_on_unwind!`, `defer_on_success!` as shorthands for guards with one of the implemented strategies."
}, },
{
"name": "sct",
"version": "0.7.1",
"authors": "Joseph Birr-Pixton <jpixton@gmail.com>",
"repository": "https://github.com/rustls/sct.rs",
"license": "Apache-2.0 OR ISC OR MIT",
"license_file": null,
"description": "Certificate transparency SCT verification library"
},
{ {
"name": "security-framework", "name": "security-framework",
"version": "2.11.0", "version": "2.11.0",
@ -3788,6 +3833,15 @@
"license_file": null, "license_file": null,
"description": "A tool for enlisting the compilers help in proving the absence of concurrency" "description": "A tool for enlisting the compilers help in proving the absence of concurrency"
}, },
{
"name": "sync_wrapper",
"version": "1.0.1",
"authors": "Actyx AG <developer@actyx.io>",
"repository": "https://github.com/Actyx/sync_wrapper",
"license": "Apache-2.0",
"license_file": null,
"description": "A tool for enlisting the compiler's help in proving the absence of concurrency"
},
{ {
"name": "synstructure", "name": "synstructure",
"version": "0.13.1", "version": "0.13.1",
@ -3806,24 +3860,6 @@
"license_file": null, "license_file": null,
"description": "Simplified interface to libc::sysctl" "description": "Simplified interface to libc::sysctl"
}, },
{
"name": "system-configuration",
"version": "0.5.1",
"authors": "Mullvad VPN",
"repository": "https://github.com/mullvad/system-configuration-rs",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "Bindings to SystemConfiguration framework for macOS"
},
{
"name": "system-configuration-sys",
"version": "0.5.0",
"authors": "Mullvad VPN",
"repository": "https://github.com/mullvad/system-configuration-rs",
"license": "Apache-2.0 OR MIT",
"license_file": null,
"description": "Low level bindings to SystemConfiguration framework for macOS"
},
{ {
"name": "tch", "name": "tch",
"version": "0.15.0", "version": "0.15.0",
@ -3997,7 +4033,7 @@
}, },
{ {
"name": "tokio-rustls", "name": "tokio-rustls",
"version": "0.24.1", "version": "0.26.0",
"authors": null, "authors": null,
"repository": "https://github.com/rustls/tokio-rustls", "repository": "https://github.com/rustls/tokio-rustls",
"license": "Apache-2.0 OR MIT", "license": "Apache-2.0 OR MIT",
@ -4060,7 +4096,7 @@
}, },
{ {
"name": "tower-http", "name": "tower-http",
"version": "0.4.4", "version": "0.5.2",
"authors": "Tower Maintainers <team@tower-rs.com>", "authors": "Tower Maintainers <team@tower-rs.com>",
"repository": "https://github.com/tower-rs/tower-http", "repository": "https://github.com/tower-rs/tower-http",
"license": "MIT", "license": "MIT",
@ -4526,15 +4562,6 @@
"license_file": null, "license_file": null,
"description": "Drop-in replacement for std::time for Wasm in browsers" "description": "Drop-in replacement for std::time for Wasm in browsers"
}, },
{
"name": "webpki-roots",
"version": "0.25.4",
"authors": null,
"repository": "https://github.com/rustls/webpki-roots",
"license": "MPL-2.0",
"license_file": null,
"description": "Mozilla's CA root certificates for use with webpki"
},
{ {
"name": "webpki-roots", "name": "webpki-roots",
"version": "0.26.3", "version": "0.26.3",
@ -4861,7 +4888,7 @@
}, },
{ {
"name": "winreg", "name": "winreg",
"version": "0.50.0", "version": "0.52.0",
"authors": "Igor Shaula <gentoo90@gmail.com>", "authors": "Igor Shaula <gentoo90@gmail.com>",
"repository": "https://github.com/gentoo90/winreg-rs", "repository": "https://github.com/gentoo90/winreg-rs",
"license": "MIT", "license": "MIT",

View file

@ -47,6 +47,7 @@ async-compression.workspace = true
async-trait.workspace = true async-trait.workspace = true
axum.workspace = true axum.workspace = true
axum-client-ip.workspace = true axum-client-ip.workspace = true
axum-extra.workspace = true
blake3.workspace = true blake3.workspace = true
bytes.workspace = true bytes.workspace = true
chrono.workspace = true chrono.workspace = true

View file

@ -89,6 +89,7 @@ where
base_folder: base_folder.path().into(), base_folder: base_folder.path().into(),
ip_header: default_ip_header(), ip_header: default_ip_header(),
}) })
.await
.unwrap(); .unwrap();
tokio::spawn(server_fut.instrument(Span::current())); tokio::spawn(server_fut.instrument(Span::current()));
// when not using ephemeral servers, tests need to be serialized // when not using ephemeral servers, tests need to be serialized

View file

@ -269,7 +269,7 @@ mod test {
let mock_server = MockServer::start().await; let mock_server = MockServer::start().await;
Mock::given(method("POST")) Mock::given(method("POST"))
.and(path("/")) .and(path("/"))
.respond_with(ResponseTemplate::new(200).insert_header(ORIGINAL_SIZE.clone(), "0")) .respond_with(ResponseTemplate::new(200).insert_header(ORIGINAL_SIZE.as_str(), "0"))
.mount(&mock_server) .mount(&mock_server)
.await; .await;
let monitor = IoMonitor::new(); let monitor = IoMonitor::new();

View file

@ -9,9 +9,9 @@ mod user;
use std::collections::HashMap; use std::collections::HashMap;
use std::future::Future; use std::future::Future;
use std::future::IntoFuture;
use std::net::IpAddr; use std::net::IpAddr;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::net::TcpListener;
use std::path::Path; use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use std::pin::Pin; use std::pin::Pin;
@ -31,6 +31,7 @@ use snafu::whatever;
use snafu::OptionExt; use snafu::OptionExt;
use snafu::ResultExt; use snafu::ResultExt;
use snafu::Whatever; use snafu::Whatever;
use tokio::net::TcpListener;
use tracing::Span; use tracing::Span;
use crate::error; use crate::error;
@ -224,7 +225,7 @@ impl SimpleServer {
}) })
} }
pub fn make_server( pub async fn make_server(
config: SyncServerConfig, config: SyncServerConfig,
) -> error::Result<(SocketAddr, ServerFuture), Whatever> { ) -> error::Result<(SocketAddr, ServerFuture), Whatever> {
let server = Arc::new( let server = Arc::new(
@ -232,6 +233,7 @@ impl SimpleServer {
); );
let address = &format!("{}:{}", config.host, config.port); let address = &format!("{}:{}", config.host, config.port);
let listener = TcpListener::bind(address) let listener = TcpListener::bind(address)
.await
.with_whatever_context(|_| format!("couldn't bind to {address}"))?; .with_whatever_context(|_| format!("couldn't bind to {address}"))?;
let addr = listener.local_addr().unwrap(); let addr = listener.local_addr().unwrap();
let server = with_logging_layer( let server = with_logging_layer(
@ -242,12 +244,14 @@ impl SimpleServer {
.layer(DefaultBodyLimit::max(*MAXIMUM_SYNC_PAYLOAD_BYTES)) .layer(DefaultBodyLimit::max(*MAXIMUM_SYNC_PAYLOAD_BYTES))
.layer(config.ip_header.into_extension()), .layer(config.ip_header.into_extension()),
); );
let future = axum::Server::from_tcp(listener) let future = axum::serve(
.whatever_context("listen failed")? listener,
.serve(server.into_make_service_with_connect_info::<SocketAddr>()) server.into_make_service_with_connect_info::<SocketAddr>(),
.with_graceful_shutdown(async { )
let _ = tokio::signal::ctrl_c().await; .with_graceful_shutdown(async {
}); let _ = tokio::signal::ctrl_c().await;
})
.into_future();
tracing::info!(%addr, "listening"); tracing::info!(%addr, "listening");
Ok((addr, Box::pin(future))) Ok((addr, Box::pin(future)))
} }
@ -258,10 +262,10 @@ impl SimpleServer {
let config = envy::prefixed("SYNC_") let config = envy::prefixed("SYNC_")
.from_env::<SyncServerConfig>() .from_env::<SyncServerConfig>()
.whatever_context("reading SYNC_* env vars")?; .whatever_context("reading SYNC_* env vars")?;
let (_addr, server_fut) = SimpleServer::make_server(config)?; let (_addr, server_fut) = SimpleServer::make_server(config).await?;
server_fut.await.whatever_context("await server")?; server_fut.await.whatever_context("await server")?;
Ok(()) Ok(())
} }
} }
pub type ServerFuture = Pin<Box<dyn Future<Output = error::Result<(), hyper::Error>> + Send>>; pub type ServerFuture = Pin<Box<dyn Future<Output = error::Result<(), std::io::Error>> + Send>>;

View file

@ -7,11 +7,10 @@ use std::io::ErrorKind;
use std::marker::PhantomData; use std::marker::PhantomData;
use std::net::IpAddr; use std::net::IpAddr;
use axum::extract::BodyStream;
use axum::headers::Header;
use axum::headers::HeaderName;
use axum::headers::HeaderValue;
use axum::http::StatusCode; use axum::http::StatusCode;
use axum_extra::headers::Header;
use axum_extra::headers::HeaderName;
use axum_extra::headers::HeaderValue;
use bytes::Bytes; use bytes::Bytes;
use futures::Stream; use futures::Stream;
use futures::TryStreamExt; use futures::TryStreamExt;
@ -29,12 +28,14 @@ use crate::sync::request::MAXIMUM_SYNC_PAYLOAD_BYTES_UNCOMPRESSED;
use crate::sync::version::SyncVersion; use crate::sync::version::SyncVersion;
impl<T> SyncRequest<T> { impl<T> SyncRequest<T> {
pub(super) async fn from_header_and_stream( pub(super) async fn from_header_and_stream<S, E>(
sync_header: SyncHeader, sync_header: SyncHeader,
body_stream: BodyStream, body_stream: S,
ip: IpAddr, ip: IpAddr,
) -> HttpResult<SyncRequest<T>> ) -> HttpResult<SyncRequest<T>>
where where
S: Stream<Item = Result<Bytes, E>> + Unpin,
E: Display,
T: DeserializeOwned, T: DeserializeOwned,
{ {
sync_header.sync_version.ensure_supported()?; sync_header.sync_version.ensure_supported()?;
@ -132,7 +133,7 @@ impl Header for SyncHeader {
&SYNC_HEADER_NAME &SYNC_HEADER_NAME
} }
fn decode<'i, I>(values: &mut I) -> Result<Self, axum::headers::Error> fn decode<'i, I>(values: &mut I) -> Result<Self, axum_extra::headers::Error>
where where
Self: Sized, Self: Sized,
I: Iterator<Item = &'i HeaderValue>, I: Iterator<Item = &'i HeaderValue>,
@ -141,7 +142,7 @@ impl Header for SyncHeader {
.next() .next()
.and_then(|value| value.to_str().ok()) .and_then(|value| value.to_str().ok())
.and_then(|s| serde_json::from_str(s).ok()) .and_then(|s| serde_json::from_str(s).ok())
.ok_or_else(axum::headers::Error::invalid) .ok_or_else(axum_extra::headers::Error::invalid)
} }
fn encode<E: Extend<HeaderValue>>(&self, _values: &mut E) { fn encode<E: Extend<HeaderValue>>(&self, _values: &mut E) {

View file

@ -10,16 +10,15 @@ use std::marker::PhantomData;
use std::net::IpAddr; use std::net::IpAddr;
use async_trait::async_trait; use async_trait::async_trait;
use axum::extract::BodyStream; use axum::body::Body;
use axum::extract::FromRequest; use axum::extract::FromRequest;
use axum::extract::Multipart; use axum::extract::Multipart;
use axum::http::Request; use axum::http::Request;
use axum::http::StatusCode;
use axum::RequestPartsExt; use axum::RequestPartsExt;
use axum::TypedHeader;
use axum_client_ip::SecureClientIp; use axum_client_ip::SecureClientIp;
use axum_extra::TypedHeader;
use header_and_stream::SyncHeader; use header_and_stream::SyncHeader;
use hyper::Body;
use hyper::StatusCode;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use serde::Serialize; use serde::Serialize;
@ -127,9 +126,10 @@ where
let req = Request::from_parts(parts, body); let req = Request::from_parts(parts, body);
if let Some(TypedHeader(sync_header)) = sync_header { if let Some(TypedHeader(sync_header)) = sync_header {
let stream = BodyStream::from_request(req, state) let stream = Body::from_request(req, state)
.await .await
.expect("infallible"); .expect("infallible")
.into_data_stream();
SyncRequest::from_header_and_stream(sync_header, stream, ip).await SyncRequest::from_header_and_stream(sync_header, stream, ip).await
} else { } else {
let multi = Multipart::from_request(req, state) let multi = Multipart::from_request(req, state)

View file

@ -3,10 +3,10 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use axum::body::StreamBody; use axum::body::Body;
use axum::headers::HeaderName;
use axum::response::IntoResponse; use axum::response::IntoResponse;
use axum::response::Response; use axum::response::Response;
use axum_extra::headers::HeaderName;
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
use serde::Serialize; use serde::Serialize;
@ -39,7 +39,7 @@ impl<T> SyncResponse<T> {
pub fn make_response(self, sync_version: SyncVersion) -> Response { pub fn make_response(self, sync_version: SyncVersion) -> Response {
if sync_version.is_zstd() { if sync_version.is_zstd() {
let header = (&ORIGINAL_SIZE, self.data.len().to_string()); let header = (&ORIGINAL_SIZE, self.data.len().to_string());
let body = StreamBody::new(encode_zstd_body(self.data)); let body = Body::from_stream(encode_zstd_body(self.data));
([header], body).into_response() ([header], body).into_response()
} else { } else {
self.data.into_response() self.data.into_response()