2019-03-08 06:12:28 +03:00
|
|
|
/* $NetBSD: bozohttpd.h,v 1.60 2019/03/08 03:12:28 mrg Exp $ */
|
2007-10-17 22:47:59 +04:00
|
|
|
|
2011-11-18 13:51:31 +04:00
|
|
|
/* $eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $ */
|
2007-10-16 05:14:01 +04:00
|
|
|
|
|
|
|
/*
|
2019-02-28 11:28:21 +03:00
|
|
|
* Copyright (c) 1997-2019 Matthew R. Green
|
2007-10-16 05:14:01 +04:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer and
|
|
|
|
* dedication in the documentation and/or other materials provided
|
|
|
|
* with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
2010-05-10 07:37:45 +04:00
|
|
|
#ifndef BOZOHTTOPD_H_
|
|
|
|
#define BOZOHTTOPD_H_ 1
|
|
|
|
|
2013-07-11 12:24:47 +04:00
|
|
|
#include "netbsd_queue.h"
|
2010-05-10 07:37:45 +04:00
|
|
|
|
2019-01-22 08:32:57 +03:00
|
|
|
#include <stdbool.h>
|
2019-02-28 11:28:21 +03:00
|
|
|
#include <signal.h>
|
2019-01-22 08:32:57 +03:00
|
|
|
|
2007-10-16 05:14:01 +04:00
|
|
|
#include <sys/stat.h>
|
2008-03-04 01:15:08 +03:00
|
|
|
|
2013-10-12 21:24:06 +04:00
|
|
|
#ifndef NO_LUA_SUPPORT
|
|
|
|
#include <lua.h>
|
|
|
|
#endif
|
2007-10-16 05:14:01 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2015-08-05 09:50:44 +03:00
|
|
|
/* QNX provides a lot of NetBSD things in nbutil.h */
|
2015-10-25 22:06:49 +03:00
|
|
|
#ifdef HAVE_NBUTIL_H
|
2015-08-05 09:50:44 +03:00
|
|
|
#include <nbutil.h>
|
|
|
|
#endif
|
|
|
|
|
2009-04-18 11:28:24 +04:00
|
|
|
/* lots of "const" but gets free()'ed etc at times, sigh */
|
|
|
|
|
2007-10-16 05:14:01 +04:00
|
|
|
/* headers */
|
2010-05-10 07:37:45 +04:00
|
|
|
typedef struct bozoheaders {
|
2007-11-04 18:20:11 +03:00
|
|
|
/*const*/ char *h_header;
|
2007-10-16 05:14:01 +04:00
|
|
|
/*const*/ char *h_value; /* this gets free()'ed etc at times */
|
2010-05-10 07:37:45 +04:00
|
|
|
SIMPLEQ_ENTRY(bozoheaders) h_next;
|
|
|
|
} bozoheaders_t;
|
2016-01-02 21:40:13 +03:00
|
|
|
SIMPLEQ_HEAD(qheaders, bozoheaders);
|
2010-05-10 07:37:45 +04:00
|
|
|
|
2013-10-12 21:24:06 +04:00
|
|
|
#ifndef NO_LUA_SUPPORT
|
|
|
|
typedef struct lua_handler {
|
|
|
|
const char *name;
|
|
|
|
int ref;
|
|
|
|
SIMPLEQ_ENTRY(lua_handler) h_next;
|
|
|
|
} lua_handler_t;
|
|
|
|
|
|
|
|
typedef struct lua_state_map {
|
|
|
|
const char *script;
|
|
|
|
const char *prefix;
|
|
|
|
lua_State *L;
|
|
|
|
SIMPLEQ_HEAD(, lua_handler) handlers;
|
|
|
|
SIMPLEQ_ENTRY(lua_state_map) s_next;
|
|
|
|
} lua_state_map_t;
|
|
|
|
#endif
|
|
|
|
|
2010-05-10 07:37:45 +04:00
|
|
|
typedef struct bozo_content_map_t {
|
|
|
|
const char *name; /* postfix of file */
|
|
|
|
const char *type; /* matching content-type */
|
|
|
|
const char *encoding; /* matching content-encoding */
|
|
|
|
const char *encoding11; /* matching content-encoding (HTTP/1.1) */
|
|
|
|
const char *cgihandler; /* optional CGI handler */
|
|
|
|
} bozo_content_map_t;
|
|
|
|
|
|
|
|
/* this struct holds the bozo constants */
|
|
|
|
typedef struct bozo_consts_t {
|
|
|
|
const char *http_09; /* "HTTP/0.9" */
|
|
|
|
const char *http_10; /* "HTTP/1.0" */
|
|
|
|
const char *http_11; /* "HTTP/1.1" */
|
|
|
|
const char *text_plain; /* "text/plain" */
|
|
|
|
} bozo_consts_t;
|
|
|
|
|
|
|
|
/* this structure encapsulates all the bozo flags and control vars */
|
|
|
|
typedef struct bozohttpd_t {
|
|
|
|
char *rootdir; /* root directory */
|
|
|
|
int numeric; /* avoid gethostby*() */
|
|
|
|
char *virtbase; /* virtual directory base */
|
|
|
|
int unknown_slash; /* unknown vhosts go to normal slashdir */
|
|
|
|
int logstderr; /* log to stderr (even if not tty) */
|
|
|
|
int background; /* drop into daemon mode */
|
|
|
|
int foreground; /* keep daemon mode in foreground */
|
2011-03-29 11:22:31 +04:00
|
|
|
char *pidfile; /* path to the pid file, if any */
|
2010-05-10 07:37:45 +04:00
|
|
|
size_t page_size; /* page size */
|
|
|
|
char *slashdir; /* www slash directory */
|
|
|
|
char *bindport; /* bind port; default "http" */
|
|
|
|
char *bindaddress; /* address for binding - INADDR_ANY */
|
|
|
|
int debug; /* debugging level */
|
|
|
|
char *virthostname; /* my name */
|
|
|
|
const char *server_software;/* our brand :-) */
|
|
|
|
const char *index_html; /* our home page */
|
|
|
|
const char *public_html; /* ~user/public_html page */
|
|
|
|
int enable_users; /* enable public_html */
|
2015-10-28 12:20:15 +03:00
|
|
|
int enable_cgi_users; /* use the cgi handler */
|
2010-05-10 07:37:45 +04:00
|
|
|
int *sock; /* bound sockets */
|
|
|
|
int nsock; /* number of above */
|
|
|
|
struct pollfd *fds; /* current poll fd set */
|
|
|
|
int request_times; /* # times a request was processed */
|
|
|
|
int dir_indexing; /* handle directories */
|
|
|
|
int hide_dots; /* hide .* */
|
|
|
|
int process_cgi; /* use the cgi handler */
|
|
|
|
char *cgibin; /* cgi-bin directory */
|
2019-02-28 11:28:21 +03:00
|
|
|
unsigned ssl_timeout; /* ssl timeout */
|
2018-11-20 04:06:46 +03:00
|
|
|
unsigned initial_timeout;/* first line timeout */
|
|
|
|
unsigned header_timeout; /* header lines timeout */
|
|
|
|
unsigned request_timeout;/* total session timeout */
|
2013-10-12 21:24:06 +04:00
|
|
|
#ifndef NO_LUA_SUPPORT
|
|
|
|
int process_lua; /* use the Lua handler */
|
|
|
|
SIMPLEQ_HEAD(, lua_state_map) lua_states;
|
|
|
|
#endif
|
2010-05-10 07:37:45 +04:00
|
|
|
void *sslinfo; /* pointer to ssl struct */
|
|
|
|
int dynamic_content_map_size;/* size of dyn cont map */
|
|
|
|
bozo_content_map_t *dynamic_content_map;/* dynamic content map */
|
|
|
|
size_t mmapsz; /* size of region to mmap */
|
|
|
|
char *getln_buffer; /* space for getln buffer */
|
|
|
|
ssize_t getln_buflen; /* length of allocated space */
|
|
|
|
char *errorbuf; /* no dynamic allocation allowed */
|
|
|
|
bozo_consts_t consts; /* various constants */
|
|
|
|
} bozohttpd_t;
|
|
|
|
|
|
|
|
/* bozo_httpreq_t */
|
|
|
|
typedef struct bozo_httpreq_t {
|
|
|
|
bozohttpd_t *hr_httpd;
|
|
|
|
int hr_method;
|
2007-10-16 05:14:01 +04:00
|
|
|
#define HTTP_GET 0x01
|
|
|
|
#define HTTP_POST 0x02
|
|
|
|
#define HTTP_HEAD 0x03
|
|
|
|
#define HTTP_OPTIONS 0x04 /* not supported */
|
|
|
|
#define HTTP_PUT 0x05 /* not supported */
|
|
|
|
#define HTTP_DELETE 0x06 /* not supported */
|
|
|
|
#define HTTP_TRACE 0x07 /* not supported */
|
|
|
|
#define HTTP_CONNECT 0x08 /* not supported */
|
|
|
|
const char *hr_methodstr;
|
2013-06-27 14:01:31 +04:00
|
|
|
char *hr_virthostname; /* server name (if not identical
|
|
|
|
to hr_httpd->virthostname) */
|
2009-04-18 11:28:24 +04:00
|
|
|
char *hr_file;
|
2010-06-17 23:43:30 +04:00
|
|
|
char *hr_oldfile; /* if we added an index_html */
|
2013-10-12 11:49:40 +04:00
|
|
|
char *hr_query;
|
2014-02-09 05:46:10 +04:00
|
|
|
char *hr_host; /* HTTP/1.1 Host: or virtual hostname,
|
|
|
|
possibly including a port number */
|
2015-10-28 12:20:15 +03:00
|
|
|
#ifndef NO_USER_SUPPORT
|
|
|
|
char *hr_user; /* username if we hit userdir request */
|
|
|
|
#endif /* !NO_USER_SUPPORT */
|
2007-10-16 05:14:01 +04:00
|
|
|
const char *hr_proto;
|
|
|
|
const char *hr_content_type;
|
|
|
|
const char *hr_content_length;
|
|
|
|
const char *hr_allow;
|
|
|
|
const char *hr_referrer;
|
2008-03-04 01:15:08 +03:00
|
|
|
const char *hr_range;
|
2009-02-09 20:06:11 +03:00
|
|
|
const char *hr_if_modified_since;
|
2012-02-20 13:26:56 +04:00
|
|
|
const char *hr_accept_encoding;
|
2008-03-04 01:15:08 +03:00
|
|
|
int hr_have_range;
|
|
|
|
off_t hr_first_byte_pos;
|
|
|
|
off_t hr_last_byte_pos;
|
2009-04-18 11:28:24 +04:00
|
|
|
/*const*/ char *hr_remotehost;
|
|
|
|
/*const*/ char *hr_remoteaddr;
|
|
|
|
/*const*/ char *hr_serverport;
|
2007-10-16 05:14:01 +04:00
|
|
|
#ifdef DO_HTPASSWD
|
2009-04-18 11:37:08 +04:00
|
|
|
/*const*/ char *hr_authrealm;
|
|
|
|
/*const*/ char *hr_authuser;
|
|
|
|
/*const*/ char *hr_authpass;
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif
|
2016-01-02 21:40:13 +03:00
|
|
|
struct qheaders hr_headers;
|
|
|
|
struct qheaders hr_replheaders;
|
2018-11-19 07:12:22 +03:00
|
|
|
unsigned hr_nheaders;
|
|
|
|
size_t hr_header_bytes;
|
2010-05-10 07:37:45 +04:00
|
|
|
} bozo_httpreq_t;
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2013-06-27 14:01:31 +04:00
|
|
|
/* helper to access the "active" host name from a httpd/request pair */
|
|
|
|
#define BOZOHOST(HTTPD,REQUEST) ((REQUEST)->hr_virthostname ? \
|
|
|
|
(REQUEST)->hr_virthostname : \
|
|
|
|
(HTTPD)->virthostname)
|
|
|
|
|
2010-05-10 07:37:45 +04:00
|
|
|
/* structure to hold string based (name, value) pairs with preferences */
|
|
|
|
typedef struct bozoprefs_t {
|
2015-12-27 13:21:35 +03:00
|
|
|
size_t size; /* size of the two arrays */
|
|
|
|
size_t count; /* # of entries in arrays */
|
2010-05-10 07:37:45 +04:00
|
|
|
char **name; /* names of each entry */
|
|
|
|
char **value; /* values for the name entries */
|
|
|
|
} bozoprefs_t;
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2019-03-08 06:12:28 +03:00
|
|
|
/* sun2 has a tiny VA range */
|
|
|
|
#ifdef __mc68010__
|
|
|
|
#ifndef BOZO_WRSZ
|
|
|
|
#define BOZO_WRSZ (16 * 1024)
|
|
|
|
#endif
|
|
|
|
#ifndef BOZO_MMAPSZ
|
|
|
|
#define BOZO_MMAPSZ (BOZO_WRSZ * 4)
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2013-09-05 02:59:50 +04:00
|
|
|
/* by default write in upto 64KiB chunks, and mmap in upto 64MiB chunks */
|
|
|
|
#ifndef BOZO_WRSZ
|
2010-05-10 07:37:45 +04:00
|
|
|
#define BOZO_WRSZ (64 * 1024)
|
2013-09-05 02:59:50 +04:00
|
|
|
#endif
|
|
|
|
#ifndef BOZO_MMAPSZ
|
2010-05-10 07:37:45 +04:00
|
|
|
#define BOZO_MMAPSZ (BOZO_WRSZ * 1024)
|
2013-09-05 02:59:50 +04:00
|
|
|
#endif
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2018-11-19 07:12:22 +03:00
|
|
|
/* only allow this many total headers bytes */
|
|
|
|
#define BOZO_HEADERS_MAX_SIZE (16 * 1024)
|
|
|
|
|
2007-10-16 05:14:01 +04:00
|
|
|
/* debug flags */
|
|
|
|
#define DEBUG_NORMAL 1
|
|
|
|
#define DEBUG_FAT 2
|
|
|
|
#define DEBUG_OBESE 3
|
|
|
|
#define DEBUG_EXPLODING 4
|
|
|
|
|
|
|
|
#define strornull(x) ((x) ? (x) : "<null>")
|
|
|
|
|
2018-05-04 21:06:44 +03:00
|
|
|
#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__lint__)
|
2012-03-15 03:47:19 +04:00
|
|
|
#define BOZO_PRINTFLIKE(x,y) __attribute__((__format__(__printf__, x,y)))
|
|
|
|
#define BOZO_DEAD __attribute__((__noreturn__))
|
2018-11-21 12:37:02 +03:00
|
|
|
#define BOZO_CHECKRET __attribute__((__warn_unused_result__))
|
2018-05-04 21:07:23 +03:00
|
|
|
#else
|
|
|
|
#define BOZO_PRINTFLIKE(x,y)
|
|
|
|
#define BOZO_DEAD
|
2018-11-21 12:37:02 +03:00
|
|
|
#define BOZO_CHECKRET
|
2012-03-15 03:47:19 +04:00
|
|
|
#endif
|
|
|
|
|
2018-11-20 04:23:06 +03:00
|
|
|
#ifdef NO_DEBUG
|
|
|
|
#define debug(x)
|
|
|
|
#define have_debug (0)
|
|
|
|
#else
|
2012-03-15 03:47:19 +04:00
|
|
|
void debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4);
|
2007-10-16 05:14:01 +04:00
|
|
|
#define debug(x) debug__ x
|
2018-11-20 04:19:51 +03:00
|
|
|
#define have_debug (1)
|
2010-09-21 03:11:38 +04:00
|
|
|
#endif /* NO_DEBUG */
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2018-11-21 12:37:02 +03:00
|
|
|
/*
|
|
|
|
* bozohttpd special files. avoid serving these out.
|
|
|
|
*
|
|
|
|
* When you add some .bz* file, make sure to also check it in
|
|
|
|
* bozo_check_special_files()
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef DIRECT_ACCESS_FILE
|
|
|
|
#define DIRECT_ACCESS_FILE ".bzdirect"
|
|
|
|
#endif
|
|
|
|
#ifndef REDIRECT_FILE
|
|
|
|
#define REDIRECT_FILE ".bzredirect"
|
|
|
|
#endif
|
|
|
|
#ifndef ABSREDIRECT_FILE
|
|
|
|
#define ABSREDIRECT_FILE ".bzabsredirect"
|
|
|
|
#endif
|
|
|
|
#ifndef REMAP_FILE
|
|
|
|
#define REMAP_FILE ".bzremap"
|
|
|
|
#endif
|
|
|
|
#ifndef AUTH_FILE
|
|
|
|
#define AUTH_FILE ".htpasswd"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* be sure to always return this error up */
|
2010-06-17 23:43:30 +04:00
|
|
|
int bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2019-01-22 08:32:57 +03:00
|
|
|
int bozo_check_special_files(bozo_httpreq_t *, const char *, bool) BOZO_CHECKRET;
|
2010-05-10 07:37:45 +04:00
|
|
|
char *bozo_http_date(char *, size_t);
|
2015-12-27 13:21:35 +03:00
|
|
|
void bozo_print_header(bozo_httpreq_t *, struct stat *, const char *,
|
|
|
|
const char *);
|
2015-10-28 12:20:15 +03:00
|
|
|
char *bozo_escape_rfc3986(bozohttpd_t *httpd, const char *url, int absolute);
|
2013-07-11 11:44:19 +04:00
|
|
|
char *bozo_escape_html(bozohttpd_t *httpd, const char *url);
|
2016-04-15 20:57:21 +03:00
|
|
|
int bozo_decode_url_percent(bozo_httpreq_t *, char *);
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2015-12-28 10:37:59 +03:00
|
|
|
/* these are similar to libc functions, no underscore here */
|
|
|
|
void bozowarn(bozohttpd_t *, const char *, ...)
|
|
|
|
BOZO_PRINTFLIKE(2, 3);
|
|
|
|
void bozoerr(bozohttpd_t *, int, const char *, ...)
|
|
|
|
BOZO_PRINTFLIKE(3, 4)
|
|
|
|
BOZO_DEAD;
|
|
|
|
void bozoasprintf(bozohttpd_t *, char **, const char *, ...)
|
|
|
|
BOZO_PRINTFLIKE(3, 4);
|
2015-12-27 13:21:35 +03:00
|
|
|
char *bozodgetln(bozohttpd_t *, int, ssize_t *, ssize_t (*)(bozohttpd_t *,
|
|
|
|
int, void *, size_t));
|
2008-03-04 01:15:08 +03:00
|
|
|
char *bozostrnsep(char **, const char *, ssize_t *);
|
2010-05-10 07:37:45 +04:00
|
|
|
void *bozomalloc(bozohttpd_t *, size_t);
|
|
|
|
void *bozorealloc(bozohttpd_t *, void *, size_t);
|
2015-12-27 13:21:35 +03:00
|
|
|
char *bozostrdup(bozohttpd_t *, bozo_httpreq_t *, const char *);
|
2007-10-16 05:14:01 +04:00
|
|
|
|
2015-12-12 19:57:53 +03:00
|
|
|
#define bozo_noop do { /* nothing */ } while (/*CONSTCOND*/0)
|
|
|
|
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_all (1)
|
|
|
|
|
2007-10-16 05:14:01 +04:00
|
|
|
/* ssl-bozo.c */
|
2010-05-10 07:37:45 +04:00
|
|
|
#ifdef NO_SSL_SUPPORT
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_ssl_set_opts(w, x, y) bozo_noop
|
2018-11-22 11:54:08 +03:00
|
|
|
#define bozo_ssl_set_ciphers(w, x) bozo_noop
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_ssl_init(x) bozo_noop
|
|
|
|
#define bozo_ssl_accept(x) (0)
|
|
|
|
#define bozo_ssl_destroy(x) bozo_noop
|
|
|
|
#define have_ssl (0)
|
2007-10-16 05:14:01 +04:00
|
|
|
#else
|
2010-06-17 23:43:30 +04:00
|
|
|
void bozo_ssl_set_opts(bozohttpd_t *, const char *, const char *);
|
2015-12-12 19:57:53 +03:00
|
|
|
void bozo_ssl_set_ciphers(bozohttpd_t *, const char *);
|
2010-06-17 23:43:30 +04:00
|
|
|
void bozo_ssl_init(bozohttpd_t *);
|
2014-07-17 10:27:52 +04:00
|
|
|
int bozo_ssl_accept(bozohttpd_t *);
|
2010-06-17 23:43:30 +04:00
|
|
|
void bozo_ssl_destroy(bozohttpd_t *);
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_ssl (1)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* auth-bozo.c */
|
|
|
|
#ifdef DO_HTPASSWD
|
2014-11-21 11:58:28 +03:00
|
|
|
void bozo_auth_init(bozo_httpreq_t *);
|
2010-06-17 23:43:30 +04:00
|
|
|
int bozo_auth_check(bozo_httpreq_t *, const char *);
|
|
|
|
void bozo_auth_cleanup(bozo_httpreq_t *);
|
|
|
|
int bozo_auth_check_headers(bozo_httpreq_t *, char *, char *, ssize_t);
|
|
|
|
void bozo_auth_check_401(bozo_httpreq_t *, int);
|
|
|
|
void bozo_auth_cgi_setenv(bozo_httpreq_t *, char ***);
|
|
|
|
int bozo_auth_cgi_count(bozo_httpreq_t *);
|
2007-10-16 05:14:01 +04:00
|
|
|
#else
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_auth_init(x) bozo_noop
|
|
|
|
#define bozo_auth_check(x, y) (0)
|
|
|
|
#define bozo_auth_cleanup(x) bozo_noop
|
|
|
|
#define bozo_auth_check_headers(y, z, a, b) (0)
|
|
|
|
#define bozo_auth_check_401(x, y) bozo_noop
|
|
|
|
#define bozo_auth_cgi_setenv(x, y) bozo_noop
|
|
|
|
#define bozo_auth_cgi_count(x) (0)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif /* DO_HTPASSWD */
|
|
|
|
|
|
|
|
|
|
|
|
/* cgi-bozo.c */
|
2010-05-10 07:37:45 +04:00
|
|
|
#ifdef NO_CGIBIN_SUPPORT
|
2018-11-22 11:54:08 +03:00
|
|
|
#define bozo_cgi_setbin(h,s) bozo_noop
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_process_cgi(h) (0)
|
|
|
|
#define have_cgibin (0)
|
2007-10-16 05:14:01 +04:00
|
|
|
#else
|
2010-06-17 23:43:30 +04:00
|
|
|
void bozo_cgi_setbin(bozohttpd_t *, const char *);
|
|
|
|
void bozo_setenv(bozohttpd_t *, const char *, const char *, char **);
|
|
|
|
int bozo_process_cgi(bozo_httpreq_t *);
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_cgibin (1)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif /* NO_CGIBIN_SUPPORT */
|
|
|
|
|
|
|
|
|
2013-10-12 21:24:06 +04:00
|
|
|
/* lua-bozo.c */
|
|
|
|
#ifdef NO_LUA_SUPPORT
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_process_lua(h) (0)
|
2018-11-22 11:54:08 +03:00
|
|
|
#define bozo_add_lua_map(h,s,t) bozo_noop
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_lua (0)
|
2013-10-12 21:24:06 +04:00
|
|
|
#else
|
|
|
|
void bozo_add_lua_map(bozohttpd_t *, const char *, const char *);
|
|
|
|
int bozo_process_lua(bozo_httpreq_t *);
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_lua (1)
|
2013-10-12 21:24:06 +04:00
|
|
|
#endif /* NO_LUA_SUPPORT */
|
|
|
|
|
|
|
|
|
2007-10-16 05:14:01 +04:00
|
|
|
/* daemon-bozo.c */
|
2010-05-10 07:37:45 +04:00
|
|
|
#ifdef NO_DAEMON_MODE
|
2015-12-12 19:57:53 +03:00
|
|
|
#define bozo_daemon_init(x) bozo_noop
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_daemon_fork(x) (0)
|
2015-12-12 19:57:53 +03:00
|
|
|
#define bozo_daemon_closefds(x) bozo_noop
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_daemon_mode (0)
|
2007-10-16 05:14:01 +04:00
|
|
|
#else
|
2010-06-17 23:43:30 +04:00
|
|
|
void bozo_daemon_init(bozohttpd_t *);
|
|
|
|
int bozo_daemon_fork(bozohttpd_t *);
|
|
|
|
void bozo_daemon_closefds(bozohttpd_t *);
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_daemon_mode (1)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif /* NO_DAEMON_MODE */
|
|
|
|
|
|
|
|
|
|
|
|
/* tilde-luzah-bozo.c */
|
2010-05-10 07:37:45 +04:00
|
|
|
#ifdef NO_USER_SUPPORT
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_user_transform(x) (0)
|
2018-11-20 04:06:46 +03:00
|
|
|
#define bozo_user_free(x) /* nothing */
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_user (0)
|
2009-04-18 11:28:24 +04:00
|
|
|
#else
|
2015-10-28 12:20:15 +03:00
|
|
|
int bozo_user_transform(bozo_httpreq_t *);
|
2018-11-20 04:06:46 +03:00
|
|
|
#define bozo_user_free(x) free(x)
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_user (1)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif /* NO_USER_SUPPORT */
|
|
|
|
|
|
|
|
|
|
|
|
/* dir-index-bozo.c */
|
2010-05-10 07:37:45 +04:00
|
|
|
#ifdef NO_DIRINDEX_SUPPORT
|
2018-11-20 04:15:50 +03:00
|
|
|
#define bozo_dir_index(a, b, c) (0)
|
|
|
|
#define have_dirindex (0)
|
2007-10-16 05:14:01 +04:00
|
|
|
#else
|
2010-05-10 07:37:45 +04:00
|
|
|
int bozo_dir_index(bozo_httpreq_t *, const char *, int);
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_dirindex (1)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif /* NO_DIRINDEX_SUPPORT */
|
|
|
|
|
|
|
|
|
|
|
|
/* content-bozo.c */
|
2010-06-17 23:43:30 +04:00
|
|
|
const char *bozo_content_type(bozo_httpreq_t *, const char *);
|
|
|
|
const char *bozo_content_encoding(bozo_httpreq_t *, const char *);
|
|
|
|
bozo_content_map_t *bozo_match_content_map(bozohttpd_t *, const char *, int);
|
|
|
|
bozo_content_map_t *bozo_get_content_map(bozohttpd_t *, const char *);
|
2018-11-20 04:23:06 +03:00
|
|
|
#ifdef NO_DYNAMIC_CONTENT
|
2018-11-22 11:54:08 +03:00
|
|
|
#define bozo_add_content_map_mime(h,s,t,u,v) bozo_noop
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_dynamic_content (0)
|
|
|
|
#else
|
2018-11-20 04:23:06 +03:00
|
|
|
void bozo_add_content_map_mime(bozohttpd_t *, const char *, const char *,
|
|
|
|
const char *, const char *);
|
2018-11-20 04:15:50 +03:00
|
|
|
#define have_dynamic_content (1)
|
2007-10-16 05:14:01 +04:00
|
|
|
#endif
|
2010-05-10 07:37:45 +04:00
|
|
|
|
2018-11-22 11:54:08 +03:00
|
|
|
/* additional cgi-bozo.c */
|
|
|
|
#if have_cgibin && have_dynamic_content
|
|
|
|
void bozo_add_content_map_cgi(bozohttpd_t *, const char *, const char *);
|
|
|
|
#else
|
|
|
|
#define bozo_add_content_map_cgi(h,s,t)
|
|
|
|
#endif
|
|
|
|
|
2010-05-10 07:37:45 +04:00
|
|
|
/* I/O */
|
2018-11-24 16:02:46 +03:00
|
|
|
int bozo_printf(bozohttpd_t *, const char *, ...) BOZO_PRINTFLIKE(2, 3);
|
2010-05-10 07:37:45 +04:00
|
|
|
ssize_t bozo_read(bozohttpd_t *, int, void *, size_t);
|
|
|
|
ssize_t bozo_write(bozohttpd_t *, int, const void *, size_t);
|
|
|
|
int bozo_flush(bozohttpd_t *, FILE *);
|
|
|
|
|
|
|
|
/* misc */
|
|
|
|
int bozo_init_httpd(bozohttpd_t *);
|
2015-12-27 13:21:35 +03:00
|
|
|
int bozo_init_prefs(bozohttpd_t *, bozoprefs_t *);
|
2010-05-10 07:37:45 +04:00
|
|
|
int bozo_set_defaults(bozohttpd_t *, bozoprefs_t *);
|
|
|
|
int bozo_setup(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
|
|
|
|
bozo_httpreq_t *bozo_read_request(bozohttpd_t *);
|
|
|
|
void bozo_process_request(bozo_httpreq_t *);
|
|
|
|
void bozo_clean_request(bozo_httpreq_t *);
|
2018-11-20 04:06:46 +03:00
|
|
|
int bozo_set_timeout(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
|
2016-01-02 21:40:13 +03:00
|
|
|
bozoheaders_t *addmerge_reqheader(bozo_httpreq_t *, const char *,
|
|
|
|
const char *, ssize_t);
|
|
|
|
bozoheaders_t *addmerge_replheader(bozo_httpreq_t *, const char *,
|
|
|
|
const char *, ssize_t);
|
2010-05-10 07:37:45 +04:00
|
|
|
|
|
|
|
/* variables */
|
2015-12-27 13:21:35 +03:00
|
|
|
int bozo_set_pref(bozohttpd_t *, bozoprefs_t *, const char *, const char *);
|
2010-05-10 07:37:45 +04:00
|
|
|
char *bozo_get_pref(bozoprefs_t *, const char *);
|
|
|
|
|
2016-05-25 00:18:29 +03:00
|
|
|
int bozo_get_version(char */*buf*/, size_t /*size*/);
|
|
|
|
|
2019-02-28 11:28:21 +03:00
|
|
|
extern volatile sig_atomic_t bozo_timeout_hit;
|
|
|
|
|
2010-05-10 07:37:45 +04:00
|
|
|
#endif /* BOZOHTTOPD_H_ */
|