X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/cd6078479123cd2cfe62df2d838633c143649edf..f27c218d18ebf7198e07249aca1eed625da914fd:/Server/include/plaqui/server/httpresponse.h?ds=inline diff --git a/Server/include/plaqui/server/httpresponse.h b/Server/include/plaqui/server/httpresponse.h index 936d2a3..bc8f900 100644 --- a/Server/include/plaqui/server/httpresponse.h +++ b/Server/include/plaqui/server/httpresponse.h @@ -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 namespace PlaQui { @@ -38,6 +39,17 @@ 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: @@ -65,27 +77,25 @@ namespace Server { /** * Constructor. */ - HTTPResponse(const Serializable& 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. */ - HTTPResponse(unsigned status_code, const std::string& reason, - const std::string& body, - const std::string& version = "1.1"); + //HTTPResponse(unsigned status_code, const std::string& reason, + // const std::string& body, + // const std::string& version = "1.1"); /** * Obtiene los datos de la respuesta HTTP desde un texto. */ friend std::istream& operator>>(std::istream& is, - const HTTPResponse& resp); + HTTPResponse& resp) throw(Error, std::ios::failure); /** * Convierte la respuesta HTTP en texto.