summaryrefslogtreecommitdiffhomepage
path: root/https.h
blob: e009b78763b6177d3d48783449bf46e2e2a1d780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include <memory>
#include <string>
#include <unordered_map>

#include <boost/asio/dispatch.hpp>
#include <boost/asio/strand.hpp>
#include <boost/beast/ssl.hpp>
#include <boost/asio/ssl.hpp>

#include "config.h"
#include "server.h"

namespace ssl = boost::asio::ssl;       // from <boost/asio/ssl.hpp>

namespace HTTPS {

static const ssl::context_base::method tls_method {ssl::context::tlsv13};

class Server: public ::Server
{
public:
 typedef std::unordered_map<std::string, std::shared_ptr<ssl::context>> ctx_type;

private:
 ctx_type m_ctx;
 ssl::context m_ctx_dummy{tls_method}; // Initial use, will be replaced by host specific context (with specific certificate)
 
 const Socket& m_socket;

public:
 Server(Config& config, boost::asio::io_context& ioc, const Socket& socket);
 virtual ~Server();

 int start() override;
};

}