# include <iostream>
#endif // DEBUG
-PlaQui::Server::HTTPHeaders::~HTTPHeaders(void) {
+using namespace std;
+using namespace PlaQui::Server;
+
+HTTPHeaders::~HTTPHeaders(void) {
#ifdef DEBUG
- std::cerr << __FILE__ << ": destructor." << std::endl;
+ cerr << __FILE__ << ": destructor." << endl;
#endif // DEBUG
}
-istream& operator>>(std::istream& is, PlaQui::Server::httpheaders& h) {
+istream& operator>>(istream& is, HTTPHeaders& h) {
#ifdef DEBUG
- std::cerr << __FILE__ << ": operator>>()" << std::endl;
+ cerr << __FILE__ << ": operator>>()" << endl;
#endif // DEBUG
char buf[BUFSIZ];
is.getline(buf, BUFSIZ);
- std::string sbuf = buf;
- std::string::size_type pos = sbuf.find(":");
- if (pos == std::string::npos) {
+ string sbuf = buf;
+ string::size_type pos = sbuf.find(":");
+ if (pos == string::npos) {
// FIXME poner mejores excepciones.
throw "Wrong header";
}
- (*this)[sbuf.substr(0, pos)] = sbuf.substr(pos + 1);
+ h[sbuf.substr(0, pos)] = sbuf.substr(pos + 1);
return is;
}
-ostream& operator<<(std::ostream& os, PlaQui::Server::HTTPMessage) {
+ostream& operator<<(ostream& os, const HTTPHeaders& h) {
#ifdef DEBUG
- std::cerr << __FILE__ << ": operator<<()" << std::endl;
+ cerr << __FILE__ << ": operator<<()" << endl;
#endif // DEBUG
- for (HTTPMessage::const_iterator i = begin(); i != end(); ++i) {
- os << i->first << ": " << i->second << "\r\l";
+ for (HTTPHeaders::const_iterator i = h.begin();
+ i != h.end(); ++i) {
+ os << i->first << ": " << i->second << "\r\n";
}
return os;
}