X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/f27c218d18ebf7198e07249aca1eed625da914fd..f5a1e732bf3907cabd004932aba3256b31d9d282:/Server/src/httpresponse.cpp?ds=sidebyside diff --git a/Server/src/httpresponse.cpp b/Server/src/httpresponse.cpp index 562dbf9..46cc55e 100644 --- a/Server/src/httpresponse.cpp +++ b/Server/src/httpresponse.cpp @@ -44,10 +44,11 @@ HTTPResponse::~HTTPResponse(void) { #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 } @@ -90,7 +91,7 @@ istream& operator>>(istream& is, HTTPResponse& resp) } // 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 { @@ -127,8 +128,7 @@ ostream& operator<<(ostream& os, const HTTPResponse& resp) { 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(resp); return os; }