forked from boostorg/beast
@@ -756,7 +756,7 @@ class http_session
|
||||
}
|
||||
};
|
||||
|
||||
std::string const& doc_root_;
|
||||
std::shared_ptr<std::string const> doc_root_;
|
||||
http::request<http::string_body> req_;
|
||||
queue queue_;
|
||||
|
||||
@@ -771,7 +771,7 @@ public:
|
||||
http_session(
|
||||
boost::asio::io_context& ioc,
|
||||
boost::beast::flat_buffer buffer,
|
||||
std::string const& doc_root)
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
: doc_root_(doc_root)
|
||||
, queue_(*this)
|
||||
, timer_(ioc,
|
||||
@@ -849,7 +849,7 @@ public:
|
||||
}
|
||||
|
||||
// Send the response
|
||||
handle_request(doc_root_, std::move(req_), queue_);
|
||||
handle_request(*doc_root_, std::move(req_), queue_);
|
||||
|
||||
// If we aren't at the queue limit, try to pipeline another request
|
||||
if(! queue_.is_full())
|
||||
@@ -896,7 +896,7 @@ public:
|
||||
plain_http_session(
|
||||
tcp::socket socket,
|
||||
boost::beast::flat_buffer buffer,
|
||||
std::string const& doc_root)
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
: http_session<plain_http_session>(
|
||||
socket.get_executor().context(),
|
||||
std::move(buffer),
|
||||
@@ -977,7 +977,7 @@ public:
|
||||
tcp::socket socket,
|
||||
ssl::context& ctx,
|
||||
boost::beast::flat_buffer buffer,
|
||||
std::string const& doc_root)
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
: http_session<ssl_http_session>(
|
||||
socket.get_executor().context(),
|
||||
std::move(buffer),
|
||||
@@ -1107,7 +1107,7 @@ class detect_session : public std::enable_shared_from_this<detect_session>
|
||||
ssl::context& ctx_;
|
||||
boost::asio::strand<
|
||||
boost::asio::io_context::executor_type> strand_;
|
||||
std::string const& doc_root_;
|
||||
std::shared_ptr<std::string const> doc_root_;
|
||||
boost::beast::flat_buffer buffer_;
|
||||
|
||||
public:
|
||||
@@ -1115,7 +1115,7 @@ public:
|
||||
detect_session(
|
||||
tcp::socket socket,
|
||||
ssl::context& ctx,
|
||||
std::string const& doc_root)
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
: socket_(std::move(socket))
|
||||
, ctx_(ctx)
|
||||
, strand_(socket_.get_executor())
|
||||
@@ -1171,14 +1171,14 @@ class listener : public std::enable_shared_from_this<listener>
|
||||
ssl::context& ctx_;
|
||||
tcp::acceptor acceptor_;
|
||||
tcp::socket socket_;
|
||||
std::string const& doc_root_;
|
||||
std::shared_ptr<std::string const> doc_root_;
|
||||
|
||||
public:
|
||||
listener(
|
||||
boost::asio::io_context& ioc,
|
||||
ssl::context& ctx,
|
||||
tcp::endpoint endpoint,
|
||||
std::string const& doc_root)
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
: ctx_(ctx)
|
||||
, acceptor_(ioc)
|
||||
, socket_(ioc)
|
||||
@@ -1276,7 +1276,7 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
auto const address = boost::asio::ip::make_address(argv[1]);
|
||||
auto const port = static_cast<unsigned short>(std::atoi(argv[2]));
|
||||
std::string const doc_root = argv[3];
|
||||
auto const doc_root = std::make_shared<std::string>(argv[3]);
|
||||
auto const threads = std::max<int>(1, std::atoi(argv[4]));
|
||||
|
||||
// The io_context is required for all I/O
|
||||
|
||||
Reference in New Issue
Block a user