From: Leandro Lucarella Date: Sat, 8 Nov 2003 01:13:21 +0000 (+0000) Subject: Ya anda de nuevo el server. Compila y anda tan (in?)estable como antes, aunque tiene... X-Git-Tag: svn_import~330 X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/commitdiff_plain/df4733677cb16642b53628d22e4d927aadad8b27?ds=inline Ya anda de nuevo el server. Compila y anda tan (in?)estable como antes, aunque tiene muchas chanchadas... :-/ --- diff --git a/Server/include/plaqui/server/httpmessage.h b/Server/include/plaqui/server/httpmessage.h index b188e19..938f9ad 100644 --- a/Server/include/plaqui/server/httpmessage.h +++ b/Server/include/plaqui/server/httpmessage.h @@ -45,13 +45,13 @@ namespace Server { /// Cuerpo del mensaje. std::string body; - protected: + protected: // TODO hacer privados con get() y set() ??? + + public: /// Version HTTP. std::string version; - public: - /// Cabeceras HTTP. HTTPHeaders headers; diff --git a/Server/include/plaqui/server/httprequest.h b/Server/include/plaqui/server/httprequest.h index 92c6de7..44b45a9 100644 --- a/Server/include/plaqui/server/httprequest.h +++ b/Server/include/plaqui/server/httprequest.h @@ -78,9 +78,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. diff --git a/Server/src/controlserver.cpp b/Server/src/controlserver.cpp index 144d236..5d67502 100644 --- a/Server/src/controlserver.cpp +++ b/Server/src/controlserver.cpp @@ -59,7 +59,21 @@ void ControlServer::real_run(void) { //char buf[BUFSIZ]; while (!stop) { HTTPRequest request; - socket >> request; + try { + socket >> request; + } catch (const char* e) { + cerr << "Error: " << e << endl; + stop = true; + continue; + } catch (string e) { + cerr << "Error: " << e << endl; + stop = true; + continue; + } catch (...) { + cerr << "Error desconocido!" << endl; + stop = true; + continue; + } // TODO agregar las verificaciones de abajo a HTTPRequest y padres. /* // Primera línea no vacía (que debe ser el request). @@ -124,9 +138,13 @@ Accept-Ranges: bytes response_xml << " " << endl; response_xml << " " << endl; response_xml << "

PlaQui

" << endl; - response_xml << "

versión 0.2

" << endl; + response_xml << "

versión 0.3

" << endl; response_xml << "

Pedido HTTP

" << endl; response_xml << "