X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/1b53a979e1de9034a9755955ea22cd40ed138f23..f27c218d18ebf7198e07249aca1eed625da914fd:/Server/include/plaqui/server/httpmessage.h?ds=inline diff --git a/Server/include/plaqui/server/httpmessage.h b/Server/include/plaqui/server/httpmessage.h index 888eacf..730bf0a 100644 --- a/Server/include/plaqui/server/httpmessage.h +++ b/Server/include/plaqui/server/httpmessage.h @@ -28,6 +28,7 @@ #ifndef PLAQUI_HTTPMESSAGE_H #define PLAQUI_HTTPMESSAGE_H +#include "plaqui/server/httpheaders.h" #include namespace PlaQui { @@ -37,6 +38,18 @@ 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 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: @@ -44,7 +57,9 @@ namespace Server { /// Cuerpo del mensaje. std::string body; - protected: + protected: // TODO hacer privados con get() y set() ??? + + public: /// Version HTTP. std::string version; @@ -64,13 +79,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. @@ -95,6 +110,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); + }; }