grpc / grpc/grpc-rust

"_tls-any" feature needs to be properly documented Or disabled with custom connector

Open
#2,280 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
12.5k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
24

Description

## Bug Report

### Version

### Platform
Everywhere

### Crates
Tonic

### Description
I was using my own TlsConnector with tonic 0.12.x "tls" feature enabled. But I was getting following HttpsUriWithoutTlsSupport error.

This is our code:
```Endpoint::try_from("https://10.0.1.215:443")
.connect_with_connector(connector)```

When we create endpoint and tls feature is enabled => then a None "tls" is attached to the connector. Here is the code: https://github.com/hyperium/tonic/blob/e4ba8b5c0cd1607a80ccfed7988c6874fa99ff38/tonic/src/transport/channel/endpoint.rs#L82

When we call `connect_with_connector` it wraps our PSK connector in another connector : https://github.com/hyperium/tonic/blob/e4ba8b5c0cd1607a80ccfed7988c6874fa99ff38/tonic/src/transport/channel/endpoint.rs#L477

Here is the method: https://github.com/hyperium/tonic/blob/e4ba8b5c0cd1607a80ccfed7988c6874fa99ff38/tonic/src/transport/channel/endpoint.rs#L408

Newly created wrapper connector has the "tls" field set to None. Because the endpoint had the "tls" field set to None.
On that connector when a call() method is called, Then it basically checks for None tls and returns
`HttpsUriWithoutTlsSupport`
So this issue happened because on enabling the "tls" flag. The tonic was wrapping our PSKConnector with its own connector which had Empty/None tls config. And it was throwing error from this location: https://github.com/hyperium/tonic/blob/e4ba8b5c0cd1607a80ccfed7988c6874fa99ff38/tonic/src/transport/channel/service/connector.rs#L68

I think this wrapping is wrong. When user has provided their own connector then there should be any reason to wrap it and add your own tls.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.