67 lines
2.1 KiB
C
67 lines
2.1 KiB
C
#include <ngx_config.h>
|
|
#include <ngx_core.h>
|
|
#include <ngx_http.h>
|
|
|
|
static ngx_int_t ngx_http_pow_init(ngx_conf_t *cf);
|
|
static ngx_int_t ngx_http_pow_handler(ngx_http_request_t *r);
|
|
|
|
static ngx_http_module_t ngx_http_pow_module_ctx = {
|
|
NULL, /* preconfiguration */
|
|
ngx_http_pow_init, /* postconfiguration */
|
|
|
|
NULL, /* create main configuration */
|
|
NULL, /* init main configuration */
|
|
|
|
NULL, /* create server configuration */
|
|
NULL, /* merge server configuration */
|
|
|
|
NULL, /* create location configuration */
|
|
NULL /* merge location configuration */
|
|
};
|
|
|
|
ngx_module_t ngx_http_pow = {
|
|
NGX_MODULE_V1,
|
|
&ngx_http_pow_module_ctx, /* module context */
|
|
NULL, /* module directives */
|
|
NGX_HTTP_MODULE, /* module type */
|
|
NULL, /* init master */
|
|
NULL, /* init module */
|
|
NULL, /* init process */
|
|
NULL, /* init thread */
|
|
NULL, /* exit thread */
|
|
NULL, /* exit process */
|
|
NULL, /* exit master */
|
|
NGX_MODULE_V1_PADDING
|
|
};
|
|
|
|
static ngx_int_t
|
|
ngx_http_pow_handler(ngx_http_request_t *r)
|
|
{
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
|
"ngx_http_pow_handler was invoked");
|
|
|
|
return NGX_DECLINED;
|
|
}
|
|
|
|
|
|
static ngx_int_t
|
|
ngx_http_pow_init(ngx_conf_t *cf)
|
|
{
|
|
ngx_http_handler_pt *h;
|
|
ngx_http_core_main_conf_t *cmcf;
|
|
|
|
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
|
|
|
h = ngx_array_push(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers);
|
|
if (h == NULL) {
|
|
return NGX_ERROR;
|
|
}
|
|
|
|
*h = ngx_http_pow_handler;
|
|
|
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cf->log, 0,
|
|
"ngx_http_pow_init was invoked");
|
|
|
|
return NGX_OK;
|
|
}
|