From 8b28577ec6c389988ecebdd4dc1fd66c0a47b8bd Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 10 Jul 2025 01:07:44 -0400 Subject: [PATCH] Resolve #366 --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index c079488..75330a7 100644 --- a/README.md +++ b/README.md @@ -990,6 +990,25 @@ auto res = cli.Get("/already%20encoded/path"); // Use pre-encoded paths - `true` (default): Automatically encodes spaces, plus signs, newlines, and other special characters - `false`: Sends paths as-is without encoding (useful for pre-encoded URLs) +### Performance Note for Local Connections + +> [!WARNING] +> On Windows systems with improperly configured IPv6 settings, using "localhost" as the hostname may cause significant connection delays (up to 2 seconds per request) due to DNS resolution issues. This affects both client and server operations. For better performance when connecting to local services, use "127.0.0.1" instead of "localhost". +> +> See: https://github.com/yhirose/cpp-httplib/issues/366#issuecomment-593004264 + +```cpp +// May be slower on Windows due to DNS resolution delays +httplib::Client cli("localhost", 8080); +httplib::Server svr; +svr.listen("localhost", 8080); + +// Faster alternative for local connections +httplib::Client cli("127.0.0.1", 8080); +httplib::Server svr; +svr.listen("127.0.0.1", 8080); +``` + Compression -----------