yhirose / cpp-httplib

A C++ header-only HTTP/HTTPS server and client library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When acting as a server, receiving a POST request with an empty body that takes a long time to respond.

BromideY opened this issue · comments

Server code:

httplib::Server svr;

svr.Post("/hi", [](const httplib::Request &, httplib::Response &res) {
    res.set_content("Hello World!", "text/plain");
});

svr.listen("0.0.0.0", 10001);

Then use curl to request:

curl -X POST localhost:10001/hi

Usually it will take 2s or 3s to respond ...

Thanks for the feedback, but it's too little information. It seems like your network environment causes the problem.