| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #ifndef HTTPSERVER_H
- #define HTTPSERVER_H
- #include "HttpPostData.h"
- #include <functional>
- #include <memory>
- #include <vector>
- namespace Http {
- class HttpServerImpl;
- class HttpServer
- {
- public:
- struct HttpReply
- {
- struct Status
- {
- enum type
- {
- Ok = 200,
- Created = 201,
- Accepted = 202,
- NoContent = 204,
- MultipleChoices = 300,
- MovedPermanently = 301,
- MovedTemporarily = 302,
- NotModified = 304,
- BadRequest = 400,
- Unauthorized = 401,
- Forbidden = 403,
- NotFound = 404,
- InternalServerError = 500,
- NotImplemented = 501,
- BadGateway = 502,
- ServiceUnavailable = 503
- };
- };
- Status::type status;
- std::string content;
- };
- public:
- typedef std::function<HttpReply(const std::string&, const std::vector<HttpPostData>&)> CallbackMethod;
- public:
- HttpServer(unsigned short port, CallbackMethod callback);
- ~HttpServer();
- void Wait();
- private:
- std::unique_ptr<HttpServerImpl> m_pHttpServerImpl;
- };
- } // namespace Http
- #endif // HTTPSERVER_H
|