diff --git a/libretroshare/src/jsonapi/p3webui.cc b/libretroshare/src/jsonapi/p3webui.cc index 60fc63ea9..acb907c5d 100644 --- a/libretroshare/src/jsonapi/p3webui.cc +++ b/libretroshare/src/jsonapi/p3webui.cc @@ -76,21 +76,21 @@ public: std::string resource_filename = _base_directory + "/" + directory + filename; RsDbg() << "Reading file: \"" << resource_filename << "\"" << std::endl; - std::ifstream stream( resource_filename, std::ifstream::in ); + std::ifstream stream( resource_filename, std::ifstream::binary); if(stream.is_open()) { - const std::string body = std::string( + const std::vector body = std::vector( std::istreambuf_iterator(stream), std::istreambuf_iterator() ); RsDbg() << __PRETTY_FUNCTION__ - << " body length=" << body.length() << std::endl; + << " body length=" << body.size() << std::endl; const std::multimap headers { { "Content-Type", mime_types[MIME_TYPE_INDEX] }, - { "Content-Length", std::to_string(body.length()) } + { "Content-Length", std::to_string(body.size()) } }; session->close(restbed::OK, body, headers);