Skip to content

invalid ipv6 host #1739

@LYF1999

Description

@LYF1999
 let uri = "mysql://username:p@ssw0rd@[::1]:5432/database";
 let opts = MySqlConnectOptions::from_str(uri).unwrap();
 println!("{:?}", opts.host); // the opts.host is "[::1]"

sqlx try to use this host to connect at

None => Socket::connect_tcp(&options.host, options.port).await?,

but [::1] is a invalid address for tokio::net::TcpStream::connect, which expect a address like ::1 without a []
so, we will get an error failed to lookup address information: Name or service not known

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions