Skip to content

Commit aa82112

Browse files
committed
fix: Enable HTTP/2 for gRPC connections
The client connector only enabled HTTP/1.1 but native gRPC requires HTTP/2. This caused handshake timeouts when trying to connect to the gRPC endpoint. Added .enable_http2() to all hyper_rustls connector builders.
1 parent 7ac6a2f commit aa82112

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

bindings/c/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ pub unsafe extern "C" fn libsql_open_sync_with_config(
270270
.with_webpki_roots()
271271
.https_or_http()
272272
.enable_http1()
273+
.enable_http2()
273274
.build();
274275
builder = builder.connector(https);
275276
}
@@ -315,6 +316,7 @@ pub unsafe extern "C" fn libsql_open_sync_with_config(
315316
.with_webpki_roots()
316317
.https_or_http()
317318
.enable_http1()
319+
.enable_http2()
318320
.build();
319321
builder = builder.connector(https);
320322
}
@@ -497,6 +499,7 @@ unsafe fn libsql_open_remote_internal(
497499
.with_webpki_roots()
498500
.https_or_http()
499501
.enable_http1()
502+
.enable_http2()
500503
.build();
501504
builder = builder.connector(https);
502505
}

libsql/examples/flutter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ async fn main() {
1212
.with_webpki_roots()
1313
.https_or_http()
1414
.enable_http1()
15+
.enable_http2()
1516
.build();
1617

1718
Builder::new_remote(url, token)

libsql/src/database.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,7 @@ fn connector(
772772
.map_err(crate::Error::InvalidTlsConfiguration)?
773773
.https_or_http()
774774
.enable_http1()
775+
.enable_http2()
775776
.wrap_connector(http))
776777
}
777778

0 commit comments

Comments
 (0)