Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/unbit/uwsgi
Browse files Browse the repository at this point in the history
  • Loading branch information
unbit committed Mar 8, 2013
2 parents 2b2da8b + 827b142 commit d61dff3
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions plugins/notfound/notfound.c
@@ -1,14 +1,29 @@
#include <uwsgi.h>

static int uwsgi_request_notfound(struct wsgi_request *wsgi_req) {
static int uwsgi_notfound_log_enabled = 0;

struct uwsgi_option uwsgi_notfound_options[] = {
{"notfound-log", no_argument, 0, "log requests to the notfound plugin", uwsgi_opt_true, &uwsgi_notfound_log_enabled, 0},
{NULL, 0, 0, NULL, NULL, NULL, 0},
};

static int uwsgi_request_notfound(struct wsgi_request *wsgi_req) {
if (uwsgi_parse_vars(wsgi_req)) {
return -1;
}
uwsgi_404(wsgi_req);
return UWSGI_OK;
}

static void uwsgi_notfound_log(struct wsgi_request *wsgi_req) {
if (uwsgi_notfound_log_enabled) {
log_request(wsgi_req);
}
}

struct uwsgi_plugin notfound_plugin = {

.name = "notfound",
.options = uwsgi_notfound_options,
.request = uwsgi_request_notfound,
.after_request = uwsgi_notfound_log,
};

0 comments on commit d61dff3

Please sign in to comment.