HttpReply.h 789 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef HTTP_HTTPREPLY_H
  2. #define HTTP_HTTPREPLY_H
  3. #include "HttpHeaders.h"
  4. #include <asio.hpp>
  5. #include <string>
  6. #include <vector>
  7. namespace Http {
  8. struct HttpReply
  9. {
  10. struct Status
  11. {
  12. enum type
  13. {
  14. Ok = 200,
  15. Created = 201,
  16. Accepted = 202,
  17. NoContent = 204,
  18. MultipleChoices = 300,
  19. MovedPermanently = 301,
  20. MovedTemporarily = 302,
  21. NotModified = 304,
  22. BadRequest = 400,
  23. Unauthorized = 401,
  24. Forbidden = 403,
  25. NotFound = 404,
  26. InternalServerError = 500,
  27. NotImplemented = 501,
  28. BadGateway = 502,
  29. ServiceUnavailable = 503
  30. };
  31. };
  32. Status::type status;
  33. HttpHeaders headers;
  34. std::string content;
  35. std::vector<asio::const_buffer> ToBuffers();
  36. static HttpReply StockReply(Status::type status);
  37. };
  38. } // namespace Http
  39. #endif // HTTP_HTTPREPLY_H