X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/df4733677cb16642b53628d22e4d927aadad8b27..6bffb655ac989fe4f115763270f84175bf24e4bb:/Server/include/plaqui/server/httpmessage.h diff --git a/Server/include/plaqui/server/httpmessage.h b/Server/include/plaqui/server/httpmessage.h index 938f9ad..2f6f957 100644 --- a/Server/include/plaqui/server/httpmessage.h +++ b/Server/include/plaqui/server/httpmessage.h @@ -38,6 +38,19 @@ namespace Server { /// Pedido HTTP. class HTTPMessage { + // Constantes. + + public: + + /// \todo TODO completar codigos. + static const unsigned OK = 200; + static const unsigned BAD_REQUEST = 401; + static const unsigned NOT_FOUND = 404; + static const unsigned LENGTH_REQUIRED = 411; + static const unsigned INTERNAL_SERVER_ERROR = 500; + static const unsigned NOT_IMPLEMENTED = 501; + static const unsigned HTTP_VERSION_NOT_SUPPORTED = 505; + // Atributos. private: @@ -67,13 +80,13 @@ namespace Server { /** * Constructor. */ - HTTPMessage(const std::string& http_version = "1.1"); + //HTTPMessage(const std::string& http_version = "1.1"); /** * Constructor. */ - //HTTPMessage(const std::string& body, - // const std::string& http_version = "1.1"); + HTTPMessage(const std::string& _body = "", + const std::string& _version = "1.1"); /** * Obtiene el cuerpo del mensaje. @@ -98,6 +111,13 @@ namespace Server { friend std::ostream& operator<<(std::ostream& os, const HTTPMessage& m); + /** + * Obtiene la razón según un código. + * + * \param code Código de estado. + */ + static std::string reason(unsigned code); + }; }