Skip to content

Commit 6404cdd

Browse files
authored
fix: disable https in the proxy client if the http flag is true. (#5229)
This is how it should've been before. The only reason it worked was that `https_only` was not really enforced. See here: rustls/hyper-rustls#295
1 parent b55418a commit 6404cdd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

rs/https_outcalls/adapter/src/rpc_server.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,17 @@ impl CanisterHttp {
137137
http_connector
138138
.set_connect_timeout(Some(Duration::from_secs(self.http_connect_timeout_secs)));
139139

140+
let builder = HttpsConnectorBuilder::new()
141+
.with_native_roots()
142+
.expect("Failed to set native roots");
143+
144+
#[cfg(not(feature = "http"))]
145+
let builder = builder.https_only();
146+
#[cfg(feature = "http")]
147+
let builder = builder.https_or_http();
148+
140149
Client::builder(TokioExecutor::new()).build::<_, Full<Bytes>>(
141-
HttpsConnectorBuilder::new()
142-
.with_native_roots()
143-
.expect("Failed to set native roots")
144-
.https_only()
150+
builder
145151
.enable_all_versions()
146152
.wrap_connector(SocksConnector {
147153
proxy_addr,

0 commit comments

Comments
 (0)