summaryrefslogtreecommitdiff
path: root/src/send_file.hh
blob: aca21b66d511314d585d9a5d56839c219b7dbbda (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
#ifndef SEND_FILE_HH
#define SEND_FILE_HH

#include "transport.hh"

#include <filesystem>
#include <memory>
#include <optional>
#include <string_view>

class Logger;
class Config;

class SendFile {
public:
  virtual ~SendFile() = default;

  static std::unique_ptr<SendFile> create();

  virtual bool setup(Logger* logger, Config* config,
                     std::string_view sendfile_header_name,
                     std::string_view sendfile_path_name) = 0;

  virtual std::unique_ptr<Transport::Response> create_ok_file(
      Transport* transport, std::filesystem::path const& full_path,
      std::string_view relative_path, std::string_view etag,
      std::optional<uint64_t> size) = 0;

protected:
  SendFile() = default;
  SendFile(SendFile const&) = delete;
  SendFile& operator=(SendFile const&) = delete;
};

#endif  // SEND_FILE_HH