void Server::send_reply(http::Response& rep) { Connection* con = connections_[rep.stream_id()]; std::stringstream out; out << "HTTP/1.1 " << rep.status() << " Did it\r\n"; for(int i = 0; i < rep.headers_size(); i++) { const http::Header& h = rep.headers(i); out << h.custom_key() << ": " << h.value() << "\r\n"; } out << "Content-Length: " << rep.body().size() << "\r\n"; out << "\r\n"; std::cout << "<DEBUG>\n" << out.str() << "\n</DEBUG>\n"; con->write(out.str()); con->write(rep.body()); }