Unit test Connection
Boost asio provides a test stream object that we can use to begin unit
testing the connection object. This patchset uses it to re-enable
some simple http1.1 tests. There's some features that have snuck into
the connection class that aren't compatible with a stream (like ip
address getting), so unfortunately we do need the connection class to
be aware if it's in test mode, but that tradeoff seems worthwhile.
Tested: Unit test pass.
Change-Id: Id8b1f8866582b58502dbafe6139f841bf64b8ef3
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/http/http_server.hpp b/http/http_server.hpp
index b290ad7..2a6bd9f 100644
--- a/http/http_server.hpp
+++ b/http/http_server.hpp
@@ -38,14 +38,14 @@
adaptorCtx(std::move(adaptorCtxIn))
{}
- Server(Handler* handlerIn, const std::string& bindaddr, uint16_t port,
+ Server(Handler* handlerIn, uint16_t port,
const std::shared_ptr<boost::asio::ssl::context>& adaptorCtxIn,
const std::shared_ptr<boost::asio::io_context>& io =
std::make_shared<boost::asio::io_context>()) :
Server(handlerIn,
std::make_unique<boost::asio::ip::tcp::acceptor>(
*io, boost::asio::ip::tcp::endpoint(
- boost::asio::ip::make_address(bindaddr), port)),
+ boost::asio::ip::make_address("0.0.0.0"), port)),
adaptorCtxIn, io)
{}