diff --git a/include/HTTPserver.h b/include/HTTPserver.h index 04dd44b4fc5b..21785ddddace 100644 --- a/include/HTTPserver.h +++ b/include/HTTPserver.h @@ -30,7 +30,7 @@ extern bool enable_users_login; class HTTPserver { private: bool use_http, can_accept_requests; - char *docs_dir, *scripts_dir, *runtime_dir; + char *docs_dir, *scripts_dir; struct mg_context *httpd_v4; bool ssl_enabled, gui_access_restricted; char *captive_redirect_addr; @@ -51,7 +51,7 @@ class HTTPserver { #endif public: - HTTPserver(const char *_docs_dir, const char *_scripts_dir, const char *_data_dir); + HTTPserver(const char *_docs_dir, const char *_scripts_dir); ~HTTPserver(); bool valid_user_pwd(char *user, char *pass); @@ -60,7 +60,6 @@ class HTTPserver { inline char* get_docs_dir() { return(docs_dir); }; inline char* get_scripts_dir() { return(scripts_dir); }; - inline char* get_runtime_dir() { return(runtime_dir); }; inline bool is_ssl_enabled() { return(ssl_enabled); }; inline bool is_gui_access_restricted() { return(gui_access_restricted); }; inline void start_accepting_requests() { can_accept_requests = true; }; diff --git a/include/Ntop.h b/include/Ntop.h index 45bf76a08f01..5d38d4ce4da9 100644 --- a/include/Ntop.h +++ b/include/Ntop.h @@ -348,14 +348,6 @@ class Ntop { inline char* get_install_dir() { return(install_dir); }; inline void set_install_dir(char *id) { snprintf(install_dir, MAX_PATH, "%s", id); }; - /** - * @brief Get the runtime directory, which contains executable lua scripts generated at runtime. - * @note Currently an alias for the working directory - * - * @return The path of runtime directory. - */ - inline char* get_runtime_dir() { return(working_dir); }; - inline char* get_plugins_dir() { return(plugins_dir); }; inline char* get_shadow_plugins_dir() { return(shadow_plugins_dir); }; inline void swap_plugins_dir() { cur_plugins_dir = !cur_plugins_dir; refreshPluginsDir(); }; diff --git a/src/HTTPserver.cpp b/src/HTTPserver.cpp index 0fabfb6fe2c1..395f3eb9cba7 100644 --- a/src/HTTPserver.cpp +++ b/src/HTTPserver.cpp @@ -970,8 +970,8 @@ static int handle_lua_request(struct mg_connection *conn) { snprintf(path, sizeof(path), "%s/lua/metrics.lua", httpserver->get_scripts_dir()); else if(strncmp(request_info->uri, "/plugins/", 9) == 0) - snprintf(path, sizeof(path), "%s/plugins/scripts/%s", - httpserver->get_runtime_dir(), request_info->uri + 9); + snprintf(path, sizeof(path), "%s/scripts/%s", + ntop->get_plugins_dir(), request_info->uri + 9); else snprintf(path, sizeof(path), "%s%s%s", httpserver->get_scripts_dir(), @@ -1179,7 +1179,7 @@ int init_client_x509_auth(void *ctx) { /* ****************************************** */ -HTTPserver::HTTPserver(const char *_docs_dir, const char *_scripts_dir, const char *_runtime_dir) { +HTTPserver::HTTPserver(const char *_docs_dir, const char *_scripts_dir) { bool good_ssl_cert = false; struct timeval tv; @@ -1217,7 +1217,6 @@ HTTPserver::HTTPserver(const char *_docs_dir, const char *_scripts_dir, const ch gui_access_restricted = true; docs_dir = strdup(_docs_dir), scripts_dir = strdup(_scripts_dir); - runtime_dir = strdup(_runtime_dir); ssl_enabled = false; httpserver = this; #ifdef HAVE_NEDGE @@ -1354,7 +1353,7 @@ HTTPserver::~HTTPserver() { if(wispr_captive_data) free(wispr_captive_data); if(captive_redirect_addr) free(captive_redirect_addr); - free(docs_dir), free(scripts_dir), free(runtime_dir); + free(docs_dir), free(scripts_dir); ntop->getTrace()->traceEvent(TRACE_NORMAL, "HTTP server terminated"); }; diff --git a/src/main.cpp b/src/main.cpp index cfa9ddd045b6..38be959cbe29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -329,7 +329,7 @@ int main(int argc, char *argv[]) /* Register the HTTP server before dropping the privileges. This is required * in order to possibly bind the HTTP server to privileged ports (< 1024) */ - ntop->registerHTTPserver(new HTTPserver(prefs->get_docs_dir(), prefs->get_scripts_dir(), ntop->get_runtime_dir())); + ntop->registerHTTPserver(new HTTPserver(prefs->get_docs_dir(), prefs->get_scripts_dir())); /* Drop the privileges before initializing the network interfaces. This * is necessary as the initialization may create files/directories, which