Home | History | Annotate | Line # | Download | only in httpd
bozohttpd.h revision 1.49.2.1
      1  1.49.2.1  christos /*	$NetBSD: bozohttpd.h,v 1.49.2.1 2019/06/10 22:05:29 christos Exp $	*/
      2       1.3       tls 
      3      1.20       mrg /*	$eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $	*/
      4       1.1       tls 
      5       1.1       tls /*
      6  1.49.2.1  christos  * Copyright (c) 1997-2019 Matthew R. Green
      7       1.1       tls  * All rights reserved.
      8       1.1       tls  *
      9       1.1       tls  * Redistribution and use in source and binary forms, with or without
     10       1.1       tls  * modification, are permitted provided that the following conditions
     11       1.1       tls  * are met:
     12       1.1       tls  * 1. Redistributions of source code must retain the above copyright
     13       1.1       tls  *    notice, this list of conditions and the following disclaimer.
     14       1.1       tls  * 2. Redistributions in binary form must reproduce the above copyright
     15       1.1       tls  *    notice, this list of conditions and the following disclaimer and
     16       1.1       tls  *    dedication in the documentation and/or other materials provided
     17       1.1       tls  *    with the distribution.
     18       1.1       tls  *
     19       1.1       tls  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20       1.1       tls  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21       1.1       tls  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22       1.1       tls  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23       1.1       tls  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     24       1.1       tls  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     25       1.1       tls  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     26       1.1       tls  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     27       1.1       tls  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28       1.1       tls  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29       1.1       tls  * SUCH DAMAGE.
     30       1.1       tls  *
     31       1.1       tls  */
     32      1.12       mrg #ifndef BOZOHTTOPD_H_
     33      1.12       mrg #define BOZOHTTOPD_H_	1
     34      1.12       mrg 
     35      1.27       mrg #include "netbsd_queue.h"
     36      1.12       mrg 
     37  1.49.2.1  christos #include <stdbool.h>
     38  1.49.2.1  christos #include <signal.h>
     39  1.49.2.1  christos 
     40       1.1       tls #include <sys/stat.h>
     41       1.5       mrg 
     42      1.30   mbalmer #ifndef NO_LUA_SUPPORT
     43      1.30   mbalmer #include <lua.h>
     44      1.30   mbalmer #endif
     45       1.1       tls #include <stdio.h>
     46       1.1       tls 
     47      1.36       mrg /* QNX provides a lot of NetBSD things in nbutil.h */
     48      1.37       mrg #ifdef HAVE_NBUTIL_H
     49      1.36       mrg #include <nbutil.h>
     50      1.36       mrg #endif
     51      1.36       mrg 
     52       1.8       mrg /* lots of "const" but gets free()'ed etc at times, sigh */
     53       1.8       mrg 
     54       1.1       tls /* headers */
     55      1.12       mrg typedef struct bozoheaders {
     56       1.4       rtr 	/*const*/ char *h_header;
     57       1.1       tls 	/*const*/ char *h_value;	/* this gets free()'ed etc at times */
     58      1.12       mrg 	SIMPLEQ_ENTRY(bozoheaders)	h_next;
     59      1.12       mrg } bozoheaders_t;
     60      1.44     elric SIMPLEQ_HEAD(qheaders, bozoheaders);
     61       1.1       tls 
     62      1.30   mbalmer #ifndef NO_LUA_SUPPORT
     63      1.30   mbalmer typedef struct lua_handler {
     64      1.30   mbalmer 	const char	*name;
     65      1.30   mbalmer 	int		 ref;
     66      1.30   mbalmer 	SIMPLEQ_ENTRY(lua_handler)	h_next;
     67      1.30   mbalmer } lua_handler_t;
     68      1.30   mbalmer 
     69      1.30   mbalmer typedef struct lua_state_map {
     70      1.30   mbalmer 	const char 	*script;
     71      1.30   mbalmer 	const char	*prefix;
     72      1.30   mbalmer 	lua_State	*L;
     73      1.30   mbalmer 	SIMPLEQ_HEAD(, lua_handler)	handlers;
     74      1.30   mbalmer 	SIMPLEQ_ENTRY(lua_state_map)	s_next;
     75      1.30   mbalmer } lua_state_map_t;
     76      1.30   mbalmer #endif
     77      1.30   mbalmer 
     78      1.12       mrg typedef struct bozo_content_map_t {
     79      1.12       mrg 	const char	*name;		/* postfix of file */
     80      1.12       mrg 	const char	*type;		/* matching content-type */
     81      1.12       mrg 	const char	*encoding;	/* matching content-encoding */
     82      1.12       mrg 	const char	*encoding11;	/* matching content-encoding (HTTP/1.1) */
     83      1.12       mrg 	const char	*cgihandler;	/* optional CGI handler */
     84      1.12       mrg } bozo_content_map_t;
     85      1.12       mrg 
     86      1.12       mrg /* this struct holds the bozo constants */
     87      1.12       mrg typedef struct bozo_consts_t {
     88      1.12       mrg 	const char	*http_09;	/* "HTTP/0.9" */
     89      1.12       mrg 	const char	*http_10;	/* "HTTP/1.0" */
     90      1.12       mrg 	const char	*http_11;	/* "HTTP/1.1" */
     91      1.12       mrg 	const char	*text_plain;	/* "text/plain" */
     92      1.12       mrg } bozo_consts_t;
     93      1.12       mrg 
     94      1.12       mrg /* this structure encapsulates all the bozo flags and control vars */
     95      1.12       mrg typedef struct bozohttpd_t {
     96      1.12       mrg 	char		*rootdir;	/* root directory */
     97      1.12       mrg 	int		 numeric;	/* avoid gethostby*() */
     98      1.12       mrg 	char		*virtbase;	/* virtual directory base */
     99      1.12       mrg 	int		 unknown_slash;	/* unknown vhosts go to normal slashdir */
    100      1.12       mrg 	int		 logstderr;	/* log to stderr (even if not tty) */
    101      1.12       mrg 	int		 background;	/* drop into daemon mode */
    102      1.12       mrg 	int		 foreground;	/* keep daemon mode in foreground */
    103      1.18      jmmv 	char		*pidfile;	/* path to the pid file, if any */
    104      1.12       mrg 	size_t		 page_size;	/* page size */
    105      1.12       mrg 	char		*slashdir;	/* www slash directory */
    106      1.12       mrg 	char		*bindport;	/* bind port; default "http" */
    107      1.12       mrg 	char		*bindaddress;	/* address for binding - INADDR_ANY */
    108      1.12       mrg 	int		 debug;		/* debugging level */
    109      1.12       mrg 	char		*virthostname;	/* my name */
    110      1.12       mrg 	const char	*server_software;/* our brand :-) */
    111      1.12       mrg 	const char	*index_html;	/* our home page */
    112      1.12       mrg 	const char	*public_html;	/* ~user/public_html page */
    113      1.12       mrg 	int		 enable_users;	/* enable public_html */
    114      1.38       shm 	int		 enable_cgi_users;	/* use the cgi handler */
    115      1.12       mrg 	int		*sock;		/* bound sockets */
    116      1.12       mrg 	int		 nsock;		/* number of above */
    117      1.12       mrg 	struct pollfd	*fds;		/* current poll fd set */
    118      1.12       mrg 	int		 request_times;	/* # times a request was processed */
    119      1.12       mrg 	int		 dir_indexing;	/* handle directories */
    120      1.12       mrg 	int		 hide_dots;	/* hide .* */
    121      1.12       mrg 	int		 process_cgi;	/* use the cgi handler */
    122      1.12       mrg 	char		*cgibin;	/* cgi-bin directory */
    123  1.49.2.1  christos 	unsigned	ssl_timeout;	/* ssl timeout */
    124  1.49.2.1  christos 	unsigned	initial_timeout;/* first line timeout */
    125  1.49.2.1  christos 	unsigned	header_timeout;	/* header lines timeout */
    126  1.49.2.1  christos 	unsigned	request_timeout;/* total session timeout */
    127      1.30   mbalmer #ifndef NO_LUA_SUPPORT
    128      1.30   mbalmer 	int		 process_lua;	/* use the Lua handler */
    129      1.30   mbalmer 	SIMPLEQ_HEAD(, lua_state_map)	lua_states;
    130      1.30   mbalmer #endif
    131      1.12       mrg 	void		*sslinfo;	/* pointer to ssl struct */
    132      1.12       mrg 	int		dynamic_content_map_size;/* size of dyn cont map */
    133      1.12       mrg 	bozo_content_map_t	*dynamic_content_map;/* dynamic content map */
    134      1.12       mrg 	size_t		 mmapsz;	/* size of region to mmap */
    135      1.12       mrg 	char		*getln_buffer;	/* space for getln buffer */
    136      1.12       mrg 	ssize_t		 getln_buflen;	/* length of allocated space */
    137      1.12       mrg 	char		*errorbuf;	/* no dynamic allocation allowed */
    138      1.12       mrg 	bozo_consts_t	 consts;	/* various constants */
    139      1.12       mrg } bozohttpd_t;
    140      1.12       mrg 
    141      1.12       mrg /* bozo_httpreq_t */
    142      1.12       mrg typedef struct bozo_httpreq_t {
    143      1.12       mrg 	bozohttpd_t	*hr_httpd;
    144      1.12       mrg 	int		hr_method;
    145       1.1       tls #define	HTTP_GET	0x01
    146       1.1       tls #define HTTP_POST	0x02
    147       1.1       tls #define HTTP_HEAD	0x03
    148       1.1       tls #define HTTP_OPTIONS	0x04	/* not supported */
    149       1.1       tls #define HTTP_PUT	0x05	/* not supported */
    150       1.1       tls #define HTTP_DELETE	0x06	/* not supported */
    151       1.1       tls #define HTTP_TRACE	0x07	/* not supported */
    152       1.1       tls #define HTTP_CONNECT	0x08	/* not supported */
    153       1.1       tls 	const char *hr_methodstr;
    154      1.24    martin 	char	*hr_virthostname;	/* server name (if not identical
    155      1.24    martin 					   to hr_httpd->virthostname) */
    156       1.8       mrg 	char	*hr_file;
    157      1.14       mrg 	char	*hr_oldfile;	/* if we added an index_html */
    158      1.29   mbalmer 	char	*hr_query;
    159      1.32       mrg 	char	*hr_host;	/* HTTP/1.1 Host: or virtual hostname,
    160      1.32       mrg 				   possibly including a port number */
    161      1.38       shm #ifndef NO_USER_SUPPORT
    162      1.38       shm 	char	*hr_user;	/* username if we hit userdir request */
    163      1.38       shm #endif /* !NO_USER_SUPPORT */
    164       1.1       tls 	const char *hr_proto;
    165       1.1       tls 	const char *hr_content_type;
    166       1.1       tls 	const char *hr_content_length;
    167       1.1       tls 	const char *hr_allow;
    168       1.1       tls 	const char *hr_referrer;
    169       1.5       mrg 	const char *hr_range;
    170       1.7     joerg 	const char *hr_if_modified_since;
    171      1.21     elric 	const char *hr_accept_encoding;
    172       1.5       mrg 	int         hr_have_range;
    173       1.5       mrg 	off_t       hr_first_byte_pos;
    174       1.5       mrg 	off_t       hr_last_byte_pos;
    175       1.8       mrg 	/*const*/ char *hr_remotehost;
    176       1.8       mrg 	/*const*/ char *hr_remoteaddr;
    177       1.8       mrg 	/*const*/ char *hr_serverport;
    178       1.1       tls #ifdef DO_HTPASSWD
    179       1.9       mrg 	/*const*/ char *hr_authrealm;
    180       1.9       mrg 	/*const*/ char *hr_authuser;
    181       1.9       mrg 	/*const*/ char *hr_authpass;
    182       1.1       tls #endif
    183      1.44     elric 	struct qheaders		hr_headers;
    184      1.44     elric 	struct qheaders		hr_replheaders;
    185  1.49.2.1  christos 	unsigned		hr_nheaders;
    186  1.49.2.1  christos 	size_t			hr_header_bytes;
    187      1.12       mrg } bozo_httpreq_t;
    188       1.1       tls 
    189      1.24    martin /* helper to access the "active" host name from a httpd/request pair */
    190      1.24    martin #define	BOZOHOST(HTTPD,REQUEST)	((REQUEST)->hr_virthostname ?		\
    191      1.24    martin 					(REQUEST)->hr_virthostname :	\
    192      1.24    martin 					(HTTPD)->virthostname)
    193      1.24    martin 
    194      1.12       mrg /* structure to hold string based (name, value) pairs with preferences */
    195      1.12       mrg typedef struct bozoprefs_t {
    196      1.41       mrg 	size_t		  size;		/* size of the two arrays */
    197      1.41       mrg 	size_t		  count;	/* # of entries in arrays */
    198      1.12       mrg 	char		**name;		/* names of each entry */
    199      1.12       mrg 	char		**value;	/* values for the name entries */
    200      1.12       mrg } bozoprefs_t;
    201       1.1       tls 
    202  1.49.2.1  christos /* sun2 has a tiny VA range */
    203  1.49.2.1  christos #ifdef __mc68010__
    204  1.49.2.1  christos #ifndef BOZO_WRSZ
    205  1.49.2.1  christos #define BOZO_WRSZ	(16 * 1024)
    206  1.49.2.1  christos #endif
    207  1.49.2.1  christos #ifndef BOZO_MMAPSZ
    208  1.49.2.1  christos #define BOZO_MMAPSZ	(BOZO_WRSZ * 4)
    209  1.49.2.1  christos #endif
    210  1.49.2.1  christos #endif
    211  1.49.2.1  christos 
    212      1.28     pooka /* by default write in upto 64KiB chunks, and mmap in upto 64MiB chunks */
    213      1.28     pooka #ifndef BOZO_WRSZ
    214      1.12       mrg #define BOZO_WRSZ	(64 * 1024)
    215      1.28     pooka #endif
    216      1.28     pooka #ifndef BOZO_MMAPSZ
    217      1.12       mrg #define BOZO_MMAPSZ	(BOZO_WRSZ * 1024)
    218      1.28     pooka #endif
    219       1.1       tls 
    220  1.49.2.1  christos /* only allow this many total headers bytes */
    221  1.49.2.1  christos #define BOZO_HEADERS_MAX_SIZE (16 * 1024)
    222  1.49.2.1  christos 
    223       1.1       tls /* debug flags */
    224       1.1       tls #define DEBUG_NORMAL	1
    225       1.1       tls #define DEBUG_FAT	2
    226       1.1       tls #define DEBUG_OBESE	3
    227       1.1       tls #define DEBUG_EXPLODING	4
    228       1.1       tls 
    229       1.1       tls #define	strornull(x)	((x) ? (x) : "<null>")
    230       1.1       tls 
    231      1.48  christos #if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__lint__)
    232      1.22     joerg #define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y)))
    233      1.22     joerg #define BOZO_DEAD __attribute__((__noreturn__))
    234  1.49.2.1  christos #define BOZO_CHECKRET __attribute__((__warn_unused_result__))
    235      1.49  christos #else
    236      1.49  christos #define BOZO_PRINTFLIKE(x,y)
    237      1.49  christos #define BOZO_DEAD
    238  1.49.2.1  christos #define BOZO_CHECKRET
    239      1.22     joerg #endif
    240      1.22     joerg 
    241  1.49.2.1  christos #ifdef NO_DEBUG
    242  1.49.2.1  christos #define	debug(x)
    243  1.49.2.1  christos #define have_debug	(0)
    244  1.49.2.1  christos #else
    245      1.22     joerg void	debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4);
    246       1.1       tls #define debug(x)	debug__ x
    247  1.49.2.1  christos #define have_debug	(1)
    248      1.17       mrg #endif /* NO_DEBUG */
    249       1.1       tls 
    250  1.49.2.1  christos /*
    251  1.49.2.1  christos  * bozohttpd special files.  avoid serving these out.
    252  1.49.2.1  christos  *
    253  1.49.2.1  christos  * When you add some .bz* file, make sure to also check it in
    254  1.49.2.1  christos  * bozo_check_special_files()
    255  1.49.2.1  christos  */
    256  1.49.2.1  christos 
    257  1.49.2.1  christos #ifndef DIRECT_ACCESS_FILE
    258  1.49.2.1  christos #define DIRECT_ACCESS_FILE	".bzdirect"
    259  1.49.2.1  christos #endif
    260  1.49.2.1  christos #ifndef REDIRECT_FILE
    261  1.49.2.1  christos #define REDIRECT_FILE		".bzredirect"
    262  1.49.2.1  christos #endif
    263  1.49.2.1  christos #ifndef ABSREDIRECT_FILE
    264  1.49.2.1  christos #define ABSREDIRECT_FILE	".bzabsredirect"
    265  1.49.2.1  christos #endif
    266  1.49.2.1  christos #ifndef REMAP_FILE
    267  1.49.2.1  christos #define REMAP_FILE		".bzremap"
    268  1.49.2.1  christos #endif
    269  1.49.2.1  christos #ifndef AUTH_FILE
    270  1.49.2.1  christos #define AUTH_FILE		".htpasswd"
    271  1.49.2.1  christos #endif
    272  1.49.2.1  christos 
    273  1.49.2.1  christos /* be sure to always return this error up */
    274      1.14       mrg int	bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
    275       1.1       tls 
    276  1.49.2.1  christos int	bozo_check_special_files(bozo_httpreq_t *, const char *, bool) BOZO_CHECKRET;
    277      1.12       mrg char	*bozo_http_date(char *, size_t);
    278      1.41       mrg void	bozo_print_header(bozo_httpreq_t *, struct stat *, const char *,
    279      1.41       mrg 			  const char *);
    280      1.38       shm char	*bozo_escape_rfc3986(bozohttpd_t *httpd, const char *url, int absolute);
    281      1.25       mrg char	*bozo_escape_html(bozohttpd_t *httpd, const char *url);
    282      1.45       mrg int	bozo_decode_url_percent(bozo_httpreq_t *, char *);
    283       1.1       tls 
    284      1.42       mrg /* these are similar to libc functions, no underscore here */
    285      1.42       mrg void	bozowarn(bozohttpd_t *, const char *, ...)
    286      1.42       mrg 		BOZO_PRINTFLIKE(2, 3);
    287      1.42       mrg void	bozoerr(bozohttpd_t *, int, const char *, ...)
    288      1.42       mrg 		BOZO_PRINTFLIKE(3, 4)
    289      1.42       mrg 		BOZO_DEAD;
    290      1.42       mrg void	bozoasprintf(bozohttpd_t *, char **, const char *, ...)
    291      1.42       mrg 		BOZO_PRINTFLIKE(3, 4);
    292      1.41       mrg char	*bozodgetln(bozohttpd_t *, int, ssize_t *, ssize_t (*)(bozohttpd_t *,
    293      1.41       mrg 		    int, void *, size_t));
    294       1.5       mrg char	*bozostrnsep(char **, const char *, ssize_t *);
    295      1.12       mrg void	*bozomalloc(bozohttpd_t *, size_t);
    296      1.12       mrg void	*bozorealloc(bozohttpd_t *, void *, size_t);
    297      1.41       mrg char	*bozostrdup(bozohttpd_t *, bozo_httpreq_t *, const char *);
    298       1.1       tls 
    299      1.39  christos #define bozo_noop	do { /* nothing */ } while (/*CONSTCOND*/0)
    300      1.39  christos 
    301  1.49.2.1  christos #define have_all					(1)
    302  1.49.2.1  christos 
    303       1.1       tls /* ssl-bozo.c */
    304      1.12       mrg #ifdef NO_SSL_SUPPORT
    305  1.49.2.1  christos #define bozo_ssl_set_opts(w, x, y)			bozo_noop
    306  1.49.2.1  christos #define bozo_ssl_set_ciphers(w, x)			bozo_noop
    307  1.49.2.1  christos #define bozo_ssl_init(x)				bozo_noop
    308  1.49.2.1  christos #define bozo_ssl_accept(x)				(0)
    309  1.49.2.1  christos #define bozo_ssl_destroy(x)				bozo_noop
    310  1.49.2.1  christos #define have_ssl					(0)
    311      1.12       mrg #else
    312      1.14       mrg void	bozo_ssl_set_opts(bozohttpd_t *, const char *, const char *);
    313      1.39  christos void	bozo_ssl_set_ciphers(bozohttpd_t *, const char *);
    314      1.14       mrg void	bozo_ssl_init(bozohttpd_t *);
    315      1.33       mrg int	bozo_ssl_accept(bozohttpd_t *);
    316      1.14       mrg void	bozo_ssl_destroy(bozohttpd_t *);
    317  1.49.2.1  christos #define have_ssl					(1)
    318       1.1       tls #endif
    319       1.1       tls 
    320       1.1       tls 
    321       1.1       tls /* auth-bozo.c */
    322       1.1       tls #ifdef DO_HTPASSWD
    323      1.34       shm void	bozo_auth_init(bozo_httpreq_t *);
    324      1.14       mrg int	bozo_auth_check(bozo_httpreq_t *, const char *);
    325      1.14       mrg void	bozo_auth_cleanup(bozo_httpreq_t *);
    326      1.14       mrg int	bozo_auth_check_headers(bozo_httpreq_t *, char *, char *, ssize_t);
    327      1.14       mrg void	bozo_auth_check_401(bozo_httpreq_t *, int);
    328      1.14       mrg void	bozo_auth_cgi_setenv(bozo_httpreq_t *, char ***);
    329      1.14       mrg int	bozo_auth_cgi_count(bozo_httpreq_t *);
    330      1.12       mrg #else
    331  1.49.2.1  christos #define	bozo_auth_init(x)				bozo_noop
    332  1.49.2.1  christos #define	bozo_auth_check(x, y)				(0)
    333  1.49.2.1  christos #define	bozo_auth_cleanup(x)				bozo_noop
    334  1.49.2.1  christos #define	bozo_auth_check_headers(y, z, a, b)		(0)
    335  1.49.2.1  christos #define	bozo_auth_check_401(x, y)			bozo_noop
    336  1.49.2.1  christos #define	bozo_auth_cgi_setenv(x, y)			bozo_noop
    337  1.49.2.1  christos #define	bozo_auth_cgi_count(x)				(0)
    338       1.1       tls #endif /* DO_HTPASSWD */
    339       1.1       tls 
    340       1.1       tls 
    341       1.1       tls /* cgi-bozo.c */
    342      1.12       mrg #ifdef NO_CGIBIN_SUPPORT
    343  1.49.2.1  christos #define bozo_cgi_setbin(h,s)				bozo_noop
    344  1.49.2.1  christos #define	bozo_process_cgi(h)				(0)
    345  1.49.2.1  christos #define have_cgibin					(0)
    346       1.1       tls #else
    347      1.14       mrg void	bozo_cgi_setbin(bozohttpd_t *, const char *);
    348      1.14       mrg void	bozo_setenv(bozohttpd_t *, const char *, const char *, char **);
    349      1.14       mrg int	bozo_process_cgi(bozo_httpreq_t *);
    350  1.49.2.1  christos #define have_cgibin					(1)
    351       1.1       tls #endif /* NO_CGIBIN_SUPPORT */
    352       1.1       tls 
    353       1.1       tls 
    354      1.30   mbalmer /* lua-bozo.c */
    355      1.30   mbalmer #ifdef NO_LUA_SUPPORT
    356  1.49.2.1  christos #define bozo_process_lua(h)				(0)
    357  1.49.2.1  christos #define bozo_add_lua_map(h,s,t)				bozo_noop
    358  1.49.2.1  christos #define have_lua					(0)
    359      1.30   mbalmer #else
    360      1.30   mbalmer void	bozo_add_lua_map(bozohttpd_t *, const char *, const char *);
    361      1.30   mbalmer int	bozo_process_lua(bozo_httpreq_t *);
    362  1.49.2.1  christos #define have_lua					(1)
    363      1.30   mbalmer #endif /* NO_LUA_SUPPORT */
    364      1.30   mbalmer 
    365      1.30   mbalmer 
    366       1.1       tls /* daemon-bozo.c */
    367      1.12       mrg #ifdef NO_DAEMON_MODE
    368      1.39  christos #define bozo_daemon_init(x)				bozo_noop
    369  1.49.2.1  christos #define bozo_daemon_fork(x)				(0)
    370      1.39  christos #define bozo_daemon_closefds(x)				bozo_noop
    371  1.49.2.1  christos #define have_daemon_mode				(0)
    372      1.12       mrg #else
    373      1.14       mrg void	bozo_daemon_init(bozohttpd_t *);
    374      1.14       mrg int	bozo_daemon_fork(bozohttpd_t *);
    375      1.14       mrg void	bozo_daemon_closefds(bozohttpd_t *);
    376  1.49.2.1  christos #define have_daemon_mode				(1)
    377       1.1       tls #endif /* NO_DAEMON_MODE */
    378       1.1       tls 
    379       1.1       tls 
    380       1.1       tls /* tilde-luzah-bozo.c */
    381      1.12       mrg #ifdef NO_USER_SUPPORT
    382  1.49.2.1  christos #define bozo_user_transform(x)				(0)
    383  1.49.2.1  christos #define bozo_user_free(x)				/* nothing */
    384  1.49.2.1  christos #define have_user					(0)
    385       1.8       mrg #else
    386      1.38       shm int	bozo_user_transform(bozo_httpreq_t *);
    387  1.49.2.1  christos #define bozo_user_free(x)				free(x)
    388  1.49.2.1  christos #define have_user					(1)
    389       1.1       tls #endif /* NO_USER_SUPPORT */
    390       1.1       tls 
    391       1.1       tls 
    392       1.1       tls /* dir-index-bozo.c */
    393      1.12       mrg #ifdef NO_DIRINDEX_SUPPORT
    394  1.49.2.1  christos #define bozo_dir_index(a, b, c)				(0)
    395  1.49.2.1  christos #define have_dirindex					(0)
    396       1.1       tls #else
    397      1.12       mrg int	bozo_dir_index(bozo_httpreq_t *, const char *, int);
    398  1.49.2.1  christos #define have_dirindex					(1)
    399       1.1       tls #endif /* NO_DIRINDEX_SUPPORT */
    400       1.1       tls 
    401       1.1       tls 
    402       1.1       tls /* content-bozo.c */
    403      1.14       mrg const char *bozo_content_type(bozo_httpreq_t *, const char *);
    404      1.14       mrg const char *bozo_content_encoding(bozo_httpreq_t *, const char *);
    405      1.14       mrg bozo_content_map_t *bozo_match_content_map(bozohttpd_t *, const char *, int);
    406      1.14       mrg bozo_content_map_t *bozo_get_content_map(bozohttpd_t *, const char *);
    407  1.49.2.1  christos #ifdef NO_DYNAMIC_CONTENT
    408  1.49.2.1  christos #define bozo_add_content_map_mime(h,s,t,u,v)		bozo_noop
    409  1.49.2.1  christos #define have_dynamic_content				(0)
    410  1.49.2.1  christos #else
    411      1.41       mrg void	bozo_add_content_map_mime(bozohttpd_t *, const char *, const char *,
    412      1.41       mrg 				  const char *, const char *);
    413  1.49.2.1  christos #define have_dynamic_content				(1)
    414  1.49.2.1  christos #endif
    415  1.49.2.1  christos 
    416  1.49.2.1  christos /* additional cgi-bozo.c */
    417  1.49.2.1  christos #if have_cgibin && have_dynamic_content
    418  1.49.2.1  christos void	bozo_add_content_map_cgi(bozohttpd_t *, const char *, const char *);
    419  1.49.2.1  christos #else
    420  1.49.2.1  christos #define	bozo_add_content_map_cgi(h,s,t)
    421       1.1       tls #endif
    422      1.12       mrg 
    423      1.12       mrg /* I/O */
    424  1.49.2.1  christos int bozo_printf(bozohttpd_t *, const char *, ...) BOZO_PRINTFLIKE(2, 3);
    425      1.12       mrg ssize_t bozo_read(bozohttpd_t *, int, void *, size_t);
    426      1.12       mrg ssize_t bozo_write(bozohttpd_t *, int, const void *, size_t);
    427      1.12       mrg int bozo_flush(bozohttpd_t *, FILE *);
    428      1.12       mrg 
    429      1.12       mrg /* misc */
    430      1.12       mrg int bozo_init_httpd(bozohttpd_t *);
    431      1.41       mrg int bozo_init_prefs(bozohttpd_t *, bozoprefs_t *);
    432      1.12       mrg int bozo_set_defaults(bozohttpd_t *, bozoprefs_t *);
    433      1.12       mrg int bozo_setup(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
    434      1.12       mrg bozo_httpreq_t *bozo_read_request(bozohttpd_t *);
    435      1.12       mrg void bozo_process_request(bozo_httpreq_t *);
    436      1.12       mrg void bozo_clean_request(bozo_httpreq_t *);
    437  1.49.2.1  christos int bozo_set_timeout(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
    438      1.44     elric bozoheaders_t *addmerge_reqheader(bozo_httpreq_t *, const char *,
    439      1.44     elric 				  const char *, ssize_t);
    440      1.44     elric bozoheaders_t *addmerge_replheader(bozo_httpreq_t *, const char *,
    441      1.44     elric 				   const char *, ssize_t);
    442      1.12       mrg 
    443      1.12       mrg /* variables */
    444      1.41       mrg int bozo_set_pref(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
    445      1.12       mrg char *bozo_get_pref(bozoprefs_t *, const char *);
    446      1.12       mrg 
    447      1.46       agc int bozo_get_version(char */*buf*/, size_t /*size*/);
    448      1.46       agc 
    449  1.49.2.1  christos extern volatile sig_atomic_t	bozo_timeout_hit;
    450  1.49.2.1  christos 
    451      1.12       mrg #endif	/* BOZOHTTOPD_H_ */
    452