]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/httpmessage.h
hay pequenias modificaciones en el workplace, se cuelga por eso pero en un rato lo...
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / httpmessage.h
index b188e19b5bb508b46694833b5dd75e34878e5df7..30bc794de5dd336709934409ce984f5df2826dd6 100644 (file)
@@ -38,6 +38,20 @@ namespace Server {
        /// Pedido HTTP.
        class HTTPMessage {
 
        /// 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 CONFLICT                   = 409;
+                       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:
                // Atributos.
 
                private:
@@ -45,13 +59,11 @@ namespace Server {
                        /// Cuerpo del mensaje.
                        std::string body;
 
                        /// Cuerpo del mensaje.
                        std::string body;
 
-               protected:
+               public: // TODO hacer privados con get() y set() ???
 
                        /// Version HTTP.
                        std::string version;
 
 
                        /// Version HTTP.
                        std::string version;
 
-               public:
-
                        /// Cabeceras HTTP.
                        HTTPHeaders headers;
 
                        /// Cabeceras HTTP.
                        HTTPHeaders headers;
 
@@ -67,13 +79,13 @@ namespace Server {
                        /**
                         * Constructor.
                         */
                        /**
                         * Constructor.
                         */
-                       HTTPMessage(const std::string& http_version = "1.1");
+                       //HTTPMessage(const std::string& http_version = "1.1");
 
                        /**
                         * Constructor.
                         */
 
                        /**
                         * 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.
 
                        /**
                         * Obtiene el cuerpo del mensaje.
@@ -98,6 +110,13 @@ namespace Server {
                        friend std::ostream& operator<<(std::ostream& os,
                                        const HTTPMessage& m);
 
                        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);
+
        };
 
 }
        };
 
 }