Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/msrv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
- http-cache-surf
- http-cache-ureq
- http-cache-tower
- http-cache-tower-server
- http-cache-quickcache
steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
resolver = "2"
resolver = "3"
members = [
"http-cache",
"http-cache-reqwest",
Expand Down
7 changes: 7 additions & 0 deletions http-cache-quickcache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [Unreleased]

### Changed

- Migrated to the 2024 edition, which requires Rust 1.85.0 or newer
- MSRV lowered from 1.90.0 to 1.89.0. `rust-version` now covers default features resolved with `resolver = "3"`; see the MSRV policy in the README

## [1.0.0-alpha.8] - 2026-09-08

### Changed
Expand Down
4 changes: 2 additions & 2 deletions http-cache-quickcache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ categories = [
"caching",
"web-programming::http-client"
]
edition = "2021"
rust-version = "1.90.0"
edition = "2024"
rust-version = "1.89.0"

[dependencies]
postcard = { version = "1.1", default-features = false, features = ["alloc"] }
Expand Down
4 changes: 3 additions & 1 deletion http-cache-quickcache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ An http-cache manager implementation for [quick-cache](https://github.com/arthur

## Minimum Supported Rust Version (MSRV)

1.90.0
1.89.0

See the [MSRV policy](https://github.com/06chaynes/http-cache#minimum-supported-rust-version-msrv).

## Install

Expand Down
2 changes: 1 addition & 1 deletion http-cache-quickcache/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use http_cache_reqwest::Cache;
use http_cache_semantics::CachePolicy;
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use wiremock::{matchers::method, Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, MockServer, ResponseTemplate, matchers::method};

use macro_rules_attribute::apply;
use smol_macros::test;
Expand Down
7 changes: 7 additions & 0 deletions http-cache-reqwest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [Unreleased]

### Changed

- Migrated to the 2024 edition, which requires Rust 1.85.0 or newer
- MSRV lowered from 1.90.0 to 1.89.0. `rust-version` now covers default features resolved with `resolver = "3"`; see the MSRV policy in the README

## [1.0.0-alpha.9] - 2026-09-08

### Changed
Expand Down
4 changes: 2 additions & 2 deletions http-cache-reqwest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ license = "MIT OR Apache-2.0"
readme = "README.md"
keywords = ["cache", "http", "middleware", "reqwest"]
categories = ["caching", "web-programming::http-client"]
edition = "2021"
rust-version = "1.90.0"
edition = "2024"
rust-version = "1.89.0"

[dependencies]
anyhow = "1.0.95"
Expand Down
4 changes: 3 additions & 1 deletion http-cache-reqwest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Uses [reqwest-middleware](https://github.com/TrueLayer/reqwest-middleware) for m

## Minimum Supported Rust Version (MSRV)

1.90.0
1.89.0

See the [MSRV policy](https://github.com/06chaynes/http-cache#minimum-supported-rust-version-msrv).

## Install

Expand Down
2 changes: 1 addition & 1 deletion http-cache-reqwest/examples/reqwest_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use http_cache_reqwest::{CACacheManager, Cache};
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use std::time::Instant;
use wiremock::{matchers::method, Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, MockServer, ResponseTemplate, matchers::method};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Expand Down
2 changes: 1 addition & 1 deletion http-cache-reqwest/examples/reqwest_streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use http_cache_reqwest::StreamingCache;
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use std::time::Instant;
use wiremock::{matchers::method, Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, MockServer, ResponseTemplate, matchers::method};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Expand Down
20 changes: 13 additions & 7 deletions http-cache-reqwest/examples/reqwest_streaming_memory_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use std::time::Duration;
use tempfile::tempdir;
use tokio::time::sleep;
use wiremock::{
matchers::{method, path},
Mock, MockServer, ResponseTemplate,
matchers::{method, path},
};

// Memory tracking allocator
Expand All @@ -44,15 +44,19 @@ impl MemoryTracker {

unsafe impl GlobalAlloc for MemoryTracker {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
let ptr = System.alloc(layout);
// SAFETY: the caller upholds `GlobalAlloc::alloc`'s contract, which is
// exactly what `System` requires.
let ptr = unsafe { System.alloc(layout) };
if !ptr.is_null() {
self.allocations.fetch_add(layout.size(), Ordering::Relaxed);
}
ptr
}

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
System.dealloc(ptr, layout);
// SAFETY: `ptr` came from `alloc` with this same `layout`, per the
// caller's obligation.
unsafe { System.dealloc(ptr, layout) };
self.allocations.fetch_sub(layout.size(), Ordering::Relaxed);
}
}
Expand Down Expand Up @@ -186,7 +190,9 @@ async fn run_memory_analysis() {
println!("============================================================");
println!("This analysis measures memory efficiency differences between");
println!("traditional buffered caching and file-based streaming caching.");
println!("Measurements are taken during cache hits to compare memory usage patterns.");
println!(
"Measurements are taken during cache hits to compare memory usage patterns."
);
println!();

let payload_sizes = [
Expand Down Expand Up @@ -343,8 +349,8 @@ const GATE_CHUNK_COUNT: usize = 4096;
/// instead of committing; 512MiB gives 2x headroom.
const GATE_MAX_BODY_SIZE: u64 = 512 * 1024 * 1024;

fn gate_body_stream(
) -> impl futures_util::Stream<Item = Result<bytes::Bytes, std::convert::Infallible>>
fn gate_body_stream()
-> impl futures_util::Stream<Item = Result<bytes::Bytes, std::convert::Infallible>>
{
futures_util::stream::iter((0..GATE_CHUNK_COUNT).map(|_| {
Ok::<_, std::convert::Infallible>(bytes::Bytes::from_static(
Expand All @@ -357,7 +363,7 @@ fn gate_body_stream(
/// copies of `GATE_CHUNK` as one cacheable response, without ever holding
/// more than one chunk in memory at a time. Returns the bound address.
async fn serve_gate_body() -> std::net::SocketAddr {
use axum::{body::Body, response::Response, routing::get, Router};
use axum::{Router, body::Body, response::Response, routing::get};

let app = Router::new().route(
"/gate",
Expand Down
14 changes: 7 additions & 7 deletions http-cache-reqwest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,12 @@ use std::str::FromStr;

pub use http::request::Parts;
use http::{
header::{HeaderName, CACHE_CONTROL},
Extensions, HeaderValue, Method,
header::{CACHE_CONTROL, HeaderName},
};
use http_cache::{
url_parse, BoxError, HitOrMiss, Middleware, Result, Url, XCACHE,
XCACHELOOKUP,
BoxError, HitOrMiss, Middleware, Result, Url, XCACHE, XCACHELOOKUP,
url_parse,
};
use reqwest::{Request, Response, ResponseBuilderExt};
#[cfg(all(feature = "reqwest-middleware", feature = "middlewest"))]
Expand Down Expand Up @@ -758,10 +758,10 @@ where
.await
.map_err(from_box_error)?;

if result.extensions().get::<FinalUrl>().is_none() {
if let Ok(u) = ::url::Url::parse(&parts.uri.to_string()) {
result.extensions_mut().insert(FinalUrl(u));
}
if result.extensions().get::<FinalUrl>().is_none()
&& let Ok(u) = ::url::Url::parse(&parts.uri.to_string())
{
result.extensions_mut().insert(FinalUrl(u));
}

convert_streaming_body_to_reqwest::<T>(result).await.map_err(|e| {
Expand Down
15 changes: 6 additions & 9 deletions http-cache-reqwest/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use reqwest::Client;
#[cfg(any(feature = "streaming", feature = "rate-limiting"))]
use wiremock::matchers::path;
use wiremock::{
matchers::{header, method},
Mock, MockServer, ResponseTemplate,
matchers::{header, method},
};

/// Helper function to create a temporary cache manager
Expand Down Expand Up @@ -2053,9 +2053,8 @@ mod streaming_tests {
fn until_key_ready(
&self,
key: &str,
) -> std::pin::Pin<
Box<dyn std::future::Future<Output = ()> + Send + '_>,
> {
) -> std::pin::Pin<Box<dyn Future<Output = ()> + Send + '_>>
{
let key = key.to_string();
Box::pin(async move {
self.calls.lock().unwrap().push(key);
Expand Down Expand Up @@ -2152,9 +2151,8 @@ mod streaming_tests {
fn until_key_ready(
&self,
key: &str,
) -> std::pin::Pin<
Box<dyn std::future::Future<Output = ()> + Send + '_>,
> {
) -> std::pin::Pin<Box<dyn Future<Output = ()> + Send + '_>>
{
let key = key.to_string();
Box::pin(async move {
self.calls.lock().unwrap().push(key);
Expand Down Expand Up @@ -2252,8 +2250,7 @@ mod rate_limiting_tests {
fn until_key_ready(
&self,
key: &str,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = ()> + Send + '_>>
{
) -> std::pin::Pin<Box<dyn Future<Output = ()> + Send + '_>> {
let key = key.to_string();
Box::pin(async move {
self.calls.lock().unwrap().push(key);
Expand Down
7 changes: 7 additions & 0 deletions http-cache-surf/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [Unreleased]

### Changed

- Migrated to the 2024 edition, which requires Rust 1.85.0 or newer
- MSRV lowered from 1.90.0 to 1.89.0. `rust-version` now covers default features resolved with `resolver = "3"`; see the MSRV policy in the README

## [1.0.0-alpha.8] - 2026-09-08

### Changed
Expand Down
4 changes: 2 additions & 2 deletions http-cache-surf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ categories = [
"caching",
"web-programming::http-client"
]
edition = "2021"
rust-version = "1.90.0"
edition = "2024"
rust-version = "1.89.0"

[dependencies]
http = "1.2.0"
Expand Down
4 changes: 3 additions & 1 deletion http-cache-surf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ Should likely be registered after any middleware modifying the request.

## Minimum Supported Rust Version (MSRV)

1.90.0
1.89.0

See the [MSRV policy](https://github.com/06chaynes/http-cache#minimum-supported-rust-version-msrv).

## Install

Expand Down
2 changes: 1 addition & 1 deletion http-cache-surf/examples/surf_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use http_cache::{CacheMode, HttpCache, HttpCacheOptions};
use http_cache_surf::{CACacheManager, Cache};
use std::time::Instant;
use surf::Client;
use wiremock::{matchers::method, Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, MockServer, ResponseTemplate, matchers::method};

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Expand Down
11 changes: 5 additions & 6 deletions http-cache-surf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,16 @@ use http::{
request::{self, Parts},
};
use http_cache::{
url_parse, BadHeader, BoxError, CacheManager, HitOrMiss, HttpResponse,
Middleware, Result, Url, XCACHE, XCACHELOOKUP,
BadHeader, BoxError, CacheManager, HitOrMiss, HttpResponse, Middleware,
Result, Url, XCACHE, XCACHELOOKUP, url_parse,
};
pub use http_cache::{CacheMode, HttpCache, HttpHeaders};
use http_types::{Method as HttpTypesMethod, Request};
use http_types::{
headers::HeaderValue as HttpTypesHeaderValue,
Response as HttpTypesResponse, StatusCode as HttpTypesStatusCode,
Version as HttpTypesVersion,
Version as HttpTypesVersion, headers::HeaderValue as HttpTypesHeaderValue,
};
use http_types::{Method as HttpTypesMethod, Request};
use surf::{middleware::Next, Client};
use surf::{Client, middleware::Next};

// Re-export managers and cache types
#[cfg(feature = "manager-cacache")]
Expand Down
7 changes: 3 additions & 4 deletions http-cache-surf/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{BadRequest, Cache, HttpCacheError};

use http_cache::*;
use surf::Client;
use wiremock::{matchers::method, Mock, MockServer, ResponseTemplate};
use wiremock::{Mock, MockServer, ResponseTemplate, matchers::method};

#[tokio::test]
async fn test_non_cloneable_request_graceful_fallback() -> Result<()> {
Expand Down Expand Up @@ -1089,9 +1089,8 @@ mod with_moka {
fn until_key_ready(
&self,
key: &str,
) -> std::pin::Pin<
Box<dyn std::future::Future<Output = ()> + Send + '_>,
> {
) -> std::pin::Pin<Box<dyn Future<Output = ()> + Send + '_>>
{
let key = key.to_string();
Box::pin(async move {
self.calls.lock().unwrap().push(key);
Expand Down
7 changes: 7 additions & 0 deletions http-cache-tower-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [Unreleased]

### Changed

- Migrated to the 2024 edition, which requires Rust 1.85.0 or newer
- MSRV lowered from 1.90.0 to 1.89.0. `rust-version` now covers default features resolved with `resolver = "3"`; see the MSRV policy in the README

## [0.2.5] - 2026-09-08

### Changed
Expand Down
4 changes: 2 additions & 2 deletions http-cache-tower-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ categories = [
"caching",
"web-programming::http-server"
]
edition = "2021"
rust-version = "1.90.0"
edition = "2024"
rust-version = "1.89.0"

[dependencies]
http-cache = { version = "1.0.0-alpha.8", path = "../http-cache", default-features = false }
Expand Down
4 changes: 3 additions & 1 deletion http-cache-tower-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ cargo run --example axum_basic --features manager-cacache

## Minimum Supported Rust Version (MSRV)

1.90.0
1.89.0

See the [MSRV policy](https://github.com/06chaynes/http-cache#minimum-supported-rust-version-msrv).

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion http-cache-tower-server/examples/axum_advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
//! ```

use axum::{
BoxError, Router,
error_handling::HandleErrorLayer,
extract::{Query, State},
response::{IntoResponse, Response},
routing::{delete, get},
BoxError, Router,
};
use http::{Request, StatusCode};
use http_cache::CACacheManager;
Expand Down
2 changes: 1 addition & 1 deletion http-cache-tower-server/examples/axum_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
//! Run with: cargo run --example axum_basic --features manager-cacache

use axum::{
BoxError, Router,
error_handling::HandleErrorLayer,
extract::Path,
response::{IntoResponse, Response},
routing::get,
BoxError, Router,
};
use http::StatusCode;
use http_cache::CACacheManager;
Expand Down
Loading