From 21033565488f6c63b4c40962cccfdc8b6ca32b2a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 7 Jul 2018 19:09:53 +0300 Subject: Add support for package submission --- web/apache/service.hxx | 68 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'web/apache/service.hxx') diff --git a/web/apache/service.hxx b/web/apache/service.hxx index fca0ea2..2fbcd0a 100644 --- a/web/apache/service.hxx +++ b/web/apache/service.hxx @@ -31,22 +31,22 @@ namespace web // configuration context to the request handler. // // This Apache service implementation first makes a copy of the provided - // (in the constructor below) module exemplar for each directory context. + // (in the constructor below) handler exemplar for each directory context. // It then initializes each of these "context exemplars" with the (merged) // set of configuration options. Finally, when handling a request, it // copies the corresponding "context exemplar" to create the "handling // instance". Note that the "context exemplars" are created as a copy of // the provided exemplar, which is never initialized. As a result, it is - // possible to detect if the module's copy constructor is used to create a - // "context exemplar" or a "handling instance". + // possible to detect if the handler's copy constructor is used to create + // a "context exemplar" or a "handling instance". // class service: ::module { public: // Note that the module exemplar is stored by-reference. // - template - service (const std::string& name, M& exemplar) + template + service (const std::string& name, H& exemplar) : ::module { STANDARD20_MODULE_STUFF, @@ -55,7 +55,7 @@ namespace web nullptr, nullptr, nullptr, - ®ister_hooks + ®ister_hooks #ifdef AP_MODULE_HAS_FLAGS , AP_MODULE_FLAG_NONE @@ -69,15 +69,15 @@ namespace web // Set configuration context management hooks. // // The overall process of building the configuration hierarchy for a - // module is as follows: + // handler is as follows: // // 1. Apache creates directory and server configuration contexts for - // scopes containing module-defined directives by calling the + // scopes containing handler-defined directives by calling the // create_{server,dir}_context() callback functions. For directives // at the server scope the special directory context is created as // well. // - // 2. Apache calls parse_option() function for each module-defined + // 2. Apache calls parse_option() function for each handler-defined // directive. The function parses the directives and places the // resulting options into the corresponding configuration context. // It also establishes the directory-server contexts relations. @@ -89,7 +89,7 @@ namespace web // 4. Apache calls config_finalizer() which complements the directory // contexts options with the ones from the enclosing servers. // - // 5. Apache calls worker_initializer() which creates module exemplar + // 5. Apache calls worker_initializer() which creates handler exemplar // for each directory configuration context that have // 'SetHandler ' directive in effect for it. // @@ -100,14 +100,14 @@ namespace web // create_server_config = &create_server_context; create_dir_config = &create_dir_context; - merge_server_config = &merge_server_context; + merge_server_config = &merge_server_context; - // instance () is invented to delegate processing from apache + // instance () is invented to delegate processing from apache // request handler C function to the service non static member // function. This appoach resticts number of service objects per - // specific module implementation class with just one instance. + // specific handler implementation class with just one instance. // - service*& srv (instance ()); + service*& srv (instance ()); assert (srv == nullptr); srv = this; } @@ -118,7 +118,7 @@ namespace web } private: - template + template static service*& instance () noexcept { @@ -126,45 +126,45 @@ namespace web return instance; } - template + template static void register_hooks (apr_pool_t*) noexcept { // The config_finalizer() function is called at the end of Apache // server configuration parsing. // - ap_hook_post_config (&config_finalizer, NULL, NULL, APR_HOOK_LAST); + ap_hook_post_config (&config_finalizer, NULL, NULL, APR_HOOK_LAST); // The worker_initializer() function is called right after Apache // worker process is started. Called for every new process spawned. // ap_hook_child_init ( - &worker_initializer, NULL, NULL, APR_HOOK_LAST); + &worker_initializer, NULL, NULL, APR_HOOK_LAST); // The request_handler () function is called for each client request. // - ap_hook_handler (&request_handler, NULL, NULL, APR_HOOK_LAST); + ap_hook_handler (&request_handler, NULL, NULL, APR_HOOK_LAST); } - template + template static int config_finalizer (apr_pool_t*, apr_pool_t*, apr_pool_t*, server_rec* s) noexcept { - instance ()->finalize_config (s); + instance ()->finalize_config (s); return OK; } - template + template static void worker_initializer (apr_pool_t*, server_rec* s) noexcept { - auto srv (instance ()); + auto srv (instance ()); log l (s, srv); - srv->template init_worker (l); + srv->template init_worker (l); } - template + template static int request_handler (request_rec* r) noexcept; @@ -176,12 +176,12 @@ namespace web enum class request_handling { // Configuration scope has 'SetHandler ' directive - // specified. The module is allowed to handle a request in the scope. + // specified. The handler is allowed to handle a request in the scope. // allowed, // Configuration scope has 'SetHandler |None' - // directive specified. The module is disallowed to handle a request + // directive specified. The handler is disallowed to handle a request // in the scope. // disallowed, @@ -207,7 +207,7 @@ namespace web // // We will then use the pointers to these context objects as keys in // maps to (1) the corresponding application-level option lists during - // the configuration cycle and to (2) the corresponding module exemplar + // the configuration cycle and to (2) the corresponding handler exemplar // during the HTTP request handling phase. We will also use the same // type for both directory and server configuration contexts. // @@ -267,12 +267,12 @@ namespace web static void* create_dir_context (apr_pool_t*, char* dir) noexcept; - template + template static void* merge_server_context (apr_pool_t*, void* enclosing, void* enclosed) noexcept { - instance ()->complement ( + instance ()->complement ( context_cast (enclosed), context_cast (enclosing)); return enclosed; @@ -298,17 +298,17 @@ namespace web void complement (context* enclosed, context* enclosing); - template + template void init_worker (log&); - template + template int handle (request&, const context*, log&) const; private: std::string name_; - module& exemplar_; + handler& exemplar_; option_descriptions option_descriptions_; // The context objects pointed to by the key can change during the @@ -320,7 +320,7 @@ namespace web // The context objects pointed to by the key can not change during the // request handling phase. // - using exemplars = std::map>; + using exemplars = std::map>; exemplars exemplars_; bool options_parsed_ = false; -- cgit v1.1