Browse Source

[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 headers
personal/stbuehler/fix-fdevent
Glenn Strauss 4 years ago
parent
commit
04d76e7afd
  1. 79
      src/array.h
  2. 111
      src/base.h
  3. 16
      src/base_decls.h
  4. 2
      src/buffer.c
  5. 17
      src/buffer.h
  6. 6
      src/configfile-glue.c
  7. 5
      src/configfile.c
  8. 107
      src/configfile.h
  9. 5
      src/configparser.y
  10. 1
      src/connections-glue.c
  11. 2
      src/connections.c
  12. 3
      src/connections.h
  13. 8
      src/crc32.h
  14. 5
      src/data_config.c
  15. 7
      src/etag.c
  16. 1
      src/etag.h
  17. 9
      src/fdevent.c
  18. 2
      src/fdevent.h
  19. 1
      src/fdevent_impl.h
  20. 34
      src/first.h
  21. 5
      src/gw_backend.c
  22. 3
      src/gw_backend.h
  23. 1
      src/http-header-glue.c
  24. 1
      src/http_auth.c
  25. 4
      src/http_auth.h
  26. 2
      src/http_chunk.c
  27. 3
      src/http_chunk.h
  28. 3
      src/http_vhostdb.h
  29. 2
      src/joblist.h
  30. 6
      src/keyvalue.c
  31. 17
      src/keyvalue.h
  32. 1
      src/log.h
  33. 4
      src/md5.c
  34. 15
      src/md5.h
  35. 1
      src/mod_auth.c
  36. 3
      src/mod_authn_ldap.c
  37. 3
      src/mod_authn_mysql.c
  38. 1
      src/mod_authn_sasl.c
  39. 2
      src/mod_cgi.c
  40. 6
      src/mod_cml.c
  41. 3
      src/mod_cml.h
  42. 1
      src/mod_cml_funcs.c
  43. 3
      src/mod_cml_lua.c
  44. 4
      src/mod_compress.c
  45. 4
      src/mod_dirlisting.c
  46. 2
      src/mod_evhost.c
  47. 1
      src/mod_extforward.c
  48. 2
      src/mod_fastcgi.c
  49. 1
      src/mod_magnet_cache.c
  50. 2
      src/mod_magnet_cache.h
  51. 2
      src/mod_mysql_vhost.c
  52. 1
      src/mod_proxy.c
  53. 4
      src/mod_redirect.c
  54. 3
      src/mod_rewrite.c
  55. 1
      src/mod_rrdtool.c
  56. 2
      src/mod_scgi.c
  57. 1
      src/mod_ssi.c
  58. 2
      src/mod_ssi.h
  59. 1
      src/mod_ssi_expr.c
  60. 2
      src/mod_status.c
  61. 1
      src/mod_trigger_b4_dl.c
  62. 1
      src/mod_userdir.c
  63. 1
      src/mod_vhostdb.c
  64. 1
      src/mod_webdav.c
  65. 2
      src/mod_wstunnel.c
  66. 2
      src/network.c
  67. 6
      src/network.h
  68. 1
      src/plugin.c
  69. 8
      src/plugin.h
  70. 4
      src/proc_open.c
  71. 1
      src/request.c
  72. 3
      src/request.h
  73. 1
      src/response.c
  74. 4
      src/response.h
  75. 2
      src/safe_memclear.c
  76. 3
      src/safe_memclear.h
  77. 1
      src/server.c
  78. 5
      src/server.h
  79. 19
      src/settings.h
  80. 3
      src/stat_cache.c
  81. 27
      src/stat_cache.h
  82. 2
      src/status_counter.h
  83. 9
      src/sys-socket.h
  84. 8
      src/vector.c
  85. 19
      src/vector.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

@ -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 */

16
src/base_decls.h

@ -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

2
src/buffer.c

@ -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

@ -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");

6
src/configfile-glue.c

@ -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

5
src/configfile.c

@ -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

@ -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

5
src/configparser.y

@ -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;

1
src/connections-glue.c

@ -3,6 +3,7 @@
#include "sys-socket.h"
#include "base.h"
#include "connections.h"
#include "fdevent.h"
#include "log.h"
#include <errno.h>

2
src/connections.c

@ -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"

3
src/connections.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);

8
src/crc32.h

@ -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

5
src/data_config.c

@ -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();

7
src/etag.c

@ -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) {

1
src/etag.h

@ -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;

9
src/fdevent.c

@ -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) {

2
src/fdevent.h

@ -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);

1
src/fdevent_impl.h

@ -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

@ -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

5
src/gw_backend.c

@ -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"

3
src/gw_backend.h

@ -255,7 +255,8 @@ typedef struct {
#include "base.h"
#include "base_decls.h"
#include "chunk.h"
#include "plugin.h"
#include "response.h"

1
src/http-header-glue.c

@ -11,6 +11,7 @@
#include "sock_addr.h"
#include "stat_cache.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>

1
src/http_auth.c

@ -2,6 +2,7 @@
#include "http_auth.h"
#include <stdlib.h>
#include <string.h>

4
src/http_auth.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);

2
src/http_chunk.c

@ -6,7 +6,7 @@
*
*/
#include "server.h"
#include "base.h"
#include "chunk.h"
#include "http_chunk.h"
#include "stat_cache.h"

3
src/http_chunk.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" */

3
src/http_vhostdb.h

@ -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
src/joblist.h

@ -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);

