Skip to content
This repository has been archived by the owner on Apr 25, 2018. It is now read-only.

Commit

Permalink
In way over my head, and have only cobbled this together through copi…
Browse files Browse the repository at this point in the history
…ous copy/paste action.
  • Loading branch information
mikewest committed Nov 5, 2008
1 parent 7dc32e1 commit 5ff692b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ngx_addon_name=ngx_http_static_etags_module
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES ngx_http_static_etags_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_static_etags_module.c"
67 changes: 67 additions & 0 deletions ngx_http_static_etags_module.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright 2008 Mike West ( http://mikewest.org/ )
*
* The following is released under the Creative Commons BSD license,
* available for your perusal at `http://creativecommons.org/licenses/BSD/`
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_http.h>

#define ALLOWED_METHODS (NGX_HTTP_GET|NGX_HTTP_HEAD)

static void *
ngx_http_static_etags_create_loc_conf(ngx_conf_t *cf);

static char *
ngx_http_static_etags_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child);

static char *
ngx_http_static_etags_post_handler(ngx_conf_t *cf, void *data, void *conf);

typedef struct {
ngx_str_t path;
ngx_str_t type;
} ngx_http_static_etags_loc_conf_t;

static ngx_http_module_t ngx_http_notice_module_ctx = {
NULL, /* preconfiguration */
NULL, /* postconfiguration */

NULL, /* create main configuration */
NULL, /* init main configuration */

NULL, /* create server configuration */
NULL, /* merge server configuration */

ngx_http_static_etags_create_loc_conf, /* create location configuration */
ngx_http_static_etags_merge_loc_conf, /* merge location configuration */
};


ngx_module_t ngx_http_notice_module = {
NGX_MODULE_V1,
&ngx_http_static_etags_module_ctx, /* module context */
ngx_http_static_etags_commands, /* 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 void *
ngx_http_static_etags_create_loc_conf(ngx_conf_t *cf)
{
ngx_http_static_etags_conf_t *conf;

conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_static_etags_conf_t));
if (conf == NULL) return NGX_CONF_ERROR;

return conf;
}

0 comments on commit 5ff692b

Please sign in to comment.