Skip to content

Commit 4b6a4c7

Browse files
authored
Revert "Adding OHTTP to viaduct (#6935)" (#6987)
This reverts commit 0981e2d.
1 parent 6d37135 commit 4b6a4c7

File tree

20 files changed

+82
-1340
lines changed

20 files changed

+82
-1340
lines changed

Cargo.lock

Lines changed: 50 additions & 176 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DEPENDENCIES.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ The following text applies to code linked from these dependencies:
459459
[askama](https://github.com/askama-rs/askama),
460460
[askama_derive](https://github.com/askama-rs/askama),
461461
[askama_parser](https://github.com/askama-rs/askama),
462-
[async-lock](https://github.com/smol-rs/async-lock),
463462
[async-trait](https://github.com/dtolnay/async-trait),
464463
[autocfg](https://github.com/cuviper/autocfg),
465464
[base64](https://github.com/marshallpierce/rust-base64),
@@ -474,11 +473,9 @@ The following text applies to code linked from these dependencies:
474473
[cfg-if](https://github.com/alexcrichton/cfg-if),
475474
[chrono](https://github.com/chronotope/chrono),
476475
[clang-sys](https://github.com/KyleMayes/clang-sys),
477-
[concurrent-queue](https://github.com/smol-rs/concurrent-queue),
478476
[core-foundation-sys](https://github.com/servo/core-foundation-rs),
479477
[core-foundation](https://github.com/servo/core-foundation-rs),
480478
[cpufeatures](https://github.com/RustCrypto/utils),
481-
[crossbeam-utils](https://github.com/crossbeam-rs/crossbeam),
482479
[crypto-common](https://github.com/RustCrypto/traits),
483480
[digest](https://github.com/RustCrypto/traits),
484481
[displaydoc](https://github.com/yaahc/displaydoc),
@@ -487,8 +484,6 @@ The following text applies to code linked from these dependencies:
487484
[env_logger](https://github.com/rust-cli/env_logger),
488485
[equivalent](https://github.com/cuviper/equivalent),
489486
[errno](https://github.com/lambda-fairy/rust-errno),
490-
[event-listener-strategy](https://github.com/smol-rs/event-listener-strategy),
491-
[event-listener](https://github.com/smol-rs/event-listener),
492487
[fallible-iterator](https://github.com/sfackler/rust-fallible-iterator),
493488
[fallible-streaming-iterator](https://github.com/sfackler/fallible-streaming-iterator),
494489
[fastrand](https://github.com/smol-rs/fastrand),
@@ -542,7 +537,6 @@ The following text applies to code linked from these dependencies:
542537
[openssl-probe](https://github.com/alexcrichton/openssl-probe),
543538
[openssl-src](https://github.com/alexcrichton/openssl-src-rs),
544539
[openssl](https://github.com/sfackler/rust-openssl),
545-
[parking](https://github.com/smol-rs/parking),
546540
[parking_lot](https://github.com/Amanieu/parking_lot),
547541
[parking_lot_core](https://github.com/Amanieu/parking_lot),
548542
[paste](https://github.com/dtolnay/paste),
@@ -576,7 +570,6 @@ The following text applies to code linked from these dependencies:
576570
[serde_derive](https://github.com/serde-rs/serde),
577571
[serde_json](https://github.com/serde-rs/json),
578572
[serde_path_to_error](https://github.com/dtolnay/path-to-error),
579-
[serde_spanned](https://github.com/toml-rs/toml),
580573
[serde_urlencoded](https://github.com/nox/serde_urlencoded),
581574
[sha2](https://github.com/RustCrypto/hashes),
582575
[shlex](https://github.com/comex/rust-shlex),
@@ -594,10 +587,6 @@ The following text applies to code linked from these dependencies:
594587
[tinyvec](https://github.com/Lokathor/tinyvec),
595588
[tinyvec_macros](https://github.com/Soveu/tinyvec_macros),
596589
[toml](https://github.com/alexcrichton/toml-rs),
597-
[toml](https://github.com/toml-rs/toml),
598-
[toml_datetime](https://github.com/toml-rs/toml),
599-
[toml_parser](https://github.com/toml-rs/toml),
600-
[toml_writer](https://github.com/toml-rs/toml),
601590
[typenum](https://github.com/paholg/typenum),
602591
[unicase](https://github.com/seanmonstar/unicase),
603592
[unicode-normalization](https://github.com/unicode-rs/unicode-normalization),

components/init_rust_components/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ license = "MPL-2.0"
77
exclude = ["/android"]
88

99
[features]
10-
default = []
1110
keydb = ["nss/keydb"]
12-
ohttp = ["viaduct/ohttp"]
1311

1412
[dependencies]
1513
uniffi = { version = "0.29.0" }
1614
nss = { path = "../support/rc_crypto/nss" }
17-
viaduct = { path = "../viaduct", optional = true }

components/init_rust_components/src/lib.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
use nss::ensure_initialized as ensure_nss_initialized;
88
#[cfg(feature = "keydb")]
99
use nss::ensure_initialized_with_profile_dir as ensure_nss_initialized_with_profile_dir;
10-
#[cfg(feature = "ohttp")]
11-
use viaduct::ohttp::configure_default_ohttp_channels;
10+
1211
uniffi::setup_scaffolding!();
1312

1413
/// Global initialization routines for Rust components. Must be called before any other calls to
@@ -21,12 +20,6 @@ uniffi::setup_scaffolding!();
2120
#[uniffi::export]
2221
pub fn initialize() {
2322
ensure_nss_initialized();
24-
25-
#[cfg(feature = "ohttp")]
26-
{
27-
configure_default_ohttp_channels()
28-
.expect("We pass down hard coded Strings for the relays, if this fails, we have a typo in the config we pass down.");
29-
}
3023
}
3124

3225
/// Global initialization routines for Rust components, when `logins/keydb` feature is activated. Must be
@@ -41,10 +34,4 @@ pub fn initialize() {
4134
#[uniffi::export]
4235
pub fn initialize(profile_path: String) {
4336
ensure_nss_initialized_with_profile_dir(profile_path);
44-
45-
#[cfg(feature = "ohttp")]
46-
{
47-
configure_default_ohttp_channels()
48-
.expect("We pass down hard coded Strings for the relays, if this fails, we have a typo in the config we pass down.");
49-
}
5037
}

components/support/viaduct-dev/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ pub fn init_backend_dev() {
4949

5050
#[async_trait::async_trait]
5151
impl Backend for HyperBackend {
52-
async fn send_request(
53-
&self,
54-
request: Request,
55-
settings: ClientSettings,
56-
) -> Result<Response, ViaductError> {
52+
async fn send_request(&self, request: Request, settings: ClientSettings) -> Result<Response> {
5753
let handle = self.runtime.handle().clone();
5854
let client = self.client.clone();
5955
match handle

components/viaduct/Cargo.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ crate-type = ["lib"]
1111

1212
[dependencies]
1313
async-trait = "0.1"
14-
async-lock = "3.3"
1514
error-support = { path = "../support/error" }
1615
url = "2"
1716
serde = "1"
@@ -23,12 +22,3 @@ prost = "0.12"
2322
ffi-support = "0.4"
2423
thiserror = "2"
2524
uniffi = { version = "0.29.0" }
26-
tokio = { version = "1", features = ["rt-multi-thread"], optional = true }
27-
hyper = { version = "0.14", features = ["client", "http1", "http2", "tcp"], optional = true }
28-
bhttp = { git = "https://github.com/martinthomson/ohttp.git", rev = "c6131ace4e4e82a4269afac3cb0524541d2cd315", optional = true }
29-
ohttp = { git = "https://github.com/martinthomson/ohttp.git", rev = "c6131ace4e4e82a4269afac3cb0524541d2cd315", features = ["client", "server", "app-svc", "external-sqlite"], default-features = false, optional = true }
30-
31-
[features]
32-
default = ["ohttp"]
33-
backend-dev = ["dep:tokio", "dep:hyper"]
34-
ohttp = ["dep:bhttp", "dep:ohttp"]

components/viaduct/src/client.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,8 @@ impl Client {
1818
Self { settings }
1919
}
2020

21-
/// Create a client that uses OHTTP with the specified channel for all requests
22-
#[cfg(feature = "ohttp")]
23-
pub fn with_ohttp_channel(
24-
channel: &str,
25-
settings: ClientSettings,
26-
) -> Result<Self, crate::ViaductError> {
27-
if !crate::ohttp::is_ohttp_channel_configured(channel) {
28-
return Err(crate::ViaductError::OhttpChannelNotConfigured(
29-
channel.to_string(),
30-
));
31-
}
32-
let mut client_settings = settings;
33-
client_settings.ohttp_channel = Some(channel.to_string());
34-
Ok(Self {
35-
settings: client_settings,
36-
})
37-
}
38-
3921
pub async fn send(&self, request: Request) -> Result<Response> {
4022
validate_request(&request)?;
41-
42-
// Check if this client should use OHTTP for all requests
43-
#[cfg(feature = "ohttp")]
44-
if let Some(channel) = &self.settings.ohttp_channel {
45-
crate::debug!(
46-
"Client configured for OHTTP channel '{}', processing request via OHTTP",
47-
channel
48-
);
49-
return crate::ohttp::process_ohttp_request(request, channel, self.settings.clone())
50-
.await;
51-
}
52-
53-
// For non-OHTTP requests, use the normal backend
54-
crate::debug!("Processing request via standard backend");
5523
get_backend()?
5624
.send_request(request, self.settings.clone())
5725
.await
@@ -71,9 +39,6 @@ pub struct ClientSettings {
7139
// Maximum amount of redirects to follow (0 means redirects are not allowed)
7240
#[uniffi(default = 10)]
7341
pub redirect_limit: u32,
74-
// OHTTP channel to use for all requests (if any)
75-
#[cfg(feature = "ohttp")]
76-
pub ohttp_channel: Option<String>,
7742
}
7843

7944
impl Default for ClientSettings {
@@ -84,8 +49,6 @@ impl Default for ClientSettings {
8449
#[cfg(not(target_os = "ios"))]
8550
timeout: 10000,
8651
redirect_limit: 10,
87-
#[cfg(feature = "ohttp")]
88-
ohttp_channel: None,
8952
}
9053
}
9154
}

components/viaduct/src/error.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,6 @@ pub enum ViaductError {
3131

3232
#[error("[no-sentry] Validation error: URL does not use TLS protocol.")]
3333
NonTlsUrl,
34-
35-
#[error("OHTTP channel '{0}' is not configured")]
36-
OhttpChannelNotConfigured(String),
37-
38-
#[error("Failed to fetch OHTTP config: {0}")]
39-
OhttpConfigFetchFailed(String),
40-
41-
#[error("OHTTP request error: {0}")]
42-
OhttpRequestError(String),
43-
44-
#[error("OHTTP response error: {0}")]
45-
OhttpResponseError(String),
46-
47-
#[error("OHTTP support is not enabled in this build")]
48-
OhttpNotSupported,
4934
}
5035

5136
impl ViaductError {

components/viaduct/src/headers.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,6 @@ impl Headers {
115115
Default::default()
116116
}
117117

118-
/// Create headers from a HashMap of name-value pairs
119-
///
120-
/// # Errors
121-
/// Returns an error if any header name or value is invalid
122-
pub fn try_from_hashmap(map: HashMap<String, String>) -> Result<Self, crate::ViaductError> {
123-
let mut headers = Headers::new();
124-
for (name, value) in map {
125-
headers.insert(name, value)?;
126-
}
127-
Ok(headers)
128-
}
129-
130118
/// Initialize an empty list of headers backed by a vector with the provided
131119
/// capacity.
132120
pub fn with_capacity(c: usize) -> Self {

components/viaduct/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ mod backend;
1313
mod client;
1414
pub mod error;
1515
mod new_backend;
16-
#[cfg(feature = "ohttp")]
17-
pub mod ohttp;
18-
#[cfg(feature = "ohttp")]
19-
mod ohttp_client;
2016
pub mod settings;
2117
pub use error::*;
2218
// reexport logging helpers.
@@ -26,8 +22,6 @@ pub use backend::{note_backend, set_backend, Backend as OldBackend};
2622
pub use client::{Client, ClientSettings};
2723
pub use headers::{consts as header_names, Header, HeaderName, Headers, InvalidHeaderName};
2824
pub use new_backend::{init_backend, Backend};
29-
#[cfg(feature = "ohttp")]
30-
pub use ohttp::{clear_ohttp_channels, configure_ohttp_channel, list_ohttp_channels, OhttpConfig};
3125
pub use settings::{allow_android_emulator_loopback, GLOBAL_SETTINGS};
3226

3327
#[allow(clippy::derive_partial_eq_without_eq)]

0 commit comments

Comments
 (0)