Further cleanup of examples

This commit is contained in:
eidheim 2017-06-23 16:28:25 +02:00
commit 0a72f6f280
2 changed files with 2 additions and 4 deletions

View file

@ -127,8 +127,7 @@ int main() {
server.resource["^/work$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) { server.resource["^/work$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) {
thread work_thread([response] { thread work_thread([response] {
this_thread::sleep_for(chrono::seconds(5)); this_thread::sleep_for(chrono::seconds(5));
string message="Work done"; response->write("Work done");
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message;
}); });
work_thread.detach(); work_thread.detach();
}; };

View file

@ -125,8 +125,7 @@ int main() {
server.resource["^/work$"]["GET"]=[](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) { server.resource["^/work$"]["GET"]=[](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) {
thread work_thread([response] { thread work_thread([response] {
this_thread::sleep_for(chrono::seconds(5)); this_thread::sleep_for(chrono::seconds(5));
string message="Work done"; response->write("Work done");
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message;
}); });
work_thread.detach(); work_thread.detach();
}; };