]> git.llucax.com Git - z.facultad/75.42/plaqui.git/commitdiff
Se arreglan detalles, ya compila pero se cuelga cuando se conecta un cliente.
authorLeandro Lucarella <llucax@gmail.com>
Fri, 7 Nov 2003 14:42:05 +0000 (14:42 +0000)
committerLeandro Lucarella <llucax@gmail.com>
Fri, 7 Nov 2003 14:42:05 +0000 (14:42 +0000)
Constructor/Makefile
Server/include/plaqui/server/httpmessage.h
Server/src/controlserver.cpp
Server/src/httpheaders.cpp
Server/src/httpmessage.cpp
Server/src/httprequest.cpp
Server/src/httpresponse.cpp
Server/src/string.cpp
docs/cliente_servidor.dia

index 434739137322f49f28fe5e4df289b26fbe6ec7da..67d9350c1e9c528050cfaeadf1776ad4cbeac5a0 100644 (file)
@@ -3,7 +3,7 @@
 # $Id$
 #
 
-CXXFLAGS=-Wall -g `pkg-config --cflags libglademm-2.0`
+CXXFLAGS=-Wall -O2 `pkg-config --cflags libglademm-2.0`
 LDFLAGS=`pkg-config --libs libglademm-2.0`
 
 TARGETS=main
index 33f546fda3726597709c4b300f64f9fd86030f8e..b188e19b5bb508b46694833b5dd75e34878e5df7 100644 (file)
@@ -50,6 +50,8 @@ namespace Server {
                        /// Version HTTP.
                        std::string version;
 
+               public:
+
                        /// Cabeceras HTTP.
                        HTTPHeaders headers;
 
index 348d77265c1ea4b177765328c6e7fc232aa7a2b9..144d236e2b967140c28aa4b05ad0da38b63909af 100644 (file)
@@ -56,7 +56,7 @@ void ControlServer::real_run(void) {
 #ifdef DEBUG
        cerr << __FILE__ << ": real_run()" << endl;
 #endif // DEBUG
-       char buf[BUFSIZ];
+       //char buf[BUFSIZ];
        while (!stop) {
                HTTPRequest request;
                socket >> request;
@@ -99,11 +99,11 @@ void ControlServer::real_run(void) {
                // Command command = parse_command(request.uri);
                //signal_command_received().emit(command);
 #ifdef DEBUG
-               cerr << "Request: " << endl;
-               for (Request::const_iterator i = request.begin(); i != request.end();
-                               i++) {
-                       cerr << "   " << i->first << ": " << i->second << endl;
-               }
+               cerr << "Request: " << request << endl;
+               //for (HTTPRequest::const_iterator i = request.begin();
+               //              i != request.end(); i++) {
+               //      cerr << "   " << i->first << ": " << i->second << endl;
+               //}
 #endif // DEBUG
                // FIXME - hacer respuesta XML.
                // La respuesta hay que mandarla asincrónicamente porque no puedo
@@ -127,8 +127,8 @@ Accept-Ranges: bytes
                response_xml << "        <p>versión 0.2</p>" << endl;
                response_xml << "        <h2>Pedido HTTP</h2>" << endl;
                response_xml << "        <ul>" << endl;
-               for (Request::const_iterator i = request.begin(); i != request.end();
-                               i++) {
+               for (HTTPHeaders::const_iterator i = request.headers.begin();
+                               i != request.headers.end(); i++) {
                        response_xml << "           <li><b>" << i->first << ":</b> "
                                << i->second << endl;
                }
index 89d8de48578e31555430bed8c50531be2f16ec29..8ebb3a7eac0b10c8f29fe4558ef95e94ed013617 100644 (file)
@@ -66,7 +66,7 @@ ostream& operator<<(ostream& os, const HTTPHeaders& h) {
 #endif // DEBUG
        for (HTTPHeaders::const_iterator i = h.begin();
                        i != h.end(); ++i) {
-               os << i->first << ": " << i->second << "\r\n";
+               os << i->first << ": " << i->second << "\n\r";
        }
        return os;
 }
index 3a563cd2a48e3615a856ff440713851e75da0f73..685fa69ad92b9e8912da6927f00cbbfc80c36ac5 100644 (file)
@@ -110,7 +110,7 @@ ostream& operator<<(ostream& os, const HTTPMessage& m) {
 #ifdef DEBUG
        cerr << __FILE__ << ": operator<<()" << endl;
 #endif // DEBUG
-       return os << m.headers << "\r\n" // Fin de cabeceras
+       return os << m.headers << "\n\r" // Fin de cabeceras
                << m.body;
 }
 
index 2fb866158d3e2fc49157e102e9c4e7fd3985565c..ce9c5abc02f89abdcddab088023fbb52729436eb 100644 (file)
@@ -155,7 +155,7 @@ ostream& operator<<(ostream& os, const HTTPRequest& req) {
                os << "?" << req.query;
        }
        // TODO ver que este bien el \r\l
-       os << " HTTP/" << req.version << "\r\n" << static_cast<const HTTPMessage&>(req);
+       os << " HTTP/" << req.version << "\n\r" << static_cast<const HTTPMessage&>(req);
        return os;
 }
 
index 5a5b2463d2d22e7c59324a3dcbce36071ae486c8..ab26bd3aff5c6a7198ac11cda624ca52a87609a8 100644 (file)
@@ -128,7 +128,7 @@ ostream& operator<<(ostream& os, const HTTPResponse& resp) {
 #ifdef DEBUG
        cerr << __FILE__ << ": operator<<()" << endl;
 #endif // DEBUG
-       os << "HTTP/" << resp.version << " " << resp.status_code << " " << resp.reason << "\r\n";
+       os << "HTTP/" << resp.version << " " << resp.status_code << " " << resp.reason << "\n\r";
        // TODO ver que este bien el \r\l
        os << static_cast<const HTTPMessage&>(resp);
        return os;
index 15e783c63065677f14cc8e1426bff77a3cd0c45e..cd2eaadde7be37f25dad1550337c3003229aaf20 100644 (file)
@@ -54,12 +54,12 @@ String& String::trim(const String& clist) {
 }
 
 String& String::to_lower(void) {
-       transform(begin(), end(), begin(), tolower);
+       transform(begin(), end(), begin(), ::tolower);
        return *this;
 }
 
 String& String::to_upper(void) {
-       transform(begin(), end(), begin(), toupper);
+       transform(begin(), end(), begin(), ::toupper);
        return *this;
 }
 
index 62764e6b024b63bff4b94b01e7003e1777cf9a81..656218c6d86a29bbdc197656987fcb72dc7cfd98 100644 (file)
Binary files a/docs/cliente_servidor.dia and b/docs/cliente_servidor.dia differ