From 233fd31982f60db47f82149e2b178fa6d804f7bb Mon Sep 17 00:00:00 2001 From: eidheim Date: Wed, 29 Jun 2016 12:26:11 +0200 Subject: [PATCH] Updated work example --- http_examples.cpp | 3 +-- https_examples.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/http_examples.cpp b/http_examples.cpp index c9c3683..53aadf8 100644 --- a/http_examples.cpp +++ b/http_examples.cpp @@ -89,11 +89,10 @@ int main() { //Get example simulating heavy work in a separate thread server.resource["^/work$"]["GET"]=[&server](shared_ptr response, shared_ptr /*request*/) { - *response << "HTTP/1.1 200 OK\r\n"; thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); string message="Work done"; - *response << "Content-Length: " << message.length() << "\r\n\r\n" << message; + *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; }); work_thread.detach(); }; diff --git a/https_examples.cpp b/https_examples.cpp index 016a92e..d41cc16 100644 --- a/https_examples.cpp +++ b/https_examples.cpp @@ -89,11 +89,10 @@ int main() { //Get example simulating heavy work in a separate thread server.resource["^/work$"]["GET"]=[&server](shared_ptr response, shared_ptr /*request*/) { - *response << "HTTP/1.1 200 OK\r\n"; thread work_thread([response] { this_thread::sleep_for(chrono::seconds(5)); string message="Work done"; - *response << "Content-Length: " << message.length() << "\r\n\r\n" << message; + *response << "HTTP/1.1 200 OK\r\nContent-Length: " << message.length() << "\r\n\r\n" << message; }); work_thread.detach(); };