Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

client use ipv6 error #2233

Closed
Closed
@lifw555

Description

inline Client::Client(const std::string &scheme_host_port,
 const std::string &client_cert_path,
 const std::string &client_key_path) {
.......
 auto host = m[2].str();
 if (host.empty()) { host = m[3].str(); }
.......

If the client initiates an IPv6 request, the IPv6 address in the host field of the request header is not used [], which can cause the server to receive an error in parsing the request header.

Add the following code to fix this bug

inline Client::Client(const std::string &scheme_host_port,
 const std::string &client_cert_path,
 const std::string &client_key_path) {
.......
 auto host = m[2].str();
 if (host.empty()) { host = m[3].str(); }
 if (host.find(':') != std::string::npos) { host = "[" + host + "]"; } // this code 
.......

Hope it's useful

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /