uhttpd/file: fix string out of buffer range on uh_defer_script
[project/uhttpd.git] / plugin.h
1 /*
2 * uhttpd - Tiny single-threaded httpd
3 *
4 * Copyright (C) 2010-2013 Jo-Philipp Wich <xm@subsignal.org>
5 * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 #include "uhttpd.h"
21
22 struct uhttpd_ops {
23 void (*dispatch_add)(struct dispatch_handler *d);
24 bool (*path_match)(const char *prefix, const char *url);
25
26 bool (*create_process)(struct client *cl, struct path_info *pi, char *url,
27 void (*cb)(struct client *cl, struct path_info *pi, char *url));
28 struct env_var *(*get_process_vars)(struct client *cl, struct path_info *pi);
29
30 void (*http_header)(struct client *cl, int code, const char *summary);
31 void (*client_error)(struct client *cl, int code, const char *summary, const char *fmt, ...);
32 void (*request_done)(struct client *cl);
33 void (*chunk_write)(struct client *cl, const void *data, int len);
34 void (*chunk_printf)(struct client *cl, const char *format, ...);
35
36 int (*urlencode)(char *buf, int blen, const char *src, int slen);
37 int (*urldecode)(char *buf, int blen, const char *src, int slen);
38 };
39
40 struct uhttpd_plugin {
41 struct list_head list;
42
43 int (*init)(const struct uhttpd_ops *ops, struct config *conf);
44 void (*post_init)(void);
45 };