Skip to content

Commit 20ed7e2

Browse files
committed
Merge branch 'mraszyk/ic-nns-init-http1' into 'master'
add http2_only flag to ic-nns-init Add `http2-only` flag to `ic-nns-init` that makes it use `HTTP/2` instead of `HTTP/1.1` (default). Currently, `HTTP/2` is the default and this MR makes `HTTP/1.1` the new default. The motivation for this flag is that our [reference implementation](https://github.com/dfinity/ic-hs) does not fully support `HTTP/2` yet. Note. DFX uses `HTTP/1.1` for connections to the IC. See merge request dfinity-lab/public/ic!12517
2 parents 98b0e32 + e09071f commit 20ed7e2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

rs/nns/init/src/main.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use canister_test::{RemoteTestRuntime, Runtime};
22
use clap::Parser;
33
use ic_base_types::{PrincipalId, SubnetId};
4-
use ic_canister_client::{Agent, Sender};
4+
use ic_canister_client::{Agent, HttpClientConfig, Sender};
55
use ic_nns_common::pb::v1::NeuronId;
66
use ic_nns_constants::REGISTRY_CANISTER_ID;
77
use ic_nns_governance::pb::v1::Governance as GovernanceProto;
@@ -130,6 +130,10 @@ struct CliArgs {
130130
/// Pass specified_id to provisional_create_canister_with_cycles when creating canisters.
131131
#[clap(long)]
132132
pass_specified_id: bool,
133+
134+
/// If set, HTTP/2 is used for connections to the IC. By default, HTTP/1.1 is used.
135+
#[clap(long)]
136+
http2_only: bool,
133137
}
134138

135139
const LOG_PREFIX: &str = "[ic-nns-init] ";
@@ -186,15 +190,20 @@ async fn main() {
186190

187191
let url = args.url.expect("Url must be provided to install canister.");
188192

193+
let http_client_config = HttpClientConfig {
194+
http2_only: args.http2_only,
195+
..HttpClientConfig::default()
196+
};
189197
let agent = if args.use_hsm {
190198
let sender = make_hsm_sender(&args.hsm_slot, &args.key_id, &args.pin);
191-
Agent::new(url.clone(), sender)
199+
Agent::new_with_http_client_config(url.clone(), sender, http_client_config)
192200
} else {
193201
// Use the special identity that has superpowers, like calling
194202
// ic00::Method::ProvisionalCreateCanisterWithCycles.
195-
Agent::new(
203+
Agent::new_with_http_client_config(
196204
url.clone(),
197205
Sender::from_keypair(&ic_test_identity::TEST_IDENTITY_KEYPAIR),
206+
http_client_config,
198207
)
199208
};
200209

0 commit comments

Comments
 (0)