#endif // DEBUG
using namespace std;
-using namespace PlaQui::Server;
+
+namespace PlaQui {
+
+namespace Server {
HTTPMessage::~HTTPMessage(void) {
#ifdef DEBUG
stringstream body_ss;
while (is.getline(buf, BUFSIZ)) {
string sbuf = buf;
- if (sbuf.length())
+ if (sbuf.length()) {
if (is_header) {
- istringstream(buf) >> m.headers;
+ stringstream ss;
+ ss << buf;
+ ss >> m.headers;
} else {
body_ss << buf << endl;
}
}
}
// TODO si el body es un serializable, deberia auto deserializarse.
- body = body_ss.str();
+ m.body = body_ss.str();
return is;
}
-ostream& operator<<(ostream& os, HTTPMessage) {
+ostream& operator<<(ostream& os, const HTTPMessage& m) {
#ifdef DEBUG
cerr << __FILE__ << ": operator<<()" << endl;
#endif // DEBUG
- return os << headers << "\r\n" // Fin de cabeceras
- << body;
+ return os << m.headers << "\n\r" // Fin de cabeceras
+ << m.body;
}
+} // namespace Server
+
+} // namespace PlaQui
+