#endif // DEBUG
}
-HTTPResponse::HTTPResponse(const string& version):
- HTTPMessage(version) {
+HTTPResponse::HTTPResponse(const string& body, const string& version):
+ HTTPMessage(body, version) {
#ifdef DEBUG
- cerr << __FILE__ << ": version = " << version << endl;
+ cerr << __FILE__ << ": body.length = " << body.length()
+ << " | version = " << version << endl;
#endif // DEBUG
}
}
// Averiguo la versión.
string::size_type pos = line.find_first_of(String::SPACE_CHARS, 5);
- string ver = line.substr(5, pos);
+ string ver = line.substr(5, pos - 5);
if ((ver == "1.1") || (ver == "1.0")) {
resp.version = ver;
} else {
cerr << __FILE__ << ": operator<<()" << endl;
#endif // DEBUG
os << "HTTP/" << resp.version << " " << resp.status_code << " "
- << HTTPMessage::reason(resp.status_code) << "\n\r";
- // TODO ver que este bien el \r\l
+ << HTTPMessage::reason(resp.status_code) << "\r\n";
os << static_cast<const HTTPMessage&>(resp);
return os;
}