X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/1b53a979e1de9034a9755955ea22cd40ed138f23..d664a4c16bb56138b53e8d6dba92e199bd3ea6c7:/Server/include/plaqui/server/httpresponse.h diff --git a/Server/include/plaqui/server/httpresponse.h b/Server/include/plaqui/server/httpresponse.h index f5c0afd..f4a2db0 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,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; @@ -60,19 +73,18 @@ namespace Server { /** * Constructor. */ - HTTPResponse(const std::string& version = "1.1"); + HTTPResponse(const std::string& body = "", + const std::string& version = "1.1"); /** * 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 +97,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.