From 1f3774634b122e4ace102c8643f6d9281e3a20de Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 16 Nov 2015 19:06:27 +0200 Subject: Make root configuration option notation to be the same as of AP_ROOT configuration variable --- brep/options.cli | 2 +- brep/package-details.cxx | 5 ++++- brep/package-search.cxx | 5 ++++- brep/package-version-details.cxx | 5 ++++- brep/repository-details.cxx | 5 ++++- brep/types-parsers.cxx | 3 --- etc/httpd.conf | 8 ++++---- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/brep/options.cli b/brep/options.cli index 77dc45a..4126f4a 100644 --- a/brep/options.cli +++ b/brep/options.cli @@ -16,7 +16,7 @@ namespace brep class module { std::uint16_t verb = 0; - butl::dir_path root = "/"; + butl::dir_path root = ""; }; class db diff --git a/brep/package-details.cxx b/brep/package-details.cxx index 780d98a..8be6108 100644 --- a/brep/package-details.cxx +++ b/brep/package-details.cxx @@ -70,7 +70,10 @@ namespace brep // server process. // static const size_t rp (options_->results_on_page ()); - static const dir_path& rt (options_->root ()); + static const dir_path& rt ( + options_->root ().empty () + ? dir_path ("/") + : options_->root ()); const string& name (*rq.path ().rbegin ()); const string en (mime_url_encode (name)); diff --git a/brep/package-search.cxx b/brep/package-search.cxx index 1617e58..6a349b0 100644 --- a/brep/package-search.cxx +++ b/brep/package-search.cxx @@ -65,7 +65,10 @@ namespace brep // server process. // static const size_t rp (options_->results_on_page ()); - static const dir_path& rt (options_->root ()); + static const dir_path& rt ( + options_->root ().empty () + ? dir_path ("/") + : options_->root ()); params::package_search pr; diff --git a/brep/package-version-details.cxx b/brep/package-version-details.cxx index d00c10a..a1fe017 100644 --- a/brep/package-version-details.cxx +++ b/brep/package-version-details.cxx @@ -54,7 +54,10 @@ namespace brep // The module options object is not changed after being created once per // server process. // - static const dir_path& rt (options_->root ()); + static const dir_path& rt ( + options_->root ().empty () + ? dir_path ("/") + : options_->root ()); auto i (rq.path ().rbegin ()); version v; diff --git a/brep/repository-details.cxx b/brep/repository-details.cxx index b8a2e5b..86a6099 100644 --- a/brep/repository-details.cxx +++ b/brep/repository-details.cxx @@ -50,7 +50,10 @@ namespace brep // The module options object is not changed after being created once per // server process. // - static const dir_path& rt (options_->root ()); + static const dir_path& rt ( + options_->root ().empty () + ? dir_path ("/") + : options_->root ()); xml::serializer s (rs.content (), "About"); const string& title (s.output_name ()); diff --git a/brep/types-parsers.cxx b/brep/types-parsers.cxx index f7c2f11..6236000 100644 --- a/brep/types-parsers.cxx +++ b/brep/types-parsers.cxx @@ -28,9 +28,6 @@ namespace brep try { x = T (v); - - if (x.empty ()) - throw invalid_value (o, v); } catch (const invalid_path&) { diff --git a/etc/httpd.conf b/etc/httpd.conf index 7c25a6d..348db67 100644 --- a/etc/httpd.conf +++ b/etc/httpd.conf @@ -43,7 +43,7 @@ LoadModule alias_module /usr/lib64/httpd/modules/mod_alias.so LoadModule package_search_srv ${AP_MODULE_DIR}/libbrep-apache.so - package-search-root ${AP_ROOT}/ + package-search-root "${AP_ROOT}" package-search-db-host ${AP_DB_HOST} package-search-db-port ${AP_DB_PORT} package-search-conf ${AP_CONFIG_DIR}/package-search.conf @@ -52,7 +52,7 @@ LoadModule package_search_srv ${AP_MODULE_DIR}/libbrep-apache.so LoadModule package_details_srv ${AP_MODULE_DIR}/libbrep-apache.so - package-details-root ${AP_ROOT}/ + package-details-root "${AP_ROOT}" package-details-db-host ${AP_DB_HOST} package-details-db-port ${AP_DB_PORT} package-details-conf ${AP_CONFIG_DIR}/package-details.conf @@ -61,7 +61,7 @@ LoadModule package_details_srv ${AP_MODULE_DIR}/libbrep-apache.so LoadModule package_version_details_srv ${AP_MODULE_DIR}/libbrep-apache.so - package-version-details-root ${AP_ROOT}/ + package-version-details-root "${AP_ROOT}" package-version-details-db-host ${AP_DB_HOST} package-version-details-db-port ${AP_DB_PORT} package-version-details-conf ${AP_CONFIG_DIR}/package-version-details.conf @@ -70,7 +70,7 @@ LoadModule package_version_details_srv ${AP_MODULE_DIR}/libbrep-apache.so LoadModule repository_details_srv ${AP_MODULE_DIR}/libbrep-apache.so - repository-details-root ${AP_ROOT}/ + repository-details-root "${AP_ROOT}" repository-details-db-host ${AP_DB_HOST} repository-details-db-port ${AP_DB_PORT} -- cgit v1.1