Skip to content

Commit

Permalink
http: All http replies should have version set
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
amnonh authored and avikivity committed Oct 27, 2015
1 parent 9d8913a commit c80c5c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion http/httpd.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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<reply> rep) {
then([this, should_close, version = std::move(version)](std::unique_ptr<reply> rep) {
rep->set_version(version).done();
this->_replies.push(std::move(rep));
return make_ready_future<bool>(should_close);
});
Expand Down

0 comments on commit c80c5c0

Please sign in to comment.