]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Server/src/request.cpp
Se agregan un par de mutex porque el server se muere con segmentation fault
[z.facultad/75.42/plaqui.git] / Server / src / request.cpp
index 9e6aadf07d3bac689b012e423ba224b0101462f9..f40c9f9e2f7608b70b573aea7ba8905ebda93426 100644 (file)
@@ -70,7 +70,7 @@ void PlaQui::Server::Request::set_request(const std::string& req,
        std::cerr << __FILE__ << ": req = " << req << " | host = " << host
                << " | port = " << port << std::endl;
 #endif // DEBUG
-       PlaQui::Server::String request(req);
+       String request(req);
        (*this)["REMOTE_HOST"] = host;
        std::stringstream ss;
        ss << port;
@@ -81,9 +81,8 @@ void PlaQui::Server::Request::set_request(const std::string& req,
                throw "HTTP/1.1 501 Method Not Implemented";
        }
        // Averiguo método.
-       std::string::size_type pos = request.find_first_of(
-                       PlaQui::Server::String::SPACE_CHARS);
-       PlaQui::Server::String method = request.substr(0, pos); 
+       std::string::size_type pos = request.find_first_of(String::SPACE_CHARS);
+       String method = request.substr(0, pos); 
        if ((method.to_upper() == "GET") || (method.to_upper() == "POST")) {
                (*this)["REQUEST_METHOD"] = method;
        } else {
@@ -98,13 +97,13 @@ void PlaQui::Server::Request::set_request(const std::string& req,
                throw "HTTP/1.1 400 Bad Request";
        }
        // Si tiene más espacios, tengo la URI y el protocolo (o un error).
-       pos = request.find_first_of(PlaQui::Server::String::SPACE_CHARS);
+       pos = request.find_first_of(String::SPACE_CHARS);
        if (pos != std::string::npos) {
                // Si el resto es un protocolo válido, agrego más variables.
-               PlaQui::Server::String protocol = request.substr(pos + 1);
+               String protocol = request.substr(pos + 1);
                protocol = protocol.trim();
-               if ((PlaQui::Server::String(protocol).to_upper() == "HTTP/1.0")
-                               || (PlaQui::Server::String(protocol).to_upper() == "HTTP/1.1")) {
+               if ((String(protocol).to_upper() == "HTTP/1.0")
+                               || (String(protocol).to_upper() == "HTTP/1.1")) {
                        (*this)["SERVER_PROTOCOL"] = protocol;
                // Si no es un error.
                } else {