Closed StanLi-ops closed 2 years ago
I think the client is trying to tell you that you need to connect to a host name, not an IP address. This is a limitation in the underlying rustls library.
I think the client is trying to tell you that you need to connect to a host name, not an IP address. This is a limitation in the underlying rustls library.
It seems that the "--listen" configuration in the server has no effect. The example only works fine with default values. After I use "--listen" to modify the ip and port of the server, the client cannot connect to the server normally whether it uses "localhost" or "127.0.0.1". like this:
[root@localhost quinn]# cargo run --example server ./ --listen 127.0.0.1:4433
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/examples/server ./ --listen '127.0.0.1:4433'`
listening on 127.0.0.1:4433
[root@localhost quinn]# cargo run --example client https://localhost:4433/Cargo.toml
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/examples/client 'https://localhost:4433/Cargo.toml'`
connecting to localhost at [::1]:4433
ERROR: failed to connect: timed out
[root@localhost quinn]#
[root@localhost quinn]# cargo run --example server ./ --listen 127.0.0.1:4433
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/examples/server ./ --listen '127.0.0.1:4433'`
listening on 127.0.0.1:4433
2022-06-22T02:27:38.839686Z ERROR server: connection failed: aborted by peer: the application or application protocol caused the connection to be closed during the handshake
[root@localhost quinn]# cargo run --example client https://127.0.0.1:4433/Cargo.toml
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/examples/client 'https://127.0.0.1:4433/Cargo.toml'`
connecting to 127.0.0.1 at 127.0.0.1:4433
ERROR: failed to connect: the cryptographic handshake failed: error 42: presented server name type wasn't supported
[root@localhost quinn]#
If I want the server to listen on port 1167 instead of 4433, how can I get the example to work? The same goes for custom domains.
You're telling the server to listen on an IPv4 address, and your environment is likely resolving "localhost" to an IPv6 address. Try listening on an IPv6 address.
When I execute the sample program, the following occurs.
server
client
When the ip and port are not configured, it can be executed normally.
server
client
is this normal?