# $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
/// Version HTTP.
std::string version;
+ public:
+
/// Cabeceras HTTP.
HTTPHeaders headers;
#ifdef DEBUG
cerr << __FILE__ << ": real_run()" << endl;
#endif // DEBUG
- char buf[BUFSIZ];
+ //char buf[BUFSIZ];
while (!stop) {
HTTPRequest request;
socket >> request;
// 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
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;
}
#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;
}
#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;
}
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;
}
#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;
}
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;
}