diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-07-28 19:37:14 +0200 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-07-28 19:37:14 +0200 |
commit | 4bd049e639d80028ccdc909c0fef2de4e810cf50 (patch) | |
tree | 3d134c5061dabd2a0207a78a68d6bd2677e0253c /apps | |
parent | 12b835ddd5a431ef1bcd1bd2c89e8f92256ec435 (diff) |
Adding possibility to set lifetime when publishing content using the http helper.
Change-Id: I0107bb216e961c189a62f5c6bb3b22fc563919a7
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/http/icnet_http_echo_server.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/http/icnet_http_echo_server.cc b/apps/http/icnet_http_echo_server.cc index 17bdb693..223646a2 100644 --- a/apps/http/icnet_http_echo_server.cc +++ b/apps/http/icnet_http_echo_server.cc @@ -26,11 +26,17 @@ void onPayload(std::shared_ptr<HTTPServerPublisher> &publisher, const uint8_t *b std::cout << string << std::endl; std::stringstream response; - response << "HTTP/1.0 200 OK\r\n" << "Content-Length: " << size << "\r\n\r\n" << string; + response << "HTTP/1.1 200 OK\r\n" << "Content-Length: " << size << "\r\n\r\n" << string; std::string response_string = response.str(); + std::chrono::milliseconds expiry_time(std::chrono::milliseconds(4000 * 1000)); + std::thread t([publisher, response_string]() { - publisher->publishContent((uint8_t *) response_string.data(), response_string.size(), 0, true); + publisher->publishContent((uint8_t *) response_string.data(), + response_string.size(), + std::chrono::milliseconds(transport::default_values::content_object_expiry_time), + 0, + true); publisher->serveClients(); }); |