6
src/keyvalue.c

@ -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;

17
src/keyvalue.h

@ -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
src/log.h

@ -1,7 +1,6 @@
#ifndef _LOG_H_
#define _LOG_H_
#include "first.h"
#include <sys/types.h>
#include "base_decls.h"
#include "buffer.h"

4
src/md5.c

@ -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

@ -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
src/mod_auth.c

@ -1,5 +1,6 @@
#include "first.h"
#include "base.h"
#include "plugin.h"
#include "http_auth.h"
#include "log.h"

3
src/mod_authn_ldap.c

@ -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 {

3
src/mod_authn_mysql.c

@ -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)

1
src/mod_authn_sasl.c

@ -20,6 +20,7 @@
#include <sys/utsname.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
typedef struct {

2
src/mod_cgi.c

@ -1,6 +1,6 @@
#include "first.h"
#include "server.h"
#include "base.h"
#include "stat_cache.h"
#include "keyvalue.h"
#include "log.h"

6
src/mod_cml.c

@ -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>

3
src/mod_cml.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"

1
src/mod_cml_funcs.c

@ -14,7 +14,6 @@
#include "mod_cml.h"
#include "buffer.h"
#include "server.h"
#include "log.h"
#include "plugin.h"
#include "response.h"

3
src/mod_cml_lua.c

@ -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

4
src/mod_compress.c

@ -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>

4
src/mod_dirlisting.c

@ -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
*/

2
src/mod_evhost.c

@ -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>

1
src/mod_extforward.c

@ -10,6 +10,7 @@
#include "configfile.h"
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

2
src/mod_fastcgi.c

@ -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
src/mod_magnet_cache.c

@ -1,6 +1,7 @@
#include "first.h"
#include "mod_magnet_cache.h"
#include "base.h"
#include "stat_cache.h"
#include <stdlib.h>

2
src/mod_magnet_cache.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
src/mod_mysql_vhost.c

@ -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"

1
src/mod_proxy.c

@ -9,7 +9,6 @@
#include "buffer.h"
#include "keyvalue.h"
#include "log.h"
#include "plugin.h"
#include "sock_addr.h"
#include "status_counter.h"

4
src/mod_redirect.c

@ -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 */

3
src/mod_rewrite.c

@ -12,6 +12,9 @@
#include <string.h>
#ifdef HAVE_PCRE_H
#include <pcre.h>
typedef struct {
pcre *key;

1
src/mod_rrdtool.c

@ -6,6 +6,7 @@
#include "plugin.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>

2
src/mod_scgi.c

@ -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"

1
src/mod_ssi.c

@ -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
src/mod_ssi.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"

1
src/mod_ssi_expr.c

@ -7,6 +7,7 @@
#include "mod_ssi_exprparser.h"
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
typedef struct {

2
src/mod_status.c

@ -1,6 +1,6 @@
#include "first.h"
#include "server.h"
#include "base.h"
#include "connections.h"
#include "response.h"
#include "connections.h"

1
src/mod_trigger_b4_dl.c

@ -8,6 +8,7 @@
#include "plugin.h"
#include "response.h"
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>

1
src/mod_userdir.c

@ -9,6 +9,7 @@
#include "plugin.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>

1
src/mod_vhostdb.c

@ -1,5 +1,6 @@
#include "first.h"
#include "base.h"
#include "plugin.h"
#include "http_vhostdb.h"
#include "log.h"

1
src/mod_webdav.c

@ -3,6 +3,7 @@
#include "base.h"
#include "log.h"
#include "buffer.h"
#include "fdevent.h"
#include "response.h"
#include "connections.h"

2
src/mod_wstunnel.c

@ -77,6 +77,7 @@
#include "first.h"
#include <sys/types.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
@ -89,7 +90,6 @@
#include "fdevent.h"
#include "joblist.h"
#include "log.h"
#include "plugin.h"
#define MOD_WEBSOCKET_LOG_NONE 0
#define MOD_WEBSOCKET_LOG_ERR 1

2
src/network.c

@ -1,10 +1,10 @@
#include "first.h"
#include "network.h"
#include "base.h"
#include "fdevent.h"
#include "log.h"
#include "connections.h"
#include "plugin.h"
#include "configfile.h"
#include "sock_addr.h"

6
src/network.h

@ -2,7 +2,9 @@
#define _NETWORK_H_
#include "first.h"
#include "server.h"
#include "base_decls.h"
struct server_socket; /* declaration */
void network_accept_tcp_nagle_disable(int fd);
@ -10,6 +12,6 @@ int network_init(server *srv, int stdin_fd);
int network_close(server *srv);
int network_register_fdevents(server *srv);
void network_unregister_sock(server *srv, server_socket *srv_socket);
void network_unregister_sock(server *srv, struct server_socket *srv_socket);
#endif

1
src/plugin.c

@ -1,6 +1,7 @@
#include "first.h"
#include "plugin.h"
#include "base.h"
#include "log.h"
#include <string.h>

8
src/plugin.h

@ -2,8 +2,10 @@
#define _PLUGIN_H_
#include "first.h"
#include "base.h"
#include "base_decls.h"
#include "buffer.h"
#include "array.h"
#include "configfile.h"
#define SERVER_FUNC(x) \
static handler_t x(server *srv, void *p_d)
@ -91,8 +93,4 @@ handler_t plugins_call_init(server *srv);
handler_t plugins_call_set_defaults(server *srv);