diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-08 13:45:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-14 12:02:13 +0200 |
commit | e28ab8f48c891c03cf4b3a8ed88b98d38a561960 (patch) | |
tree | 0ae1dbb54e497fc797e5a73fcf3dd2dc487a5572 /brep/package-version-details.cxx | |
parent | a31dfac365feef7838b01b1efd3fe058c89484d7 (diff) |
Separate brep module configuration from Apache server configuration
Diffstat (limited to 'brep/package-version-details.cxx')
-rw-r--r-- | brep/package-version-details.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/brep/package-version-details.cxx b/brep/package-version-details.cxx index a0ad7d4..8f6cd7d 100644 --- a/brep/package-version-details.cxx +++ b/brep/package-version-details.cxx @@ -16,9 +16,10 @@ #include <web/module> #include <web/mime-url-encoding> -#include <brep/page> #include <brep/types> #include <brep/utility> + +#include <brep/page> #include <brep/options> #include <brep/package> #include <brep/package-odb> @@ -36,10 +37,13 @@ init (scanner& s) options_ = make_shared<options::package_version_details> ( s, unknown_mode::fail, unknown_mode::fail); + if (options_->root ().empty ()) + options_->root (dir_path ("/")); + db_ = shared_database (options_->db_host (), options_->db_port ()); } -void brep::package_version_details:: +bool brep::package_version_details:: handle (request& rq, response& rs) { using namespace web; @@ -50,10 +54,7 @@ handle (request& rq, response& rs) // The module options object is not changed after being created once per // server process. // - static const dir_path& root ( - options_->root ().empty () - ? dir_path ("/") - : options_->root ()); + static const dir_path& root (options_->root ()); auto i (rq.path ().rbegin ()); version ver; @@ -77,7 +78,7 @@ handle (request& rq, response& rs) try { - param_scanner s (rq.parameters ()); + name_value_scanner s (rq.parameters ()); params = params::package_version_details ( s, unknown_mode::fail, unknown_mode::fail); @@ -151,7 +152,7 @@ handle (request& rq, response& rs) if (const auto& d = pkg->description) s << (full ? P_DESCRIPTION (*d, id) - : P_DESCRIPTION (*d, options_->description_length (), + : P_DESCRIPTION (*d, options_->description_len (), url (!full, id))); assert (pkg->location); @@ -301,10 +302,11 @@ handle (request& rq, response& rs) s << H3 << "Changes" << ~H3 << (full ? PRE_CHANGES (ch) - : PRE_CHANGES (ch, options_->description_length (), - url (!full, "changes"))); + : PRE_CHANGES (ch, options_->changes_len (), url (!full, "changes"))); s << ~DIV << ~BODY << ~HTML; + + return true; } |