]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/include/plaqui/server/httprequest.h
arregle un poquito la and
[z.facultad/75.42/plaqui.git] / Server / include / plaqui / server / httprequest.h
index 0f2145268fe3fa16f52abe2c89b9bccf04f40d06..5f0757ef66aeb064b53a0d2a9ad63ab43b6b554b 100644 (file)
 #ifndef PLAQUI_HTTPREQUEST_H
 #define PLAQUI_HTTPREQUEST_H
 
-#include "httpmessage.h"
+#include "plaqui/server/httperror.h"
+#include "plaqui/server/httpmessage.h"
+#include <socket++/sockstream.h>
 #include <string>
+#include <istream>
+#include <ostream>
 
 namespace PlaQui {
 
@@ -78,9 +82,12 @@ namespace Server {
 
                // Atributos.
 
-               protected:
+               protected: // TODO hacer privados con get() y set() ???
+
+               public:
 
                        /// Método HTTP.
+                       /// @todo TODO - convertirlo a string? Hace todo más fácil (y más ineficiente :)
                        HTTPMethod method;
 
                        /// URI.
@@ -104,19 +111,25 @@ namespace Server {
                        HTTPRequest(const std::string& uri = "/",
                                        const HTTPMethod& method = GET,
                                        const std::string& query = "",
-                                       const std::string& http = "1.1");
+                                       const std::string& body = "",
+                                       const std::string& version = "1.1");
+
+                       /**
+                        * Obtiene el método como un string.
+                        */
+                       std::string method_str(void) const;
 
                        /**
                         * Obtiene los datos del pedido HTTP desde un texto.
                         */
-                       friend std::istream& operator>>(std::istream& is,
-                                       const HTTPRequest& req);
+                       friend std::istream& operator>>(std::istream& is, HTTPRequest& req)
+                               throw(HTTPError, sockerr, std::ios::failure);
 
                        /**
                         * Convierte el pedido HTTP en texto.
                         */
                        friend std::ostream& operator<<(std::ostream& os,
-                                       const HTTPRequest& req);
+                                       const HTTPRequest& req) throw(sockerr);
 
        };