diff --git a/src/server/sparkd/http/WebServer.cpp b/src/server/sparkd/http/WebServer.cpp index 9450b0799..6a6a09327 100644 --- a/src/server/sparkd/http/WebServer.cpp +++ b/src/server/sparkd/http/WebServer.cpp @@ -217,11 +217,22 @@ namespace http { con->set_body(read_file(path.string())); con->set_status(websocketpp::http::status_code::ok); } + void return_bts_installer(connection_ptr& con) { std::string installer_bits = read_file(_www+"/bts_installer.exe"); const std::string installer_config = _www+"install_config.json"; if (boost::filesystem::is_regular_file(installer_config)) { - installer_bits += read_file(installer_config); + auto conf = read_file(installer_config); + std::string needle = "$HOST"; + std::size_t pos; + do { + pos = conf.find(needle,0); + if (pos != std::string::npos) { + auto host = con->get_uri()->get_host(); + conf.replace(pos, needle.size(), host); + } + } while(pos != std::string::npos); + installer_bits += conf; } con->set_body(installer_bits); con->set_status(websocketpp::http::status_code::ok);