From b72424fca7a6af6ff7921101c450850fef875152 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sun, 6 Mar 2016 13:52:48 +0300 Subject: Support multiple instances of brep in a single Apache instance --- brep/mod-package-details.cxx | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'brep/mod-package-details.cxx') diff --git a/brep/mod-package-details.cxx b/brep/mod-package-details.cxx index fa07dd1..a5c2e3e 100644 --- a/brep/mod-package-details.cxx +++ b/brep/mod-package-details.cxx @@ -24,6 +24,18 @@ using namespace odb::core; using namespace brep::cli; +// While currently the user-defined copy constructor is not required (we don't +// need to deep copy nullptr's), it is a good idea to keep the placeholder +// ready for less trivial cases. +// +brep::package_details:: +package_details (const package_details& r) + : module (r), + options_ (r.initialized_ ? r.options_ : nullptr), + db_ (r.initialized_ ? r.db_ : nullptr) +{ +} + void brep::package_details:: init (scanner& s) { @@ -61,13 +73,8 @@ handle (request& rq, response& rs) MODULE_DIAG; - // The module options object is not changed after being created once per - // server process. - // - static const size_t res_page (options_->search_results ()); - static const dir_path& root (options_->root ()); - static const fragment& logo (options_->logo ()); - static const vector& menu (options_->menu ()); + const size_t res_page (options_->search_results ()); + const dir_path& root (options_->root ()); const string& name (*rq.path ().rbegin ()); const string ename (mime_url_encode (name)); @@ -130,7 +137,7 @@ handle (request& rq, response& rs) << SCRIPT << " " << ~SCRIPT << ~HEAD << BODY - << DIV_HEADER (root, logo, menu) + << DIV_HEADER (root, options_->logo (), options_->menu ()) << DIV(ID="content"); if (full) -- cgit v1.1