]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/httpresponse.h
- Se sobreescribe el método Connection::finish() para que cierre el socket.
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / httpresponse.h
index f5c0afd81744a4053426b67a6780626cdab1241c..462c0829c879a81ca95e503720bed9ec7353fd37 100644 (file)
@@ -28,7 +28,8 @@
 #ifndef PLAQUI_HTTPRESPONSE_H
 #define PLAQUI_HTTPRESPONSE_H
 
-#include "httpmessage.h"
+#include "plaqui/server/httperror.h"
+#include "plaqui/server/httpmessage.h"
 #include <string>
 
 namespace PlaQui {
@@ -38,9 +39,21 @@ namespace Server {
        /// Respuesta HTTP.
        class HTTPResponse: public HTTPMessage {
 
+               // Tipos.
+
+               public:
+
+                       typedef enum {
+                               INVALID_HTTP_RESPONSE,
+                               INVALID_HTTP_VERSION,
+                               INVALID_HTTP_RESPONSE_CODE,
+                               MISSING_HTTP_RESPONSE_CODE
+                       } Error;
+
                // Atributos.
 
-               protected:
+               //protected: FIXME - hacer privado con get/set?
+               public:
 
                        /// Código de estado.
                        unsigned status_code;
@@ -65,14 +78,12 @@ namespace Server {
                        /**
                         * Constructor.
                         */
-                       //HTTPResponse(const std::string& body,
-                       //              const std::string& version = "1.1");
+                       HTTPResponse(const HTTPError& error);
 
                        /**
                         * Constructor.
                         */
-                       //HTTPResponse(unsigned status_code, const std::string& reason,
-                       //              const std::string& version = "1.1");
+                       HTTPResponse(unsigned status_code, const std::string& body = "");
 
                        /**
                         * Constructor.
@@ -85,7 +96,7 @@ namespace Server {
                         * Obtiene los datos de la respuesta HTTP desde un texto.
                         */
                        friend std::istream& operator>>(std::istream& is,
-                                       HTTPResponse& resp);
+                                       HTTPResponse& resp) throw(Error, std::ios::failure);
 
                        /**
                         * Convierte la respuesta HTTP en texto.