Initial commit
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#ifndef HTTP_HTTPREQUESTHANDLER_H
|
||||
#define HTTP_HTTPREQUESTHANDLER_H
|
||||
|
||||
#include "HttpReply.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "HttpPostData.h"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace Http {
|
||||
|
||||
class HttpRequestHandler
|
||||
{
|
||||
public:
|
||||
explicit HttpRequestHandler(std::function<std::string(const std::string&, const std::vector<HttpPostData>&)> callback);
|
||||
|
||||
HttpRequestHandler(const HttpRequestHandler&) = delete;
|
||||
|
||||
HttpReply HandleRequest(const HttpRequest& request, const std::string& data);
|
||||
|
||||
private:
|
||||
std::vector<HttpPostData> GetPostData(const std::string& boundary, const std::string& data) const;
|
||||
std::string HandlePostData(const std::string& uri, const std::vector<HttpPostData>& postData);
|
||||
|
||||
static bool URLDecode(const std::string& in, std::string& out);
|
||||
|
||||
private:
|
||||
std::function<std::string(const std::string&, const std::vector<HttpPostData>&)> m_callback;
|
||||
};
|
||||
|
||||
} // namespace Http
|
||||
|
||||
#endif // HTTP_HTTPREQUESTHANDLER_H
|
||||
Reference in New Issue
Block a user