diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-20 07:20:22 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-20 07:20:22 +0000 |
commit | 4f245967cb241021844b678e75ff48c6783113d3 (patch) | |
tree | 3375eb90f619656950d07a14090abf9d3e381707 /sca-cpp/trunk/modules/http/httpd.hpp | |
parent | 8fdc6a6dc4b2b23b923d8cbfba5190933155e95d (diff) |
Optimize server modules a bit. Pass individual config elements instead of the whole server config. Load target composite once into the request. Enable loading of shared component implementations from the main contribution.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1291134 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/http/httpd.hpp')
-rw-r--r-- | sca-cpp/trunk/modules/http/httpd.hpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp index 7c839c1306..af075a04e8 100644 --- a/sca-cpp/trunk/modules/http/httpd.hpp +++ b/sca-cpp/trunk/modules/http/httpd.hpp @@ -120,6 +120,22 @@ template<typename C> C& dirConf(const void* c) { } /** + * Returns a request-scoped module configuration. + */ +template<typename C> C& makeRequestConf(const request_rec* r, const module* mod) { + C* c = new (gc_new<C>(r->pool)) C(r->pool, r); + ap_set_module_config(r->request_config, mod, c); + return *c; +} + +template<typename C> C& requestConf(const request_rec* r, const module* mod) { + C* c = (C*)ap_get_module_config(r->request_config, mod); + if (c == NULL) + return makeRequestConf<C>(r, mod); + return *c; +} + +/** * Return the host name for a server. */ const string hostName(const server_rec* s, const string& def = "localhost") { @@ -425,17 +441,6 @@ const int reportStatus(const failable<int>& rc) { } /** - * Construct a redirect URI. - */ -const string redirectURI(const string& file, const string& pi) { - return file + pi; -} - -const string redirectURI(const string& file, const string& pi, const string& args) { - return file + pi + "?" + args; -} - -/** * Convert a value to an HTTPD request struc */ request_rec* request(const value& v) { |