diff options
Diffstat (limited to 'handler.c')
| -rw-r--r-- | handler.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -28,6 +28,7 @@ struct handler struct handler *h; struct server_client *c; struct http_ctx *http; + int (*fn)(const struct http_payload *, struct http_response *, void *); struct client *next; } *clients; @@ -59,7 +60,19 @@ static int on_payload(const struct http_payload *const p, const struct elem *const e = &h->elem[i]; if (e->op == p->op && !wildcard_cmp(p->resource, e->url, true)) - return e->f(p, r, e->user); + { + int ret; + + if (c->fn) + ret = c->fn(p, r, e->user); + else + ret = e->f(p, r, e->user); + + if (!ret) + c->fn = r->step; + + return ret; + } } fprintf(stderr, "Not found: %s\n", p->resource); |
