37 lines
897 B
C++
37 lines
897 B
C++
#ifndef HTTP_HTTPREQUESTHANDLER_H
|
|
#define HTTP_HTTPREQUESTHANDLER_H
|
|
|
|
#include "HttpReply.h"
|
|
#include "Internal/HttpRequest.h"
|
|
#include "HttpPostData.h"
|
|
#include "HttpServer.h"
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
|
|
namespace Http {
|
|
|
|
class HttpRequestHandler
|
|
{
|
|
public:
|
|
explicit HttpRequestHandler(HttpServer::CallbackMethod callback);
|
|
|
|
HttpRequestHandler(const HttpRequestHandler&) = delete;
|
|
|
|
HttpReply HandleRequest(const Internal::HttpRequest& request, const std::string& data);
|
|
|
|
private:
|
|
std::vector<HttpPostData> GetPostData(const std::string& boundary, const std::string& data) const;
|
|
HttpServer::HttpReply ForwardRequest(const std::string& uri, const std::vector<HttpPostData>& postData);
|
|
|
|
static bool URLDecode(const std::string& in, std::string& out);
|
|
|
|
private:
|
|
HttpServer::CallbackMethod m_callback;
|
|
};
|
|
|
|
} // namespace Http
|
|
|
|
#endif // HTTP_HTTPREQUESTHANDLER_H
|