From c80c5c086fa1609308fdff5e3b94b90596101cad Mon Sep 17 00:00:00 2001 From: Amnon Heiman Date: Tue, 27 Oct 2015 16:37:05 +0200 Subject: [PATCH] http: All http replies should have version set This fix, make sure all reples will return with a version. Before calling the routes object, the http version is kept and before passing the reply to be sent, the version is set in the object. This fixes the mal-formed http responses that were return on errors. Signed-off-by: Amnon Heiman --- http/httpd.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/http/httpd.hh b/http/httpd.hh index 8dab28ad8..8e5184c3f 100644 --- a/http/httpd.hh +++ b/http/httpd.hh @@ -351,9 +351,11 @@ public: should_close = true; } sstring url = set_query_param(*req.get()); + sstring version = req->_version; return _server._routes.handle(url, std::move(req), std::move(resp)). // Caller guarantees enough room - then([this, should_close](std::unique_ptr rep) { + then([this, should_close, version = std::move(version)](std::unique_ptr rep) { + rep->set_version(version).done(); this->_replies.push(std::move(rep)); return make_ready_future(should_close); });