generated from Sithas/conan_template
Initial commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/beast/core.hpp>
|
||||
#include <boost/beast/http.hpp>
|
||||
#include <boost/beast/version.hpp>
|
||||
#include <boost/asio/dispatch.hpp>
|
||||
#include <boost/asio/strand.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "helpers.h"
|
||||
|
||||
namespace uad
|
||||
{
|
||||
namespace beast = boost::beast;
|
||||
namespace http = beast::http;
|
||||
using tcp = boost::asio::ip::tcp;
|
||||
namespace net = boost::asio;
|
||||
|
||||
class Session : public std::enable_shared_from_this<Session>
|
||||
{
|
||||
beast::tcp_stream stream_;
|
||||
beast::flat_buffer buffer_;
|
||||
std::shared_ptr<std::string const> doc_root_;
|
||||
http::request<http::string_body> req_;
|
||||
|
||||
public:
|
||||
Session(
|
||||
tcp::socket&& socket,
|
||||
std::shared_ptr<std::string const> const& doc_root);
|
||||
|
||||
void Run();
|
||||
|
||||
void DoRead();
|
||||
|
||||
void OnRead(
|
||||
beast::error_code ec,
|
||||
std::size_t bytes_transferred);
|
||||
|
||||
void SendResponse(http::message_generator&& msg);
|
||||
|
||||
void OnWrite(
|
||||
bool keep_alive,
|
||||
beast::error_code ec,
|
||||
std::size_t bytes_transferred);
|
||||
|
||||
void DoClose();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user