]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/asio/example/cpp03/http/server2/request_handler.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / asio / example / cpp03 / http / server2 / request_handler.hpp
CommitLineData
7c673cae
FG
1//
2// request_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_SERVER2_REQUEST_HANDLER_HPP
12#define HTTP_SERVER2_REQUEST_HANDLER_HPP
13
14#include <string>
15#include <boost/noncopyable.hpp>
16
17namespace http {
18namespace server2 {
19
20struct reply;
21struct request;
22
23/// The common handler for all incoming requests.
24class request_handler
25 : private boost::noncopyable
26{
27public:
28 /// Construct with a directory containing files to be served.
29 explicit request_handler(const std::string& doc_root);
30
31 /// Handle a request and produce a reply.
32 void handle_request(const request& req, reply& rep);
33
34private:
35 /// The directory containing the files to be served.
36 std::string doc_root_;
37
38 /// Perform URL-decoding on a string. Returns false if the encoding was
39 /// invalid.
40 static bool url_decode(const std::string& in, std::string& out);
41};
42
43} // namespace server2
44} // namespace http
45
46#endif // HTTP_SERVER2_REQUEST_HANDLER_HPP