Skip to content

Commit 8b28577

Browse files
committed
Resolve #366
1 parent 55b3890 commit 8b28577

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,25 @@ auto res = cli.Get("/already%20encoded/path"); // Use pre-encoded paths
990990
- `true` (default): Automatically encodes spaces, plus signs, newlines, and other special characters
991991
- `false`: Sends paths as-is without encoding (useful for pre-encoded URLs)
992992
993+
### Performance Note for Local Connections
994+
995+
> [!WARNING]
996+
> 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".
997+
>
998+
> See: https://github.com/yhirose/cpp-httplib/issues/366#issuecomment-593004264
999+
1000+
```cpp
1001+
// May be slower on Windows due to DNS resolution delays
1002+
httplib::Client cli("localhost", 8080);
1003+
httplib::Server svr;
1004+
svr.listen("localhost", 8080);
1005+
1006+
// Faster alternative for local connections
1007+
httplib::Client cli("127.0.0.1", 8080);
1008+
httplib::Server svr;
1009+
svr.listen("127.0.0.1", 8080);
1010+
```
1011+
9931012
Compression
9941013
-----------
9951014

0 commit comments

Comments
 (0)