diff --git a/doc/sources/libnghttp2_asio.rst b/doc/sources/libnghttp2_asio.rst index c5c9bec9..bea4c536 100644 --- a/doc/sources/libnghttp2_asio.rst +++ b/doc/sources/libnghttp2_asio.rst @@ -42,7 +42,8 @@ HTTP/2 server looks like this: server.listen ("*", 3000, - [](std::shared_ptr req, std::shared_ptr res) + [](const std::shared_ptr& req, + const std::shared_ptr& res) { res->write_head(200); res->end("hello, world"); @@ -85,7 +86,8 @@ SSL/TLS. server.listen ("*", 3000, - [](std::shared_ptr req, std::shared_ptr res) + [](const std::shared_ptr& req, + const std::shared_ptr& res) { if(req->path() == "/" || req->path() == "/index.html") { res->write_head(200); @@ -130,7 +132,8 @@ Server push is also supported. server.listen ("*", 3000, - [](std::shared_ptr req, std::shared_ptr res) + [](const std::shared_ptr& req, + const std::shared_ptr& res) { if(req->path() == "/") { req->push("GET", "/my.css"); @@ -202,7 +205,8 @@ blocking task there. The example follows: server.listen ("*", 3000, - [](std::shared_ptr req, std::shared_ptr res) + [](const std::shared_ptr& req, + const std::shared_ptr& res) { req->run_task ([res](channel& channel) diff --git a/examples/asio-sv.cc b/examples/asio-sv.cc index d5c43c7f..0827c666 100644 --- a/examples/asio-sv.cc +++ b/examples/asio-sv.cc @@ -65,7 +65,8 @@ int main(int argc, char* argv[]) server.listen ("*", port, - [](std::shared_ptr req, std::shared_ptr res) + [](const std::shared_ptr& req, + const std::shared_ptr& res) { res->write_head(200, { header{ "foo", "bar" } }); res->end("hello, world"); diff --git a/examples/asio-sv2.cc b/examples/asio-sv2.cc index 645e1d59..f173381b 100644 --- a/examples/asio-sv2.cc +++ b/examples/asio-sv2.cc @@ -69,7 +69,8 @@ int main(int argc, char* argv[]) server.listen ("*", port, - [&docroot](std::shared_ptr req, std::shared_ptr res) + [&docroot](const std::shared_ptr& req, + const std::shared_ptr& res) { auto path = percent_decode(req->path()); if(!check_path(path)) { diff --git a/examples/asio-sv3.cc b/examples/asio-sv3.cc index a49ee3d8..241c6fea 100644 --- a/examples/asio-sv3.cc +++ b/examples/asio-sv3.cc @@ -69,7 +69,8 @@ int main(int argc, char* argv[]) server.listen ("*", port, - [](std::shared_ptr req, std::shared_ptr res) + [](const std::shared_ptr& req, + const std::shared_ptr& res) { res->write_head(200); diff --git a/src/asio_http2_impl.cc b/src/asio_http2_impl.cc index 229dcf3b..23f3f1ce 100644 --- a/src/asio_http2_impl.cc +++ b/src/asio_http2_impl.cc @@ -204,7 +204,7 @@ std::string percent_decode(const std::string& s) return util::percentDecode(std::begin(s), std::end(s)); } -std::string http_date(time_t t) +std::string http_date(int64_t t) { return util::http_date(t); } diff --git a/src/includes/nghttp2/asio_http2.h b/src/includes/nghttp2/asio_http2.h index aaca11da..f57eee76 100644 --- a/src/includes/nghttp2/asio_http2.h +++ b/src/includes/nghttp2/asio_http2.h @@ -180,8 +180,8 @@ private: // This is so called request callback. Called every time request is // received. -typedef std::function, - std::shared_ptr)> request_cb; +typedef std::function&, + const std::shared_ptr&)> request_cb; class http2_impl; @@ -233,7 +233,7 @@ bool check_path(const std::string& path); std::string percent_decode(const std::string& s); // Returns HTTP date representation of current posix time |t|. -std::string http_date(time_t t); +std::string http_date(int64_t t); } // namespace asio_http2