diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-17 19:20:41 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-18 05:50:31 +0200 |
commit | 64e889f0ca84121a4e92840f9283cf9cf36279e6 (patch) | |
tree | 747ace5fbecd7cf854ce9bdbf02b4cabb25454e1 | |
parent | 13a2e1a89d575332ae4155b22021306891c010de (diff) |
Bugfix: brep::module::handle asserts the module is loaded
-rw-r--r-- | brep/module.cxx | 8 | ||||
-rw-r--r-- | web/apache/service.cxx | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/brep/module.cxx b/brep/module.cxx index d3ffcb4..9e7eda3 100644 --- a/brep/module.cxx +++ b/brep/module.cxx @@ -33,12 +33,16 @@ namespace brep bool module:: handle (request& rq, response& rs, log& l) { - assert (loaded_); - log_ = &l; try { + if (!loaded_) + { + MODULE_DIAG; + fail << "not initialized, presumably due to misconfiguration"; + } + return handle (rq, rs); } catch (const server_error& e) diff --git a/web/apache/service.cxx b/web/apache/service.cxx index 1741af3..c6f830b 100644 --- a/web/apache/service.cxx +++ b/web/apache/service.cxx @@ -123,7 +123,14 @@ namespace web { l.write (nullptr, 0, func_name.c_str (), APLOG_EMERG, e.what ()); - // Terminate the root apache process. + // Terminate the root apache process. Indeed we can only try to + // terminate the process, and most likely will fail in a production + // environment where the apache root process usually runs under root + // and worker processes run under some other user. This is why the + // implementation should consider the possibility of not being + // initialized at the time of HTTP request processing. In such a case + // it should respond with an internal server error (500 HTTP status), + // reporting misconfiguration. // ::kill (::getppid (), SIGTERM); } |