[core] some header cleanup
provide standard types in first.h instead of base.h provide lighttpd types in base_decls.h instead of settings.h reduce headers exposed by headers for core data structures do not expose <pcre.h> or <stdlib.h> in headers move stat_cache_entry to stat_cache.h reduce use of "server.h" and "base.h" in headerspersonal/stbuehler/fix-fdevent
parent
fefc82153a
commit
04d76e7afd
79
src/array.h
79
src/array.h
|
@ -2,16 +2,7 @@
|
|||
#define ARRAY_H
|
||||
#include "first.h"
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
# include <pcre.h>
|
||||
#endif
|
||||
|
||||
#include "buffer.h"
|
||||
#include "vector.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define DATA_IS_STRING(x) (x->type == TYPE_STRING)
|
||||
|
||||
typedef enum { TYPE_UNSET, TYPE_STRING, TYPE_OTHER, TYPE_ARRAY, TYPE_INTEGER, TYPE_DONOTUSE, TYPE_CONFIG } data_type_t;
|
||||
#define DATA_UNSET \
|
||||
|
@ -56,76 +47,6 @@ typedef struct {
|
|||
|
||||
data_array *data_array_init(void);
|
||||
|
||||
/**
|
||||
* possible compare ops in the configfile parser
|
||||
*/
|
||||
typedef enum {
|
||||
CONFIG_COND_UNSET,
|
||||
CONFIG_COND_EQ, /** == */
|
||||
CONFIG_COND_MATCH, /** =~ */
|
||||
CONFIG_COND_NE, /** != */
|
||||
CONFIG_COND_NOMATCH, /** !~ */
|
||||
CONFIG_COND_ELSE /** (always true if reached) */
|
||||
} config_cond_t;
|
||||
|
||||
/**
|
||||
* possible fields to match against
|
||||
*/
|
||||
typedef enum {
|
||||
COMP_UNSET,
|
||||
COMP_SERVER_SOCKET,
|
||||
COMP_HTTP_URL,
|
||||
COMP_HTTP_HOST,
|
||||
COMP_HTTP_REFERER, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_USER_AGENT, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_LANGUAGE, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_COOKIE, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_REMOTE_IP,
|
||||
COMP_HTTP_QUERY_STRING,
|
||||
COMP_HTTP_SCHEME,
|
||||
COMP_HTTP_REQUEST_METHOD,
|
||||
COMP_HTTP_REQUEST_HEADER,
|
||||
|
||||
COMP_LAST_ELEMENT
|
||||
} comp_key_t;
|
||||
|
||||
/* $HTTP["host"] == "incremental.home.kneschke.de" { ... }
|
||||
* for print: comp_key op string
|
||||
* for compare: comp cond string/regex
|
||||
*/
|
||||
|
||||
typedef struct data_config data_config;
|
||||
DEFINE_TYPED_VECTOR_NO_RELEASE(config_weak, data_config*);
|
||||
|
||||
struct data_config {
|
||||
DATA_UNSET;
|
||||
|
||||
array *value;
|
||||
|
||||
buffer *comp_tag;
|
||||
buffer *comp_key;
|
||||
comp_key_t comp;
|
||||
|
||||
config_cond_t cond;
|
||||
buffer *op;
|
||||
|
||||
int context_ndx; /* more or less like an id */
|
||||
vector_config_weak children;
|
||||
/* nested */
|
||||
data_config *parent;
|
||||
/* for chaining only */
|
||||
data_config *prev;
|
||||
data_config *next;
|
||||
|
||||
buffer *string;
|
||||
#ifdef HAVE_PCRE_H
|
||||
pcre *regex;
|
||||
pcre_extra *regex_study;
|
||||
#endif
|
||||
};
|
||||
|
||||
data_config *data_config_init(void);
|
||||
|
||||
typedef struct {
|
||||
DATA_UNSET;
|
||||
|
||||
|
|
111
src/base.h
111
src/base.h
|
@ -6,17 +6,6 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
|
@ -29,75 +18,7 @@
|
|||
struct fdevents; /* declaration */
|
||||
struct stat_cache; /* declaration */
|
||||
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# ifdef SIZE_T_MAX
|
||||
# define SIZE_MAX SIZE_T_MAX
|
||||
# else
|
||||
# define SIZE_MAX ((size_t)~0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX ((size_t)~0 >> 1)
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <crt_externs.h>
|
||||
#define environ (* _NSGetEnviron())
|
||||
#else
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
/* for solaris 2.5 and NetBSD 1.3.x */
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
/* solaris and NetBSD 1.3.x again */
|
||||
#if (!defined(HAVE_STDINT_H)) && (!defined(HAVE_INTTYPES_H)) && (!defined(uint32_t))
|
||||
# define uint32_t u_int32_t
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SHUT_WR
|
||||
# define SHUT_WR 1
|
||||
#endif
|
||||
|
||||
typedef enum { T_CONFIG_UNSET,
|
||||
T_CONFIG_STRING,
|
||||
T_CONFIG_SHORT,
|
||||
T_CONFIG_INT,
|
||||
T_CONFIG_BOOLEAN,
|
||||
T_CONFIG_ARRAY,
|
||||
T_CONFIG_LOCAL,
|
||||
T_CONFIG_DEPRECATED,
|
||||
T_CONFIG_UNSUPPORTED
|
||||
} config_values_type_t;
|
||||
|
||||
typedef enum { T_CONFIG_SCOPE_UNSET,
|
||||
T_CONFIG_SCOPE_SERVER,
|
||||
T_CONFIG_SCOPE_CONNECTION
|
||||
} config_scope_type_t;
|
||||
|
||||
typedef struct {
|
||||
const char *key;
|
||||
void *destination;
|
||||
|
||||
config_values_type_t type;
|
||||
config_scope_type_t scope;
|
||||
} config_values_t;
|
||||
|
||||
typedef enum { DIRECT, EXTERNAL } connection_type;
|
||||
|
||||
typedef struct {
|
||||
char *key;
|
||||
connection_type type;
|
||||
char *value;
|
||||
} request_handler;
|
||||
#define DIRECT 0 /* con->mode */
|
||||
|
||||
|
||||
/* fcgi_response_header contains ... */
|
||||
|
@ -177,25 +98,6 @@ typedef struct {
|
|||
buffer *etag;
|
||||
} physical;
|
||||
|
||||
typedef struct {
|
||||
buffer *name;
|
||||
buffer *etag;
|
||||
|
||||
struct stat st;
|
||||
|
||||
time_t stat_ts;
|
||||
|
||||
#ifdef HAVE_LSTAT
|
||||
char is_symlink;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FAM_H
|
||||
int dir_version;
|
||||
#endif
|
||||
|
||||
buffer *content_type;
|
||||
} stat_cache_entry;
|
||||
|
||||
typedef struct {
|
||||
array *mimetypes;
|
||||
|
||||
|
@ -376,7 +278,7 @@ struct connection {
|
|||
|
||||
array *environment; /* used to pass lighttpd internal stuff to the FastCGI/CGI apps, setenv does that */
|
||||
|
||||
connection_type mode;
|
||||
unsigned int mode; /* DIRECT (0) or plugin id */
|
||||
int async_callback;
|
||||
|
||||
void **plugin_ctx; /* plugin connection specific config */
|
||||
|
@ -398,7 +300,7 @@ struct connection {
|
|||
/* etag handling */
|
||||
etag_flags_t etag_flags;
|
||||
|
||||
int conditional_is_valid[COMP_LAST_ELEMENT];
|
||||
int8_t conditional_is_valid[16]; /* MUST be >= COMP_LAST_ELEMENT] */
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -407,13 +309,6 @@ typedef struct {
|
|||
size_t used;
|
||||
} connections;
|
||||
|
||||
|
||||
typedef struct {
|
||||
buffer *uri;
|
||||
time_t mtime;
|
||||
int http_status;
|
||||
} realpath_cache_type;
|
||||
|
||||
typedef struct {
|
||||
time_t mtime; /* the key */
|
||||
buffer *str; /* a buffer for the string represenation */
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include "first.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
struct server;
|
||||
typedef struct server server;
|
||||
|
||||
|
@ -15,4 +13,18 @@ union sock_addr;
|
|||
typedef union sock_addr sock_addr;
|
||||
|
||||
|
||||
enum handler_t {
|
||||
HANDLER_UNSET,
|
||||
HANDLER_GO_ON,
|
||||
HANDLER_FINISHED,
|
||||
HANDLER_COMEBACK,
|
||||
HANDLER_WAIT_FOR_EVENT,
|
||||
HANDLER_ERROR,
|
||||
HANDLER_WAIT_FOR_FD
|
||||
};
|
||||
typedef enum handler_t handler_t;
|
||||
|
||||
#define BV(x) (1 << x)
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "settings.h" /* BUFFER_MAX_REUSE_SIZE */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h> /* strftime() */
|
||||
|
||||
static const char hex_chars[] = "0123456789abcdef";
|
||||
|
||||
|
|
17
src/buffer.h
17
src/buffer.h
|
@ -2,16 +2,7 @@
|
|||
#define _BUFFER_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "settings.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#elif defined HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
struct tm; /* declaration */
|
||||
|
||||
/* generic string + binary data container; contains a terminating 0 in both
|
||||
* cases
|
||||
|
@ -163,6 +154,12 @@ static inline void buffer_append_slash(buffer *b); /* append '/' no non-empty st
|
|||
#define CONST_BUF_LEN(x) ((x) ? (x)->ptr : NULL), buffer_string_length(x)
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define LI_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
# define LI_NORETURN
|
||||
#endif
|
||||
|
||||
void log_failed_assert(const char *filename, unsigned int line, const char *msg) LI_NORETURN;
|
||||
#define force_assert(x) do { if (!(x)) log_failed_assert(__FILE__, __LINE__, "assertion failed: " #x); } while(0)
|
||||
#define SEGFAULT() log_failed_assert(__FILE__, __LINE__, "aborted");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "buffer.h"
|
||||
#include "array.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "fdevent.h"
|
||||
#include "sock_addr.h"
|
||||
|
||||
#include "configfile.h"
|
||||
|
@ -12,6 +12,10 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* like all glue code this file contains functions which
|
||||
* are the external interface of lighttpd. The functions
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "server.h"
|
||||
#include "base.h"
|
||||
#include "fdevent.h"
|
||||
#include "log.h"
|
||||
#include "stream.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include "configparser.h"
|
||||
#include "configfile.h"
|
||||
|
@ -1370,6 +1369,8 @@ int config_set_defaults(server *srv) {
|
|||
specific_config *s = srv->config_storage[0];
|
||||
struct stat st1, st2;
|
||||
|
||||
force_assert(sizeof(((connection *)0)->conditional_is_valid) >= COMP_LAST_ELEMENT);
|
||||
|
||||
if (0 != fdevent_config(srv)) return -1;
|
||||
|
||||
if (!buffer_string_is_empty(srv->srvconf.changeroot)) {
|
||||
|
|
107
src/configfile.h
107
src/configfile.h
|
@ -2,9 +2,84 @@
|
|||
#define _CONFIG_PARSER_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "array.h"
|
||||
#include "buffer.h"
|
||||
#include "server.h"
|
||||
#include "vector.h"
|
||||
|
||||
/**
|
||||
* possible compare ops in the configfile parser
|
||||
*/
|
||||
typedef enum {
|
||||
CONFIG_COND_UNSET,
|
||||
CONFIG_COND_EQ, /** == */
|
||||
CONFIG_COND_MATCH, /** =~ */
|
||||
CONFIG_COND_NE, /** != */
|
||||
CONFIG_COND_NOMATCH, /** !~ */
|
||||
CONFIG_COND_ELSE /** (always true if reached) */
|
||||
} config_cond_t;
|
||||
|
||||
/**
|
||||
* possible fields to match against
|
||||
*/
|
||||
typedef enum {
|
||||
COMP_UNSET,
|
||||
COMP_SERVER_SOCKET,
|
||||
COMP_HTTP_URL,
|
||||
COMP_HTTP_HOST,
|
||||
COMP_HTTP_REFERER, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_USER_AGENT, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_LANGUAGE, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_COOKIE, /*(subsumed by COMP_HTTP_REQUEST_HEADER)*/
|
||||
COMP_HTTP_REMOTE_IP,
|
||||
COMP_HTTP_QUERY_STRING,
|
||||
COMP_HTTP_SCHEME,
|
||||
COMP_HTTP_REQUEST_METHOD,
|
||||
COMP_HTTP_REQUEST_HEADER,
|
||||
|
||||
COMP_LAST_ELEMENT
|
||||
} comp_key_t;
|
||||
|
||||
/* $HTTP["host"] == "incremental.home.kneschke.de" { ... }
|
||||
* for print: comp_key op string
|
||||
* for compare: comp cond string/regex
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
struct pcre_extra; /* declaration */
|
||||
#endif
|
||||
|
||||
typedef struct data_config data_config;
|
||||
DEFINE_TYPED_VECTOR_NO_RELEASE(config_weak, data_config*);
|
||||
|
||||
struct data_config {
|
||||
DATA_UNSET;
|
||||
|
||||
array *value;
|
||||
|
||||
buffer *comp_tag;
|
||||
buffer *comp_key;
|
||||
comp_key_t comp;
|
||||
|
||||
config_cond_t cond;
|
||||
buffer *op;
|
||||
|
||||
int context_ndx; /* more or less like an id */
|
||||
vector_config_weak children;
|
||||
/* nested */
|
||||
data_config *parent;
|
||||
/* for chaining only */
|
||||
data_config *prev;
|
||||
data_config *next;
|
||||
|
||||
buffer *string;
|
||||
#ifdef HAVE_PCRE_H
|
||||
void *regex;
|
||||
struct pcre_extra *regex_study;
|
||||
#endif
|
||||
};
|
||||
|
||||
data_config *data_config_init(void);
|
||||
|
||||
typedef struct {
|
||||
server *srv;
|
||||
|
@ -15,6 +90,8 @@ typedef struct {
|
|||
buffer *basedir;
|
||||
} config_t;
|
||||
|
||||
int config_read(server *srv, const char *fn);
|
||||
int config_set_defaults(server *srv);
|
||||
void *configparserAlloc(void *(*mallocProc)(size_t));
|
||||
void configparserFree(void *p, void (*freeProc)(void*));
|
||||
void configparser(void *yyp, int yymajor, buffer *yyminor, config_t *ctx);
|
||||
|
@ -28,4 +105,32 @@ int config_patch_connection(server *srv, connection *con);
|
|||
void config_cond_cache_reset(server *srv, connection *con);
|
||||
void config_cond_cache_reset_item(server *srv, connection *con, comp_key_t item);
|
||||
|
||||
typedef enum { T_CONFIG_UNSET,
|
||||
T_CONFIG_STRING,
|
||||
T_CONFIG_SHORT,
|
||||
T_CONFIG_INT,
|
||||
T_CONFIG_BOOLEAN,
|
||||
T_CONFIG_ARRAY,
|
||||
T_CONFIG_LOCAL,
|
||||
T_CONFIG_DEPRECATED,
|
||||
T_CONFIG_UNSUPPORTED
|
||||
} config_values_type_t;
|
||||
|
||||
typedef enum { T_CONFIG_SCOPE_UNSET,
|
||||
T_CONFIG_SCOPE_SERVER,
|
||||
T_CONFIG_SCOPE_CONNECTION
|
||||
} config_scope_type_t;
|
||||
|
||||
typedef struct {
|
||||
const char *key;
|
||||
void *destination;
|
||||
|
||||
config_values_type_t type;
|
||||
config_scope_type_t scope;
|
||||
} config_values_t;
|
||||
|
||||
int config_insert_values_global(server *srv, array *ca, const config_values_t *cv, config_scope_type_t scope);
|
||||
int config_insert_values_internal(server *srv, array *ca, const config_values_t *cv, config_scope_type_t scope);
|
||||
int config_check_cond(server *srv, connection *con, data_config *dc);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
%include {
|
||||
#include "first.h"
|
||||
#include "base.h"
|
||||
#include "configfile.h"
|
||||
#include "buffer.h"
|
||||
#include "array.h"
|
||||
|
@ -14,6 +15,10 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
static void configparser_push(config_t *ctx, data_config *dc, int isnew) {
|
||||
if (isnew) {
|
||||
dc->context_ndx = ctx->all_configs->used;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "sys-socket.h"
|
||||
#include "base.h"
|
||||
#include "connections.h"
|
||||
#include "fdevent.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <errno.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "buffer.h"
|
||||
#include "server.h"
|
||||
#include "log.h"
|
||||
#include "connections.h"
|
||||
#include "fdevent.h"
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
#define _CONNECTIONS_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "server.h"
|
||||
#include "fdevent.h"
|
||||
#include "base.h"
|
||||
|
||||
connection *connection_init(server *srv);
|
||||
int connection_reset(server *srv, connection *con);
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
#define __crc32cr_table_h__
|
||||
#include "first.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#elif defined HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
uint32_t generate_crc32c(const char *string, size_t length);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "array.h"
|
||||
#include "configfile.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
static data_unset *data_config_copy(const data_unset *s) {
|
||||
data_config *src = (data_config *)s;
|
||||
data_config *ds = data_config_init();
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
#include "etag.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#elif defined HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int etag_is_equal(buffer *etag, const char *line, int weak_ok) {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "buffer.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
struct stat; /* declaration */
|
||||
|
||||
typedef enum { ETAG_USE_INODE = 1, ETAG_USE_MTIME = 2, ETAG_USE_SIZE = 4 } etag_flags_t;
|
||||
|
|
|
@ -601,6 +601,15 @@ int fdevent_event_next_fdndx(fdevents *ev, int ndx) {
|
|||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <crt_externs.h>
|
||||
#define environ (* _NSGetEnviron())
|
||||
#else
|
||||
extern char **environ;
|
||||
#endif
|
||||
char ** fdevent_environ (void) { return environ; }
|
||||
|
||||
|
||||
#ifdef FD_CLOEXEC
|
||||
static int fdevent_dup2_close_clrfd_cloexec(int oldfd, int newfd) {
|
||||
if (oldfd >= 0) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "settings.h" /* (handler_t) */
|
||||
|
||||
struct fdevents; /* declaration */
|
||||
typedef struct fdevents fdevents;
|
||||
|
@ -66,6 +65,7 @@ int fdevent_open_cloexec(const char *pathname, int flags, mode_t mode);
|
|||
struct sockaddr;
|
||||
int fdevent_accept_listenfd(int listenfd, struct sockaddr *addr, size_t *addrlen);
|
||||
|
||||
char ** fdevent_environ(void);
|
||||
int fdevent_open_devnull(void);
|
||||
int fdevent_open_dirname(char *path);
|
||||
int fdevent_set_stdin_stdout_stderr(int fdin, int fdout, int fderr);
|
||||
|
|
|
@ -47,7 +47,6 @@ struct ev_loop; /* declaration */
|
|||
#endif
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "settings.h" /* (handler_t) */
|
||||
#include "fdevent.h" /* (*fdevent_handler) */
|
||||
|
||||
typedef enum {
|
||||
|
|
34
src/first.h
34
src/first.h
|
@ -13,4 +13,38 @@
|
|||
#define __STDC_WANT_LIB_EXT1__ 1
|
||||
#endif
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#elif defined HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* solaris and NetBSD 1.3.x again */
|
||||
#if (!defined(HAVE_STDINT_H)) && (!defined(HAVE_INTTYPES_H)) && (!defined(uint32_t))
|
||||
# define uint32_t u_int32_t
|
||||
#endif
|
||||
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#ifndef SIZE_MAX
|
||||
# ifdef SIZE_T_MAX
|
||||
# define SIZE_MAX SIZE_T_MAX
|
||||
# else
|
||||
# define SIZE_MAX (~(size_t)0u)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SSIZE_MAX
|
||||
# define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
|
||||
#endif
|
||||
|
||||
|
||||
#define UNUSED(x) ( (void)(x) )
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "gw_backend.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "sys-socket.h"
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
|
@ -19,6 +20,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "base.h"
|
||||
#include "array.h"
|
||||
#include "buffer.h"
|
||||
#include "crc32.h"
|
||||
|
@ -538,7 +540,7 @@ static int gw_spawn_connection(server *srv, gw_host *host, gw_proc *proc, int de
|
|||
}
|
||||
}
|
||||
} else {
|
||||
char ** const e = environ;
|
||||
char ** const e = fdevent_environ();
|
||||
for (i = 0; e[i]; ++i) {
|
||||
char *eq;
|
||||
|
||||
|
@ -1058,7 +1060,6 @@ static void gw_restart_dead_procs(server *srv, gw_host *host, int debug) {
|
|||
#include "connections.h"
|
||||
#include "joblist.h"
|
||||
#include "keyvalue.h"
|
||||
#include "plugin.h"
|
||||
#include "response.h"
|
||||
|
||||
|
||||
|
|
|
@ -255,7 +255,8 @@ typedef struct {
|
|||
|
||||
|
||||
|
||||
#include "base.h"
|
||||
#include "base_decls.h"
|
||||
#include "chunk.h"
|
||||
#include "plugin.h"
|
||||
#include "response.h"
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "sock_addr.h"
|
||||
#include "stat_cache.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "http_auth.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#define _HTTP_AUTH_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
#include "array.h"
|
||||
|
||||
void http_auth_dumbdata_reset (void);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "server.h"
|
||||
#include "base.h"
|
||||
#include "chunk.h"
|
||||
#include "http_chunk.h"
|
||||
#include "stat_cache.h"
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
#define _HTTP_CHUNK_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "server.h"
|
||||
#include <sys/types.h>
|
||||
#include "base_decls.h"
|
||||
|
||||
int http_chunk_append_mem(server *srv, connection *con, const char * mem, size_t len); /* copies memory */
|
||||
int http_chunk_append_buffer(server *srv, connection *con, buffer *mem); /* may reset "mem" */
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
#define _HTTP_VHOST_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
|
||||
void http_vhostdb_dumbdata_reset (void);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _JOB_LIST_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "base_decls.h"
|
||||
|
||||
int joblist_append(server *srv, connection *con);
|
||||
void joblist_free(server *srv, connections *joblist);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "server.h"
|
||||
#include "keyvalue.h"
|
||||
#include "base.h"
|
||||
#include "log.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -170,6 +170,10 @@ http_method_t get_http_method_key(const char *s) {
|
|||
|
||||
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
pcre_keyvalue_buffer *pcre_keyvalue_buffer_init(void) {
|
||||
pcre_keyvalue_buffer *kvb;
|
||||
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
#define _KEY_VALUE_H_
|
||||
#include "first.h"
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
# include <pcre.h>
|
||||
#endif
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
|
||||
struct server;
|
||||
struct cond_cache_t;
|
||||
struct cond_cache_t; /* declaration */
|
||||
|
||||
/* sources:
|
||||
* - [RFC2616], Section 9
|
||||
|
@ -69,10 +67,15 @@ typedef struct {
|
|||
const char *value;
|
||||
} keyvalue;
|
||||
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
struct pcre_extra; /* declaration */
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
#ifdef HAVE_PCRE_H
|
||||
pcre *key;
|
||||
pcre_extra *key_extra;
|
||||
void *key;
|
||||
struct pcre_extra *key_extra;
|
||||
#endif
|
||||
|
||||
buffer *value;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef _LOG_H_
|
||||
#define _LOG_H_
|
||||
#include "first.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
|
|
|
@ -28,6 +28,10 @@ documentation and/or software.
|
|||
|
||||
#include "md5.h"
|
||||
|
||||
#define UINT4 uint32_t
|
||||
#define UINT2 uint16_t
|
||||
#define POINTER unsigned char *
|
||||
|
||||
#if 0 /* Note: not defined here or in lighttpd local "md5.h" */
|
||||
#if defined HAVE_LIBSSL && defined HAVE_OPENSSL_SSL_H
|
||||
#define USE_OPENSSL_CRYPTO
|
||||
|
|
15
src/md5.h
15
src/md5.h
|
@ -27,21 +27,10 @@ These notices must be retained in any copies of any part of this
|
|||
documentation and/or software.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
# include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#define UINT4 uint32_t
|
||||
#define UINT2 uint16_t
|
||||
#define POINTER unsigned char *
|
||||
|
||||
/* MD5 context. */
|
||||
typedef struct {
|
||||
UINT4 state[4]; /* state (ABCD) */
|
||||
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
uint32_t state[4]; /* state (ABCD) */
|
||||
uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} li_MD5_CTX;
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "plugin.h"
|
||||
#include "http_auth.h"
|
||||
#include "log.h"
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
#include <ldap.h>
|
||||
|
||||
#include "server.h"
|
||||
#include "base.h"
|
||||
#include "http_auth.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <mysql.h>
|
||||
|
||||
#include "server.h"
|
||||
#include "base.h"
|
||||
#include "http_auth.h"
|
||||
#include "log.h"
|
||||
#include "md5.h"
|
||||
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(HAVE_CRYPT_R) || defined(HAVE_CRYPT)
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <sys/utsname.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "server.h"
|
||||
#include "base.h"
|
||||
#include "stat_cache.h"
|
||||
#include "keyvalue.h"
|
||||
#include "log.h"
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "mod_cml.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "buffer.h"
|
||||
#include "server.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "response.h"
|
||||
|
||||
#include "mod_cml.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
#define _MOD_CACHE_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
#include "server.h"
|
||||
#include "response.h"
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "mod_cml.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "server.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "response.h"
|
||||
|
|
|
@ -11,7 +11,10 @@
|
|||
#include "mod_cml_funcs.h"
|
||||
#include "mod_cml.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "chunk.h"
|
||||
#include "log.h"
|
||||
#include "response.h"
|
||||
#include "stat_cache.h"
|
||||
|
||||
#define HASHLEN 16
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#if defined HAVE_ZLIB_H && defined HAVE_LIBZ
|
||||
# define USE_ZLIB
|
||||
# include <zlib.h>
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* this is a dirlisting for a lighttpd plugin
|
||||
*/
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "plugin.h"
|
||||
#include "log.h"
|
||||
#include "response.h"
|
||||
#include "stat_cache.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "configfile.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gw_backend.h"
|
||||
|
@ -14,7 +15,6 @@ typedef gw_handler_ctx handler_ctx;
|
|||
#include "fdevent.h"
|
||||
#include "http_chunk.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "status_counter.h"
|
||||
|
||||
#ifdef HAVE_FASTCGI_FASTCGI_H
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "first.h"
|
||||
|
||||
#include "mod_magnet_cache.h"
|
||||
#include "base.h"
|
||||
#include "stat_cache.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define _MOD_MAGNET_CACHE_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
#include "base.h"
|
||||
|
||||
#include <lua.h>
|
||||
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <mysql.h>
|
||||
|
||||
#include "base.h"
|
||||
#include "plugin.h"
|
||||
#include "fdevent.h"
|
||||
#include "log.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "buffer.h"
|
||||
#include "keyvalue.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "sock_addr.h"
|
||||
#include "status_counter.h"
|
||||
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
#include <pcre.h>
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
pcre_keyvalue_buffer *redirect;
|
||||
data_config *context; /* to which apply me */
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_PCRE_H
|
||||
|
||||
#include <pcre.h>
|
||||
|
||||
typedef struct {
|
||||
pcre *key;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "plugin.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gw_backend.h"
|
||||
|
@ -13,7 +14,6 @@ typedef gw_handler_ctx handler_ctx;
|
|||
#include "base.h"
|
||||
#include "buffer.h"
|
||||
#include "log.h"
|
||||
#include "plugin.h"
|
||||
#include "status_counter.h"
|
||||
|
||||
#include "sys-endian.h"
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "sys-socket.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "sys-strings.h"
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _MOD_SSI_H_
|
||||
#include "first.h"
|
||||
|
||||
#include "base.h"
|
||||
#include "base_decls.h"
|
||||
#include "buffer.h"
|
||||
#include "array.h"
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "mod_ssi_exprparser.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|