]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/example/cpp03/http/server4/file_handler.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp03 / http / server4 / file_handler.hpp
CommitLineData
7c673cae
FG
1//
2// file_handler.hpp
3// ~~~~~~~~~~~~~~~~
4//
b32b8144 5// Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9//
10
11#ifndef HTTP_SERVER4_FILE_HANDLER_HPP
12#define HTTP_SERVER4_FILE_HANDLER_HPP
13
14#include <string>
15
16namespace http {
17namespace server4 {
18
19struct reply;
20struct request;
21
22/// The common handler for all incoming requests.
23class file_handler
24{
25public:
26 /// Construct with a directory containing files to be served.
27 explicit file_handler(const std::string& doc_root);
28
29 /// Handle a request and produce a reply.
30 void operator()(const request& req, reply& rep);
31
32private:
33 /// The directory containing the files to be served.
34 std::string doc_root_;
35
36 /// Perform URL-decoding on a string. Returns false if the encoding was
37 /// invalid.
38 static bool url_decode(const std::string& in, std::string& out);
39};
40
41} // namespace server4
42} // namespace http
43
44#endif // HTTP_SERVER4_FILE_HANDLER_HPP