aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-06-30 19:20:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-08-06 20:34:25 +0200
commit8e866579cb459c5104c532d5e41d562d45236ea5 (patch)
treef72548e3499bfdc50bc1183ec014d14e6b53918c /web
parentc188831c50456754de79aadc26df74149cb00422 (diff)
Implement loader
Diffstat (limited to 'web')
-rw-r--r--web/apache/log4
-rw-r--r--web/apache/request8
-rw-r--r--web/apache/request.cxx8
-rw-r--r--web/apache/request.ixx3
-rw-r--r--web/apache/service16
-rw-r--r--web/apache/service.cxx14
-rw-r--r--web/apache/service.txx4
-rw-r--r--web/apache/stream4
8 files changed, 31 insertions, 30 deletions
diff --git a/web/apache/log b/web/apache/log
index c976a65..c568ef5 100644
--- a/web/apache/log
+++ b/web/apache/log
@@ -5,8 +5,8 @@
#ifndef WEB_APACHE_LOG
#define WEB_APACHE_LOG
-#include <httpd/httpd.h> // request_rec
-#include <httpd/http_log.h>
+#include <httpd.h> // request_rec
+#include <http_log.h>
#include <cstdint> // uint64_t
#include <algorithm> // min()
diff --git a/web/apache/request b/web/apache/request
index 75e9add..59d4600 100644
--- a/web/apache/request
+++ b/web/apache/request
@@ -7,9 +7,9 @@
#include <apr_strings.h>
-#include <httpd/httpd.h>
-#include <httpd/http_core.h>
-#include <httpd/util_script.h>
+#include <httpd.h>
+#include <http_core.h>
+#include <util_script.h>
#include <ios>
#include <chrono>
@@ -18,10 +18,10 @@
#include <cassert>
#include <istream>
#include <ostream>
+#include <utility> // move()
#include <streambuf>
#include <stdexcept>
#include <exception>
-#include <algorithm> // move
#include <web/module>
#include <web/apache/stream>
diff --git a/web/apache/request.cxx b/web/apache/request.cxx
index f89f0e7..7727b35 100644
--- a/web/apache/request.cxx
+++ b/web/apache/request.cxx
@@ -15,9 +15,9 @@
#include <sstream>
#include <ostream>
#include <cstring>
+#include <utility> // move()
#include <stdexcept>
#include <streambuf>
-#include <algorithm> // move()
using namespace std;
@@ -80,7 +80,7 @@ namespace web
for (auto h (reinterpret_cast<const apr_table_entry_t *> (ha->elts));
n--; ++h)
{
- if (!::strcasecmp (h->key, "Cookie"))
+ if (::strcasecmp (h->key, "Cookie") == 0)
{
for (const char* n (h->val); n != 0; )
{
@@ -121,8 +121,8 @@ namespace web
content (status_code status, const string& type, bool buffer)
{
if (out_ && status == rec_->status && buffer == buffer_ &&
- !::strcasecmp (rec_->content_type ? rec_->content_type : "",
- type.c_str ()))
+ ::strcasecmp (rec_->content_type ? rec_->content_type : "",
+ type.c_str ()) == 0)
{
return *out_;
}
diff --git a/web/apache/request.ixx b/web/apache/request.ixx
index 9fa9e6d..0d3aefc 100644
--- a/web/apache/request.ixx
+++ b/web/apache/request.ixx
@@ -55,7 +55,8 @@ namespace web
form_data_.reset (new std::string ());
const char* ct (apr_table_get (rec_->headers_in, "Content-Type"));
- if (ct && !strncasecmp ("application/x-www-form-urlencoded", ct, 33))
+ if (ct &&
+ strncasecmp ("application/x-www-form-urlencoded", ct, 33) == 0)
{
std::istream& istr (content ());
std::getline (istr, *form_data_);
diff --git a/web/apache/service b/web/apache/service
index fd5f817..7ac01a2 100644
--- a/web/apache/service
+++ b/web/apache/service
@@ -5,12 +5,12 @@
#ifndef WEB_APACHE_SERVICE
#define WEB_APACHE_SERVICE
-#include <httpd/httpd.h>
+#include <httpd.h>
#include <string>
#include <vector>
#include <cassert>
-#include <algorithm> // move()
+#include <utility> // move()
#include <web/module>
#include <web/apache/log>
@@ -45,7 +45,7 @@ namespace web
exemplar_ (exemplar),
option_names_ (std::move (opts))
{
- init_directives();
+ init_directives ();
// instance<M> () is invented to delegate processing from apache
// request handler C function to the service non static member
@@ -89,7 +89,7 @@ namespace web
worker_initializer (apr_pool_t*, server_rec* server) noexcept
{
log l (server);
- instance<M> ()->init_worker(l);
+ instance<M> ()->init_worker (l);
}
template <typename M>
@@ -101,21 +101,21 @@ namespace web
request req (r);
log l (r->server);
- return srv->handle<M>(req, l);
+ return srv->handle<M> (req, l);
}
private:
void
- init_directives();
+ init_directives ();
void
- init_worker(log& l) noexcept;
+ init_worker (log& l) noexcept;
static const char*
add_option (cmd_parms *parms, void *mconfig, const char *value) noexcept;
template <typename M>
- int handle(request& r, log& l) noexcept;
+ int handle (request& r, log& l) noexcept;
private:
std::string name_;
diff --git a/web/apache/service.cxx b/web/apache/service.cxx
index dc06a12..69bb874 100644
--- a/web/apache/service.cxx
+++ b/web/apache/service.cxx
@@ -7,8 +7,8 @@
#include <unistd.h> // getppid()
#include <signal.h> // kill()
-#include <httpd/httpd.h>
-#include <httpd/http_config.h>
+#include <httpd.h>
+#include <http_config.h>
#include <memory> // unique_ptr
#include <string>
@@ -21,9 +21,9 @@ namespace web
namespace apache
{
void service::
- init_directives()
+ init_directives ()
{
- assert(cmds == nullptr);
+ assert (cmds == nullptr);
// Fill apache module directive definitions. Directives share
// common name space in apache configuration file, so to prevent name
@@ -52,13 +52,13 @@ namespace web
};
}
- *d = {};
+ *d = {nullptr, nullptr, nullptr, 0, RAW_ARGS, nullptr};
cmds = directives.release ();
}
const char* service::
- add_option (cmd_parms *parms, void *mconfig, const char *value) noexcept
+ add_option (cmd_parms* parms, void*, const char* value) noexcept
{
service& srv (*reinterpret_cast<service*> (parms->cmd->cmd_data));
string name (parms->cmd->name + srv.name_.length () + 1);
@@ -75,7 +75,7 @@ namespace web
}
void service::
- init_worker(log& l) noexcept
+ init_worker (log& l) noexcept
{
static const string func_name (
"web::apache::service<" + name_ + ">::init_worker");
diff --git a/web/apache/service.txx b/web/apache/service.txx
index 38fa8ad..179980c 100644
--- a/web/apache/service.txx
+++ b/web/apache/service.txx
@@ -2,7 +2,7 @@
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
-#include <httpd/http_log.h>
+#include <http_log.h>
#include <exception>
@@ -12,7 +12,7 @@ namespace web
{
template <typename M>
int service::
- handle(request& r, log& l) noexcept
+ handle (request& r, log& l) noexcept
{
static const std::string func_name (
"web::apache::service<" + name_ + ">::handle");
diff --git a/web/apache/stream b/web/apache/stream
index 93d6855..5a8b4c7 100644
--- a/web/apache/stream
+++ b/web/apache/stream
@@ -5,8 +5,8 @@
#ifndef WEB_APACHE_STREAM
#define WEB_APACHE_STREAM
-#include <httpd/httpd.h>
-#include <httpd/http_protocol.h>
+#include <httpd.h>
+#include <http_protocol.h>
#include <ios> // streamsize
#include <vector>