From e953e17bb8432b22ddb17020ee217c7062568b42 Mon Sep 17 00:00:00 2001 From: gngpp Date: Fri, 20 Nov 2026 13:59:18 +0800 Subject: [PATCH] build(deps): sync wreq transport fixes and raise MSRV to 1.100 --- Cargo.lock | 63 ++++++++----------- Cargo.toml | 15 +++-- crates/wreq-util/Cargo.toml | 1 + crates/wreq-util/src/emulate/profile.rs | 4 +- .../src/emulate/profile/chrome/http2.rs | 6 +- .../src/emulate/profile/firefox/http2.rs | 22 +++---- .../src/emulate/profile/opera/http2.rs | 6 +- wreq.gemspec | 2 +- 8 files changed, 55 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7fef121..10e65fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,7 +124,7 @@ dependencies = [ [[package]] name = "btls" version = "0.5.6" -source = "git+https://github.com/0x676e67/btls?rev=5ec1c113a03626a5877b34dd6d2ea8d440897a91#5ec1c113a03626a5877b34dd6d2ea8d440897a91" +source = "git+https://github.com/0x676e67/btls?branch=main#8879c026b548c25441f83ff58b39d7e22ba1b5b1" dependencies = [ "bitflags", "btls-sys", @@ -136,7 +136,7 @@ dependencies = [ [[package]] name = "btls-sys" version = "0.5.6" -source = "git+https://github.com/0x676e67/btls?rev=5ec1c113a03626a5877b34dd6d2ea8d440897a91#5ec1c113a03626a5877b34dd6d2ea8d440897a91" +source = "git+https://github.com/0x676e67/btls?branch=main#8879c026b548c25441f83ff58b39d7e22ba1b5b1" dependencies = [ "bindgen 0.73.2", "cmake", @@ -483,7 +483,7 @@ dependencies = [ [[package]] name = "http2" version = "0.5.20" -source = "git+https://github.com/0x676e67/http2?rev=29b3bdfc7560d6f84119c103311afa147488b6f0#29b3bdfc7560d6f84119c103311afa147488b6f0" +source = "git+https://github.com/0x676e67/http2?branch=master#3219d38910c22105ea7fc5464696f26589432e9c" dependencies = [ "atomic-waker", "bytes", @@ -760,6 +760,25 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "netty" +version = "0.2.5" +source = "git+https://github.com/0x676e67/netty?branch=main#314db585d85e7ea9c15535f458e7324b800fc702" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "http2", + "httparse", + "pin-project-lite", + "smallvec", + "tokio", + "tokio-util", + "want", +] + [[package]] name = "nom" version = "7.1.3" @@ -1228,7 +1247,7 @@ dependencies = [ [[package]] name = "tokio-btls" version = "0.5.6" -source = "git+https://github.com/0x676e67/btls?rev=5ec1c113a03626a5877b34dd6d2ea8d440897a91#5ec1c113a03626a5877b34dd6d2ea8d440897a91" +source = "git+https://github.com/0x676e67/btls?branch=main#8879c026b548c25441f83ff58b39d7e22ba1b5b1" dependencies = [ "btls", "btls-sys", @@ -1431,7 +1450,7 @@ dependencies = [ [[package]] name = "wreq" version = "0.16.1" -source = "git+https://github.com/0x676e67/wreq?rev=74fc1469b5c54b3fb93037e48f136b569d0fe418#74fc1469b5c54b3fb93037e48f136b569d0fe418" +source = "git+https://github.com/0x676e67/wreq?branch=main#85d0528f10ceba32ca444d3343b61c291ef8c1d4" dependencies = [ "btls", "btls-sys", @@ -1449,6 +1468,7 @@ dependencies = [ "libc", "lru", "mime", + "netty", "percent-encoding", "pin-project-lite", "serde", @@ -1463,39 +1483,6 @@ dependencies = [ "tower", "tower-http", "url", - "wreq-proto", - "wreq-rt", -] - -[[package]] -name = "wreq-proto" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a43942f024bb303f1042c9aa3c87fa1d9149f507c65db6e5220a11ccdb207387" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "http2", - "httparse", - "pin-project-lite", - "smallvec", - "tokio", - "tokio-util", - "want", -] - -[[package]] -name = "wreq-rt" -version = "0.2.2-rc.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e9bce67a3fa3dd3f1503f066d86661c9caf399a763d3bd184da7afaf886c8b" -dependencies = [ - "pin-project-lite", - "tokio", - "wreq-proto", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index bf9d963..6da2b8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://github.com/SearchApi/wreq-ruby" repository = "https://github.com/SearchApi/wreq-ruby" edition = "2024" version = "1.3.2" -rust-version = "1.98" +rust-version = "1.100" [lib] crate-type = ["cdylib"] @@ -20,6 +20,7 @@ tokio = { version = "1.53.1", features = ["full"] } # Keep the existing trust store independent of wreq's default feature selection. wreq = { version = "0.16.1", default-features = false, features = [ "tokio-rt", + "http2", "chromium-roots", "query", "form", @@ -67,9 +68,11 @@ opt-level = 3 strip = true [patch.crates-io] -http2 = { git = "https://github.com/0x676e67/http2", rev = "29b3bdfc7560d6f84119c103311afa147488b6f0" } -btls = { git = "https://github.com/0x676e67/btls", rev = "5ec1c113a03626a5877b34dd6d2ea8d440897a91" } -btls-sys = { git = "https://github.com/0x676e67/btls", rev = "5ec1c113a03626a5877b34dd6d2ea8d440897a91" } -tokio-btls = { git = "https://github.com/0x676e67/btls", rev = "5ec1c113a03626a5877b34dd6d2ea8d440897a91" } -wreq = { git = "https://github.com/0x676e67/wreq", rev = "74fc1469b5c54b3fb93037e48f136b569d0fe418" } +# Match the Git patches used by wreq main; Cargo.lock pins the exact revisions. +btls = { git = "https://github.com/0x676e67/btls", branch = "main" } +btls-sys = { git = "https://github.com/0x676e67/btls", branch = "main" } +tokio-btls = { git = "https://github.com/0x676e67/btls", branch = "main" } +http2 = { git = "https://github.com/0x676e67/http2", branch = "master" } +netty = { git = "https://github.com/0x676e67/netty", branch = "main" } +wreq = { git = "https://github.com/0x676e67/wreq", branch = "main" } wreq-util = { path = "crates/wreq-util" } diff --git a/crates/wreq-util/Cargo.toml b/crates/wreq-util/Cargo.toml index 5c0b011..ebc2627 100644 --- a/crates/wreq-util/Cargo.toml +++ b/crates/wreq-util/Cargo.toml @@ -29,6 +29,7 @@ emulation = [ "dep:zstd", "dep:chromium-roots", "wreq/chromium-roots", + "wreq/http2", ] emulation-serde = ["dep:serde"] emulation-compression = [] diff --git a/crates/wreq-util/src/emulate/profile.rs b/crates/wreq-util/src/emulate/profile.rs index 6d604ed..13175dc 100644 --- a/crates/wreq-util/src/emulate/profile.rs +++ b/crates/wreq-util/src/emulate/profile.rs @@ -13,8 +13,8 @@ use wreq::{ Group, header::{ACCEPT, ACCEPT_LANGUAGE, HeaderMap, HeaderName, HeaderValue, USER_AGENT}, http2::{ - Http2Options, Priorities, Priority, PseudoId, PseudoOrder, SettingId, SettingsOrder, - StreamDependency, StreamId, + HeadersDependency, HeadersPriority, Http2Options, Priorities, Priority, PseudoId, + PseudoOrder, SettingId, SettingsOrder, StreamDependency, StreamId, }, tls::{ AlpnProtocol, AlpsProtocol, EchGrease, EchGreaseAead, ExtensionType, KeyShare, Tls13Cipher, diff --git a/crates/wreq-util/src/emulate/profile/chrome/http2.rs b/crates/wreq-util/src/emulate/profile/chrome/http2.rs index 841c8a4..a47190a 100644 --- a/crates/wreq-util/src/emulate/profile/chrome/http2.rs +++ b/crates/wreq-util/src/emulate/profile/chrome/http2.rs @@ -1,6 +1,6 @@ -macro_rules! headers_stream_dependency { +macro_rules! headers_priority { () => { - StreamDependency::new(StreamId::zero(), 255, true) + HeadersPriority::new(HeadersDependency::Root, 255, true) }; } @@ -41,7 +41,7 @@ macro_rules! http2_options { .initial_connection_window_size(15728640) .max_header_list_size(262144) .header_table_size(65536) - .headers_stream_dependency(headers_stream_dependency!()) + .headers_priority(headers_priority!()) .headers_pseudo_order(pseudo_order!()) .settings_order(settings_order!()) }; diff --git a/crates/wreq-util/src/emulate/profile/firefox/http2.rs b/crates/wreq-util/src/emulate/profile/firefox/http2.rs index b7f18f7..2c7fd42 100644 --- a/crates/wreq-util/src/emulate/profile/firefox/http2.rs +++ b/crates/wreq-util/src/emulate/profile/firefox/http2.rs @@ -1,9 +1,9 @@ -macro_rules! headers_stream_dependency { +macro_rules! headers_priority { (1) => { - StreamDependency::new(StreamId::zero(), 41, false) + HeadersPriority::new(HeadersDependency::Root, 41, false) }; (2) => { - StreamDependency::new(StreamId::from(13), 41, false) + HeadersPriority::new(HeadersDependency::Declared(13_u32.into()), 41, false) }; } @@ -52,28 +52,28 @@ macro_rules! http2_options { .initial_stream_id(3) .header_table_size(65536) .enable_push(false) - .headers_stream_dependency(headers_stream_dependency!(1)) + .headers_priority(headers_priority!(1)) .build() }; (2) => { http2_options!(@base Http2Options::builder()) .initial_stream_id(15) .header_table_size(65536) - .headers_stream_dependency(headers_stream_dependency!(2)) + .headers_priority(headers_priority!(2)) .priorities( Priorities::builder() .extend([ Priority::new( StreamId::from(3), - StreamDependency::new(StreamId::zero(), 200, false), + StreamDependency::new(StreamId::from(0), 200, false), ), Priority::new( StreamId::from(5), - StreamDependency::new(StreamId::zero(), 100, false), + StreamDependency::new(StreamId::from(0), 100, false), ), Priority::new( StreamId::from(7), - StreamDependency::new(StreamId::zero(), 0, false), + StreamDependency::new(StreamId::from(0), 0, false), ), Priority::new( StreamId::from(9), @@ -85,7 +85,7 @@ macro_rules! http2_options { ), Priority::new( StreamId::from(13), - StreamDependency::new(StreamId::zero(), 240, false), + StreamDependency::new(StreamId::from(0), 240, false), ), ]) .build(), @@ -98,7 +98,7 @@ macro_rules! http2_options { .header_table_size(65536) .enable_push(false) .max_concurrent_streams(0) - .headers_stream_dependency(headers_stream_dependency!(1)) + .headers_priority(headers_priority!(1)) .build() }; (4) => { @@ -107,7 +107,7 @@ macro_rules! http2_options { .header_table_size(4096) .enable_push(false) .initial_window_size(32768) - .headers_stream_dependency(headers_stream_dependency!(1)) + .headers_priority(headers_priority!(1)) .build() }; } diff --git a/crates/wreq-util/src/emulate/profile/opera/http2.rs b/crates/wreq-util/src/emulate/profile/opera/http2.rs index 070d50a..ddc27dd 100644 --- a/crates/wreq-util/src/emulate/profile/opera/http2.rs +++ b/crates/wreq-util/src/emulate/profile/opera/http2.rs @@ -1,6 +1,6 @@ -macro_rules! headers_stream_dependency { +macro_rules! headers_priority { () => { - StreamDependency::new(StreamId::zero(), 255, true) + HeadersPriority::new(HeadersDependency::Root, 255, true) }; } @@ -42,7 +42,7 @@ macro_rules! http2_options { .max_header_list_size(262144) .header_table_size(65536) .enable_push(false) - .headers_stream_dependency(headers_stream_dependency!()) + .headers_priority(headers_priority!()) .headers_pseudo_order(pseudo_order!()) .settings_order(settings_order!()) .build() diff --git a/wreq.gemspec b/wreq.gemspec index 005343d..5fbca0d 100644 --- a/wreq.gemspec +++ b/wreq.gemspec @@ -44,7 +44,7 @@ Gem::Specification.new do |spec| # Exclude non-Ruby files from RDoc to prevent parsing errors spec.rdoc_options = ["--exclude", "Cargo\\..*", "--exclude", "\\.rs$"] - spec.requirements = ["Rust >= 1.98"] + spec.requirements = ["Rust >= 1.100"] # use a Ruby version which: # - supports Rubygems with the ability of compilation of Rust gem # - not end of life