summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt10
-rw-r--r--src/array.h42
-rw-r--r--src/bitset.h12
-rw-r--r--src/buffer.h111
-rw-r--r--src/chunk.h54
-rw-r--r--src/configfile-glue.c1
-rw-r--r--src/configfile.h14
-rw-r--r--src/connections-glue.c1
-rw-r--r--src/connections.c20
-rw-r--r--src/connections.h18
-rw-r--r--src/crc32.h2
-rw-r--r--src/etag.h6
-rw-r--r--src/fdevent.h44
-rw-r--r--src/filter.h14
-rw-r--r--src/http-header-glue.c1
-rw-r--r--src/http_auth.h6
-rw-r--r--src/http_auth_digest.h4
-rw-r--r--src/http_req.h8
-rw-r--r--src/http_req_range.h8
-rw-r--r--src/http_resp.h8
-rw-r--r--src/inet_ntop_cache.h2
-rw-r--r--src/iosocket.h4
-rw-r--r--src/joblist.h10
-rw-r--r--src/keyvalue.h50
-rw-r--r--src/log.h16
-rw-r--r--src/md5.h6
-rw-r--r--src/mod_auth.c15
-rw-r--r--src/network.h13
-rw-r--r--src/network_backends.h37
-rw-r--r--src/response.c2
-rw-r--r--src/response.h18
-rw-r--r--src/server.c31
-rw-r--r--src/settings.h11
33 files changed, 300 insertions, 299 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a826eaac..bea6ed37 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -12,10 +12,6 @@ INCLUDE(LighttpdMacros)
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES)
-IF(WIN32)
- ADD_DEFINITIONS(/Zi)
-ENDIF(WIN32)
-
OPTION(WITH_XATTR "with xattr-support for the stat-cache [default: off]")
OPTION(WITH_MYSQL "with mysql-support for the mod_sql_vhost [default: off]")
OPTION(WITH_OPENSSL "with openssl-support [default: off]")
@@ -368,7 +364,6 @@ ADD_AND_INSTALL_LIBRARY(mod_proxy_backend_fastcgi mod_proxy_backend_fastcgi.c)
ADD_AND_INSTALL_LIBRARY(mod_proxy_backend_scgi mod_proxy_backend_scgi.c)
ADD_AND_INSTALL_LIBRARY(mod_proxy_backend_ajp13 mod_proxy_backend_ajp13.c)
ADD_AND_INSTALL_LIBRARY(mod_userdir mod_userdir.c)
-ADD_AND_INSTALL_LIBRARY(mod_cgi mod_cgi.c)
ADD_AND_INSTALL_LIBRARY(mod_secdownload mod_secure_download.c)
ADD_AND_INSTALL_LIBRARY(mod_accesslog mod_accesslog.c)
ADD_AND_INSTALL_LIBRARY(mod_simple_vhost mod_simple_vhost.c)
@@ -391,6 +386,10 @@ ADD_AND_INSTALL_LIBRARY(mod_magnet "mod_magnet.c;mod_magnet_cache.c")
ADD_AND_INSTALL_LIBRARY(mod_deflate mod_deflate.c)
ADD_AND_INSTALL_LIBRARY(mod_webdav mod_webdav.c)
+IF(NOT WIN32)
+ADD_AND_INSTALL_LIBRARY(mod_cgi mod_cgi.c)
+ENDIF(NOT WIN32)
+
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
IF(HAVE_PCRE_H)
@@ -464,6 +463,7 @@ ENDIF(CMAKE_SYSTEM MATCHES "FreeBSD")
SET_TARGET_PROPERTIES(lighttpd PROPERTIES CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
IF(WIN32)
+ SET_TARGET_PROPERTIES(lighttpd PROPERTIES COMPILE_FLAGS "-DLI_DECLARE_EXPORTS")
TARGET_LINK_LIBRARIES(lighttpd ws2_32)
TARGET_LINK_LIBRARIES(mod_proxy_core ws2_32)
TARGET_LINK_LIBRARIES(mod_proxy_backend_ajp13 ws2_32)
diff --git a/src/array.h b/src/array.h
index 1afbdf00..d07334fa 100644
--- a/src/array.h
+++ b/src/array.h
@@ -49,7 +49,7 @@ typedef struct {
int count;
} data_count;
-LI_EXPORT data_count* data_count_init(void);
+LI_API data_count* data_count_init(void);
typedef struct {
DATA_UNSET;
@@ -57,8 +57,8 @@ typedef struct {
buffer *value;
} data_string;
-LI_EXPORT data_string* data_string_init(void);
-LI_EXPORT data_string* data_response_init(void);
+LI_API data_string* data_string_init(void);
+LI_API data_string* data_response_init(void);
typedef struct {
DATA_UNSET;
@@ -66,7 +66,7 @@ typedef struct {
array *value;
} data_array;
-LI_EXPORT data_array* data_array_init(void);
+LI_API data_array* data_array_init(void);
/**
* possible compare ops in the configfile parser
@@ -128,7 +128,7 @@ struct _data_config {
#endif
};
-LI_EXPORT data_config* data_config_init(void);
+LI_API data_config* data_config_init(void);
typedef struct {
DATA_UNSET;
@@ -136,21 +136,21 @@ typedef struct {
int value;
} data_integer;
-LI_EXPORT data_integer* data_integer_init(void);
-LI_EXPORT array* array_init(void);
-LI_EXPORT array* array_init_array(array *a);
-LI_EXPORT void array_free(array *a);
-LI_EXPORT void array_reset(array *a);
-LI_EXPORT int array_insert_unique(array *a, data_unset *str);
-LI_EXPORT data_unset* array_pop(array *a);
-LI_EXPORT int array_print(array *a, int depth);
-LI_EXPORT data_unset* array_get_unused_element(array *a, data_type_t t);
-LI_EXPORT data_unset* array_get_element(array *a, const char *key, size_t key_len);
-LI_EXPORT void array_set_key_value(array *hdrs, const char *key, size_t key_len, const char *value, size_t val_len);
-LI_EXPORT void array_append_key_value(array *hdrs, const char *key, size_t key_len, const char *value, size_t val_len);
-LI_EXPORT data_unset* array_replace(array *a, data_unset *du);
-LI_EXPORT int array_strcasecmp(const char *a, size_t a_len, const char *b, size_t b_len);
-LI_EXPORT void array_print_indent(int depth);
-LI_EXPORT size_t array_get_max_key_length(array *a);
+LI_API data_integer* data_integer_init(void);
+LI_API array* array_init(void);
+LI_API array* array_init_array(array *a);
+LI_API void array_free(array *a);
+LI_API void array_reset(array *a);
+LI_API int array_insert_unique(array *a, data_unset *str);
+LI_API data_unset* array_pop(array *a);
+LI_API int array_print(array *a, int depth);
+LI_API data_unset* array_get_unused_element(array *a, data_type_t t);
+LI_API data_unset* array_get_element(array *a, const char *key, size_t key_len);
+LI_API void array_set_key_value(array *hdrs, const char *key, size_t key_len, const char *value, size_t val_len);
+LI_API void array_append_key_value(array *hdrs, const char *key, size_t key_len, const char *value, size_t val_len);
+LI_API data_unset* array_replace(array *a, data_unset *du);
+LI_API int array_strcasecmp(const char *a, size_t a_len, const char *b, size_t b_len);
+LI_API void array_print_indent(int depth);
+LI_API size_t array_get_max_key_length(array *a);
#endif
diff --git a/src/bitset.h b/src/bitset.h
index 953be6f5..45f9a9d5 100644
--- a/src/bitset.h
+++ b/src/bitset.h
@@ -10,12 +10,12 @@ typedef struct {
size_t nbits;
} bitset;
-LI_EXPORT bitset* bitset_init(size_t nbits);
-LI_EXPORT void bitset_reset(bitset *set);
-LI_EXPORT void bitset_free(bitset *set);
+LI_API bitset* bitset_init(size_t nbits);
+LI_API void bitset_reset(bitset *set);
+LI_API void bitset_free(bitset *set);
-LI_EXPORT void bitset_clear_bit(bitset *set, size_t pos);
-LI_EXPORT void bitset_set_bit(bitset *set, size_t pos);
-LI_EXPORT int bitset_test_bit(bitset *set, size_t pos);
+LI_API void bitset_clear_bit(bitset *set, size_t pos);
+LI_API void bitset_set_bit(bitset *set, size_t pos);
+LI_API int bitset_test_bit(bitset *set, size_t pos);
#endif
diff --git a/src/buffer.h b/src/buffer.h
index e2e1c3ce..872e6543 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -6,11 +6,6 @@
#include <stdlib.h>
#include <sys/types.h>
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "settings.h"
#include "array-static.h"
typedef struct {
@@ -45,62 +40,62 @@ typedef struct {
size_t size;
} read_buffer;
-LI_EXPORT buffer_ptr* buffer_ptr_init(buffer_ptr_free_t freer);
-LI_EXPORT void buffer_ptr_free(buffer_ptr *b);
-LI_EXPORT void buffer_ptr_clear(buffer_ptr *b);
-LI_EXPORT void buffer_ptr_append(buffer_ptr *b, void *item);
-LI_EXPORT void* buffer_ptr_pop(buffer_ptr *b);
-LI_EXPORT void* buffer_ptr_top(buffer_ptr *b);
+LI_API buffer_ptr* buffer_ptr_init(buffer_ptr_free_t freer);
+LI_API void buffer_ptr_free(buffer_ptr *b);
+LI_API void buffer_ptr_clear(buffer_ptr *b);
+LI_API void buffer_ptr_append(buffer_ptr *b, void *item);
+LI_API void* buffer_ptr_pop(buffer_ptr *b);
+LI_API void* buffer_ptr_top(buffer_ptr *b);
-LI_EXPORT buffer_array* buffer_array_init(void);
-LI_EXPORT void buffer_array_free(buffer_array *b);
-LI_EXPORT void buffer_array_reset(buffer_array *b);
-LI_EXPORT buffer* buffer_array_append_get_buffer(buffer_array *b);
+LI_API buffer_array* buffer_array_init(void);
+LI_API void buffer_array_free(buffer_array *b);
+LI_API void buffer_array_reset(buffer_array *b);
+LI_API buffer* buffer_array_append_get_buffer(buffer_array *b);
-LI_EXPORT buffer* buffer_init(void);
-LI_EXPORT buffer* buffer_init_buffer(buffer *b);
-LI_EXPORT buffer* buffer_init_string(const char *str);
-LI_EXPORT void buffer_free(buffer *b);
-LI_EXPORT void buffer_reset(buffer *b);
+LI_API buffer* buffer_init(void);
+LI_API buffer* buffer_init_buffer(buffer *b);
+LI_API buffer* buffer_init_string(const char *str);
+LI_API void buffer_free(buffer *b);
+LI_API void buffer_reset(buffer *b);
-LI_EXPORT int buffer_prepare_copy(buffer *b, size_t size);
-LI_EXPORT int buffer_prepare_append(buffer *b, size_t size);
+LI_API int buffer_prepare_copy(buffer *b, size_t size);
+LI_API int buffer_prepare_append(buffer *b, size_t size);
-LI_EXPORT int buffer_copy_string(buffer *b, const char *s);
-LI_EXPORT int buffer_copy_string_len(buffer *b, const char *s, size_t s_len);
-LI_EXPORT int buffer_copy_string_buffer(buffer *b, const buffer *src);
-LI_EXPORT int buffer_copy_string_hex(buffer *b, const char *in, size_t in_len);
+LI_API int buffer_copy_string(buffer *b, const char *s);
+LI_API int buffer_copy_string_len(buffer *b, const char *s, size_t s_len);
+LI_API int buffer_copy_string_buffer(buffer *b, const buffer *src);
+LI_API int buffer_copy_string_hex(buffer *b, const char *in, size_t in_len);
-LI_EXPORT int buffer_copy_long(buffer *b, long val);
+LI_API int buffer_copy_long(buffer *b, long val);
-LI_EXPORT int buffer_copy_memory(buffer *b, const char *s, size_t s_len);
+LI_API int buffer_copy_memory(buffer *b, const char *s, size_t s_len);
-LI_EXPORT int buffer_append_string(buffer *b, const char *s);
-LI_EXPORT int buffer_append_string_len(buffer *b, const char *s, size_t s_len);
-LI_EXPORT int buffer_append_string_buffer(buffer *b, const buffer *src);
-LI_EXPORT int buffer_append_string_lfill(buffer *b, const char *s, size_t maxlen);
-LI_EXPORT int buffer_append_string_rfill(buffer *b, const char *s, size_t maxlen);
+LI_API int buffer_append_string(buffer *b, const char *s);
+LI_API int buffer_append_string_len(buffer *b, const char *s, size_t s_len);
+LI_API int buffer_append_string_buffer(buffer *b, const buffer *src);
+LI_API int buffer_append_string_lfill(buffer *b, const char *s, size_t maxlen);
+LI_API int buffer_append_string_rfill(buffer *b, const char *s, size_t maxlen);
-LI_EXPORT int buffer_append_long_hex(buffer *b, unsigned long len);
-LI_EXPORT int buffer_append_long(buffer *b, long val);
+LI_API int buffer_append_long_hex(buffer *b, unsigned long len);
+LI_API int buffer_append_long(buffer *b, long val);
#if defined(SIZEOF_LONG) && (SIZEOF_LONG == SIZEOF_OFF_T)
#define buffer_copy_off_t(x, y) buffer_copy_long(x, y)
#define buffer_append_off_t(x, y) buffer_append_long(x, y)
#else
-LI_EXPORT int buffer_copy_off_t(buffer *b, off_t val);
-LI_EXPORT int buffer_append_off_t(buffer *b, off_t val);
+LI_API int buffer_copy_off_t(buffer *b, off_t val);
+LI_API int buffer_append_off_t(buffer *b, off_t val);
#endif
-LI_EXPORT int buffer_append_memory(buffer *b, const char *s, size_t s_len);
+LI_API int buffer_append_memory(buffer *b, const char *s, size_t s_len);
-LI_EXPORT char* buffer_search_string_len(buffer *b, const char *needle, size_t len);
+LI_API char* buffer_search_string_len(buffer *b, const char *needle, size_t len);
-LI_EXPORT int buffer_is_empty(buffer *b);
-LI_EXPORT int buffer_is_equal(buffer *a, buffer *b);
-LI_EXPORT int buffer_is_equal_right_len(buffer *a, buffer *b, size_t len);
-LI_EXPORT int buffer_is_equal_string(buffer *a, const char *s, size_t b_len);
-LI_EXPORT int buffer_caseless_compare(const char *a, size_t a_len, const char *b, size_t b_len);
+LI_API int buffer_is_empty(buffer *b);
+LI_API int buffer_is_equal(buffer *a, buffer *b);
+LI_API int buffer_is_equal_right_len(buffer *a, buffer *b, size_t len);
+LI_API int buffer_is_equal_string(buffer *a, const char *s, size_t b_len);
+LI_API int buffer_caseless_compare(const char *a, size_t a_len, const char *b, size_t b_len);
typedef enum {
ENCODING_UNSET,
@@ -111,24 +106,24 @@ typedef enum {
ENCODING_HEX /* encode string as hex */
} buffer_encoding_t;
-LI_EXPORT int buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer_encoding_t encoding);
+LI_API int buffer_append_string_encoded(buffer *b, const char *s, size_t s_len, buffer_encoding_t encoding);
-LI_EXPORT int buffer_urldecode_path(buffer *url);
-LI_EXPORT int buffer_urldecode_query(buffer *url);
-LI_EXPORT int buffer_path_simplify(buffer *dest, buffer *src);
+LI_API int buffer_urldecode_path(buffer *url);
+LI_API int buffer_urldecode_query(buffer *url);
+LI_API int buffer_path_simplify(buffer *dest, buffer *src);
-LI_EXPORT int buffer_to_lower(buffer *b);
-LI_EXPORT int buffer_to_upper(buffer *b);
+LI_API int buffer_to_lower(buffer *b);
+LI_API int buffer_to_upper(buffer *b);
/** deprecated */
-LI_EXPORT int ltostr(char *buf, long val);
-LI_EXPORT char hex2int(unsigned char c);
-LI_EXPORT char int2hex(char i);
-
-LI_EXPORT int light_isdigit(int c);
-LI_EXPORT int light_isxdigit(int c);
-LI_EXPORT int light_isalpha(int c);
-LI_EXPORT int light_isalnum(int c);
+LI_API int ltostr(char *buf, long val);
+LI_API char hex2int(unsigned char c);
+LI_API char int2hex(char i);
+
+LI_API int light_isdigit(int c);
+LI_API int light_isxdigit(int c);
+LI_API int light_isalpha(int c);
+LI_API int light_isalnum(int c);
#define BUFFER_CTYPE_FUNC(type) int buffer_is##type(buffer *b);
BUFFER_CTYPE_FUNC(digit)
diff --git a/src/chunk.h b/src/chunk.h
index c16d1da5..8e64d824 100644
--- a/src/chunk.h
+++ b/src/chunk.h
@@ -59,32 +59,32 @@ typedef struct {
off_t bytes_in, bytes_out;
} chunkqueue;
-LI_EXPORT chunkqueue* chunkqueue_init(void);
-LI_EXPORT int chunkqueue_set_tempdirs(chunkqueue *c, array *tempdirs);
-LI_EXPORT int chunkqueue_append_file(chunkqueue *c, buffer *fn, off_t offset, off_t len);
-LI_EXPORT int chunkqueue_append_mem(chunkqueue *c, const char *mem, size_t len);
-LI_EXPORT int chunkqueue_append_buffer(chunkqueue *c, buffer *mem);
-LI_EXPORT int chunkqueue_prepend_buffer(chunkqueue *c, buffer *mem);
-
-LI_EXPORT buffer * chunkqueue_get_append_buffer(chunkqueue *c);
-LI_EXPORT buffer * chunkqueue_get_prepend_buffer(chunkqueue *c);
-LI_EXPORT chunk * chunkqueue_get_append_tempfile(chunkqueue *cq);
-LI_EXPORT int chunkqueue_steal_tempfile(chunkqueue *cq, chunk *in);
-LI_EXPORT int chunkqueue_steal_chunk(chunkqueue *cq, chunk *c);
-LI_EXPORT int chunkqueue_steal_chunks_len(chunkqueue *cq, chunk *c, size_t max_len);
-LI_EXPORT int chunkqueue_steal_all_chunks(chunkqueue *cq, chunkqueue *in);
-LI_EXPORT int chunkqueue_skip(chunkqueue *cq, off_t skip);
-LI_EXPORT void chunkqueue_remove_empty_last_chunk(chunkqueue *cq);
-
-LI_EXPORT int chunkqueue_remove_finished_chunks(chunkqueue *cq);
-
-LI_EXPORT off_t chunkqueue_length(chunkqueue *c);
-LI_EXPORT off_t chunkqueue_written(chunkqueue *c);
-LI_EXPORT void chunkqueue_free(chunkqueue *c);
-LI_EXPORT void chunkqueue_reset(chunkqueue *c);
-
-LI_EXPORT int chunkqueue_is_empty(chunkqueue *c);
-
-LI_EXPORT void chunkqueue_print(chunkqueue *cq);
+LI_API chunkqueue* chunkqueue_init(void);
+LI_API int chunkqueue_set_tempdirs(chunkqueue *c, array *tempdirs);
+LI_API int chunkqueue_append_file(chunkqueue *c, buffer *fn, off_t offset, off_t len);
+LI_API int chunkqueue_append_mem(chunkqueue *c, const char *mem, size_t len);
+LI_API int chunkqueue_append_buffer(chunkqueue *c, buffer *mem);
+LI_API int chunkqueue_prepend_buffer(chunkqueue *c, buffer *mem);
+
+LI_API buffer * chunkqueue_get_append_buffer(chunkqueue *c);
+LI_API buffer * chunkqueue_get_prepend_buffer(chunkqueue *c);
+LI_API chunk * chunkqueue_get_append_tempfile(chunkqueue *cq);
+LI_API int chunkqueue_steal_tempfile(chunkqueue *cq, chunk *in);
+LI_API int chunkqueue_steal_chunk(chunkqueue *cq, chunk *c);
+LI_API int chunkqueue_steal_chunks_len(chunkqueue *cq, chunk *c, size_t max_len);
+LI_API int chunkqueue_steal_all_chunks(chunkqueue *cq, chunkqueue *in);
+LI_API int chunkqueue_skip(chunkqueue *cq, off_t skip);
+LI_API void chunkqueue_remove_empty_last_chunk(chunkqueue *cq);
+
+LI_API int chunkqueue_remove_finished_chunks(chunkqueue *cq);
+
+LI_API off_t chunkqueue_length(chunkqueue *c);
+LI_API off_t chunkqueue_written(chunkqueue *c);
+LI_API void chunkqueue_free(chunkqueue *c);
+LI_API void chunkqueue_reset(chunkqueue *c);
+
+LI_API int chunkqueue_is_empty(chunkqueue *c);
+
+LI_API void chunkqueue_print(chunkqueue *cq);
#endif
diff --git a/src/configfile-glue.c b/src/configfile-glue.c
index e7eb7f00..0763feb0 100644
--- a/src/configfile-glue.c
+++ b/src/configfile-glue.c
@@ -6,6 +6,7 @@
#include "array.h"
#include "log.h"
#include "plugin.h"
+#include "configfile.h"
/**
* like all glue code this file contains functions which
diff --git a/src/configfile.h b/src/configfile.h
index 5ba12be0..34d99429 100644
--- a/src/configfile.h
+++ b/src/configfile.h
@@ -15,12 +15,12 @@ typedef struct {
buffer *basedir;
} config_t;
-LI_EXPORT void * configparserAlloc(void *(*mallocProc)(size_t));
-LI_EXPORT void configparserFree(void *p, void (*freeProc)(void*));
-LI_EXPORT void configparser(void *yyp, int yymajor, buffer *yyminor, config_t *ctx);
-LI_EXPORT int config_parse_file(server *srv, config_t *context, const char *fn);
-LI_EXPORT int config_parse_cmd(server *srv, config_t *context, const char *cmd);
-LI_EXPORT data_unset * configparser_merge_data(data_unset *op1, const data_unset *op2);
-LI_EXPORT void config_cond_cache_reset(server *srv, connection *con);
+LI_API void * configparserAlloc(void *(*mallocProc)(size_t));
+LI_API void configparserFree(void *p, void (*freeProc)(void*));
+LI_API void configparser(void *yyp, int yymajor, buffer *yyminor, config_t *ctx);
+LI_API int config_parse_file(server *srv, config_t *context, const char *fn);
+LI_API int config_parse_cmd(server *srv, config_t *context, const char *cmd);
+LI_API data_unset * configparser_merge_data(data_unset *op1, const data_unset *op2);
+LI_API void config_cond_cache_reset(server *srv, connection *con);
#endif
diff --git a/src/connections-glue.c b/src/connections-glue.c
index bccfd434..fa5cf36f 100644
--- a/src/connections-glue.c
+++ b/src/connections-glue.c
@@ -1,4 +1,5 @@
#include "base.h"
+#include "connections.h"
const char *connection_get_state(connection_state_t state) {
switch (state) {
diff --git a/src/connections.c b/src/connections.c
index e93e32d2..bdb597e4 100644
--- a/src/connections.c
+++ b/src/connections.c
@@ -7,6 +7,8 @@
#include <fcntl.h>
#include <assert.h>
+#include "settings.h"
+
#include "server.h"
#include "connections.h"
#include "fdevent.h"
@@ -789,20 +791,20 @@ handler_t connection_handle_fdevent(void *s, void *context, int revents) {
case CON_STATE_CLOSE: /* ignore the even, we will clean-up soon */
break;
case CON_STATE_ERROR:
- ERROR("we are in (CON_STATE_ERROR), but still get a FDEVENT_IN, removing event from fd = %d, %04x for (%s)",
+ ERROR("we are in (CON_STATE_ERROR), but still get a FDEVENT_IN, removing event from fd = %d, %04x for (%s)",
con->sock->fd,
- revents,
+ revents,
BUF_STR(con->uri.path));
-
+
fdevent_event_del(srv->ev, con->sock);
joblist_append(srv, con);
break;
default:
- ERROR("I thought only READ_REQUEST_* need fdevent-in: %d, fd = %d, %04x for (%s)",
- con->state,
+ ERROR("I thought only READ_REQUEST_* need fdevent-in: %d, fd = %d, %04x for (%s)",
+ con->state,
con->sock->fd,
- revents,
+ revents,
BUF_STR(con->uri.path));
break;
}
@@ -857,7 +859,7 @@ connection *connection_accept(server *srv, server_socket *srv_socket) {
case ECONNABORTED: /* this is a FreeBSD thingy */
/* we were stopped _after_ we had a connection */
break;
-
+
case EMFILE: /* we are out of FDs */
server_out_of_fds(srv, NULL);
break;
@@ -1336,11 +1338,11 @@ int connection_state_machine(server *srv, connection *con) {
return HANDLER_WAIT_FOR_EVENT;
case NETWORK_STATUS_WAIT_FOR_FD:
- /* the backend received a EMFILE
+ /* the backend received a EMFILE
* - e.g. for a mmap() of /dev/zero */
server_out_of_fds(srv, con);
-
+
return HANDLER_WAIT_FOR_FD;
case NETWORK_STATUS_INTERRUPTED:
case NETWORK_STATUS_UNSET:
diff --git a/src/connections.h b/src/connections.h
index a65f593a..59bec6ac 100644
--- a/src/connections.h
+++ b/src/connections.h
@@ -5,16 +5,16 @@
#include "server.h"
#include "fdevent.h"
-LI_EXPORT connection* connection_init(server *srv);
-LI_EXPORT int connection_reset(server *srv, connection *con);
-LI_EXPORT void connections_free(server *srv);
+LI_API connection* connection_init(server *srv);
+LI_API int connection_reset(server *srv, connection *con);
+LI_API void connections_free(server *srv);
-LI_EXPORT connection* connection_accept(server *srv, server_socket *srv_sock);
-LI_EXPORT int connection_close(server *srv, connection *con);
+LI_API connection* connection_accept(server *srv, server_socket *srv_sock);
+LI_API int connection_close(server *srv, connection *con);
-LI_EXPORT int connection_set_state(server *srv, connection *con, connection_state_t state);
-LI_EXPORT const char * connection_get_state(connection_state_t state);
-LI_EXPORT const char * connection_get_short_state(connection_state_t state);
-LI_EXPORT int connection_state_machine(server *srv, connection *con);
+LI_API int connection_set_state(server *srv, connection *con, connection_state_t state);
+LI_API const char * connection_get_state(connection_state_t state);
+LI_API const char * connection_get_short_state(connection_state_t state);
+LI_API int connection_state_machine(server *srv, connection *con);
#endif
diff --git a/src/crc32.h b/src/crc32.h
index ba5b4f65..22b112d9 100644
--- a/src/crc32.h
+++ b/src/crc32.h
@@ -20,6 +20,6 @@
#include "settings.h"
-LI_EXPORT uint32_t generate_crc32c(char *string, size_t length);
+LI_API uint32_t generate_crc32c(char *string, size_t length);
#endif
diff --git a/src/etag.h b/src/etag.h
index f8e0928d..97037b70 100644
--- a/src/etag.h
+++ b/src/etag.h
@@ -6,9 +6,9 @@
#include "buffer.h"
-LI_EXPORT int etag_is_equal(buffer *etag, const char *matches);
-LI_EXPORT int etag_create(buffer *etag, struct stat *st);
-LI_EXPORT int etag_mutate(buffer *mut, buffer *etag);
+LI_API int etag_is_equal(buffer *etag, const char *matches);
+LI_API int etag_create(buffer *etag, struct stat *st);
+LI_API int etag_mutate(buffer *mut, buffer *etag);
#endif
diff --git a/src/fdevent.h b/src/fdevent.h
index f2300256..2a0cfac2 100644
--- a/src/fdevent.h
+++ b/src/fdevent.h
@@ -213,54 +213,54 @@ typedef struct fdevents {
int (*fcntl_set)(struct fdevents *ev, int fd);
} fdevents;
-LI_EXPORT fdevents* fdevent_init(size_t maxfds, fdevent_handler_t type);
-LI_EXPORT int fdevent_reset(fdevents *ev);
-LI_EXPORT void fdevent_free(fdevents *ev);
+LI_API fdevents* fdevent_init(size_t maxfds, fdevent_handler_t type);
+LI_API int fdevent_reset(fdevents *ev);
+LI_API void fdevent_free(fdevents *ev);
/**
* call the plugin for the number of available events
*/
-LI_EXPORT int fdevent_poll(fdevents *ev, int timeout_ms);
+LI_API int fdevent_poll(fdevents *ev, int timeout_ms);
/**
* get all available events
*/
-LI_EXPORT int fdevent_get_revents(fdevents *ev, size_t event_count, fdevent_revents *revents);
+LI_API int fdevent_get_revents(fdevents *ev, size_t event_count, fdevent_revents *revents);
/**
* add or remove a fd to the handled-pool
*/
-LI_EXPORT int fdevent_register(fdevents *ev, iosocket *sock, fdevent_handler handler, void *ctx);
-LI_EXPORT int fdevent_unregister(fdevents *ev, iosocket *sock);
+LI_API int fdevent_register(fdevents *ev, iosocket *sock, fdevent_handler handler, void *ctx);
+LI_API int fdevent_unregister(fdevents *ev, iosocket *sock);
/**
* add a event to a registered fd
*/
-LI_EXPORT int fdevent_event_add(fdevents *ev, iosocket *sock, int events);
-LI_EXPORT int fdevent_event_del(fdevents *ev, iosocket *sock);
+LI_API int fdevent_event_add(fdevents *ev, iosocket *sock, int events);
+LI_API int fdevent_event_del(fdevents *ev, iosocket *sock);
/**
* set non-blocking
*/
-LI_EXPORT int fdevent_fcntl_set(fdevents *ev, iosocket *sock);
+LI_API int fdevent_fcntl_set(fdevents *ev, iosocket *sock);
-LI_EXPORT fdevent_revents* fdevent_revents_init(void);
-LI_EXPORT void fdevent_revents_reset(fdevent_revents *revents);
-LI_EXPORT void fdevent_revents_add(fdevent_revents *revents, int fd, int events);
-LI_EXPORT void fdevent_revents_free(fdevent_revents *revents);
+LI_API fdevent_revents* fdevent_revents_init(void);
+LI_API void fdevent_revents_reset(fdevent_revents *revents);
+LI_API void fdevent_revents_add(fdevent_revents *revents, int fd, int events);
+LI_API void fdevent_revents_free(fdevent_revents *revents);
-LI_EXPORT fdevent_revent* fdevent_revent_init(void);
-LI_EXPORT void fdevent_revent_free(fdevent_revent *revent);
+LI_API fdevent_revent* fdevent_revent_init(void);
+LI_API void fdevent_revent_free(fdevent_revent *revent);
/**
* plugin init
*/
-LI_EXPORT int fdevent_select_init(fdevents *ev);
-LI_EXPORT int fdevent_poll_init(fdevents *ev);
-LI_EXPORT int fdevent_linux_rtsig_init(fdevents *ev);
-LI_EXPORT int fdevent_linux_sysepoll_init(fdevents *ev);
-LI_EXPORT int fdevent_solaris_devpoll_init(fdevents *ev);
-LI_EXPORT int fdevent_freebsd_kqueue_init(fdevents *ev);
+LI_API int fdevent_select_init(fdevents *ev);
+LI_API int fdevent_poll_init(fdevents *ev);
+LI_API int fdevent_linux_rtsig_init(fdevents *ev);
+LI_API int fdevent_linux_sysepoll_init(fdevents *ev);
+LI_API int fdevent_solaris_devpoll_init(fdevents *ev);
+LI_API int fdevent_freebsd_kqueue_init(fdevents *ev);
#endif
diff --git a/src/filter.h b/src/filter.h
index 5828e1ef..a1b87d1a 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -29,14 +29,14 @@ typedef struct {
} filter_chain;
-LI_EXPORT filter_chain * filter_chain_init(void);
-LI_EXPORT void filter_chain_free(filter_chain *chain);
-LI_EXPORT void filter_chain_reset(filter_chain *chain);
+LI_API filter_chain * filter_chain_init(void);
+LI_API void filter_chain_free(filter_chain *chain);
+LI_API void filter_chain_reset(filter_chain *chain);
-LI_EXPORT filter * filter_chain_create_filter(filter_chain *chain, int id);
-LI_EXPORT filter * filter_chain_get_filter(filter_chain *chain, int id);
-LI_EXPORT void filter_chain_remove_filter(filter_chain *chain, filter *fl);
+LI_API filter * filter_chain_create_filter(filter_chain *chain, int id);
+LI_API filter * filter_chain_get_filter(filter_chain *chain, int id);
+LI_API void filter_chain_remove_filter(filter_chain *chain, filter *fl);
-LI_EXPORT int filter_chain_copy_output(filter_chain *chain, chunkqueue *out);
+LI_API int filter_chain_copy_output(filter_chain *chain, chunkqueue *out);
#endif
diff --git a/src/http-header-glue.c b/src/http-header-glue.c
index a6b5ca9b..b7e9fabc 100644
--- a/src/http-header-glue.c
+++ b/src/http-header-glue.c
@@ -14,6 +14,7 @@
#include "buffer.h"
#include "log.h"
#include "etag.h"
+#include "response.h"
/*
* This was 'borrowed' from tcpdump.
diff --git a/src/http_auth.h b/src/http_auth.h
index 278ba478..547e797f 100644
--- a/src/http_auth.h
+++ b/src/http_auth.h
@@ -68,8 +68,8 @@ typedef struct {
mod_auth_plugin_config conf; /* this is only used as long as no handler_ctx is setup */
} mod_auth_plugin_data;
-LI_EXPORT int http_auth_basic_check(server *srv, connection *con, mod_auth_plugin_data *p, array *req, buffer *url, const char *realm_str);
-LI_EXPORT int http_auth_digest_check(server *srv, connection *con, mod_auth_plugin_data *p, array *req, buffer *url, const char *realm_str);
-LI_EXPORT int http_auth_digest_generate_nonce(server *srv, mod_auth_plugin_data *p, buffer *fn, char hh[33]);
+int http_auth_basic_check(server *srv, connection *con, mod_auth_plugin_data *p, array *req, buffer *url, const char *realm_str);
+int http_auth_digest_check(server *srv, connection *con, mod_auth_plugin_data *p, array *req, buffer *url, const char *realm_str);
+int http_auth_digest_generate_nonce(server *srv, mod_auth_plugin_data *p, buffer *fn, char hh[33]);
#endif
diff --git a/src/http_auth_digest.h b/src/http_auth_digest.h
index 62f0c5d1..25d95ee4 100644
--- a/src/http_auth_digest.h
+++ b/src/http_auth_digest.h
@@ -5,8 +5,6 @@
#include "config.h"
#endif
-#include "settings.h"
-
#define HASHLEN 16
typedef unsigned char HASH[HASHLEN];
#define HASHHEXLEN 32
@@ -18,7 +16,7 @@ typedef char HASHHEX[HASHHEXLEN+1];
#endif
#define OUT
-LI_EXPORT void CvtHex(
+void CvtHex(
IN HASH Bin,
OUT HASHHEX Hex
);
diff --git a/src/http_req.h b/src/http_req.h
index 0acbbd2f..5e8aeb0a 100644
--- a/src/http_req.h
+++ b/src/http_req.h
@@ -20,10 +20,10 @@ typedef struct {
buffer_pool *unused_buffers;
} http_req_ctx_t;
-LI_EXPORT http_req * http_request_init(void);
-LI_EXPORT void http_request_free(http_req *req);
-LI_EXPORT void http_request_reset(http_req *req);
+LI_API http_req * http_request_init(void);
+LI_API void http_request_free(http_req *req);
+LI_API void http_request_reset(http_req *req);
-LI_EXPORT parse_status_t http_request_parse_cq(chunkqueue *cq, http_req *http_request);
+LI_API parse_status_t http_request_parse_cq(chunkqueue *cq, http_req *http_request);
#endif
diff --git a/src/http_req_range.h b/src/http_req_range.h
index 91dbbe5c..96935f4b 100644
--- a/src/http_req_range.h
+++ b/src/http_req_range.h
@@ -20,10 +20,10 @@ typedef struct {
buffer_pool *unused_buffers;
} http_req_range_ctx_t;
-LI_EXPORT http_req_range * http_request_range_init(void);
-LI_EXPORT void http_request_range_free(http_req_range *range);
-LI_EXPORT void http_request_range_reset(http_req_range *range);
+LI_API http_req_range * http_request_range_init(void);
+LI_API void http_request_range_free(http_req_range *range);
+LI_API void http_request_range_reset(http_req_range *range);
-LI_EXPORT parse_status_t http_request_range_parse(buffer *range_hdr, http_req_range *ranges);
+LI_API parse_status_t http_request_range_parse(buffer *range_hdr, http_req_range *ranges);
#endif
diff --git a/src/http_resp.h b/src/http_resp.h
index b0be6e0c..9cb05bd7 100644
--- a/src/http_resp.h
+++ b/src/http_resp.h
@@ -23,10 +23,10 @@ typedef struct {
buffer_pool *unused_buffers;
} http_resp_ctx_t;
-LI_EXPORT http_resp * http_response_init(void);
-LI_EXPORT void http_response_free(http_resp *resp);
-LI_EXPORT void http_response_reset(http_resp *resp);
+LI_API http_resp * http_response_init(void);
+LI_API void http_response_free(http_resp *resp);
+LI_API void http_response_reset(http_resp *resp);
-LI_EXPORT parse_status_t http_response_parse_cq(chunkqueue *cq, http_resp *http_response);
+LI_API parse_status_t http_response_parse_cq(chunkqueue *cq, http_resp *http_response);
#endif
diff --git a/src/inet_ntop_cache.h b/src/inet_ntop_cache.h
index d5c2f6e4..b2a769f2 100644
--- a/src/inet_ntop_cache.h
+++ b/src/inet_ntop_cache.h
@@ -2,6 +2,6 @@
#define _INET_NTOP_CACHE_H_
#include "base.h"
-LI_EXPORT const char * inet_ntop_cache_get_ip(server *srv, sock_addr *addr);
+LI_API const char * inet_ntop_cache_get_ip(server *srv, sock_addr *addr);
#endif
diff --git a/src/iosocket.h b/src/iosocket.h
index 92010087..c1d6cb69 100644
--- a/src/iosocket.h
+++ b/src/iosocket.h
@@ -40,7 +40,7 @@ typedef struct {
iosocket_t type; /**< sendfile on solaris doesn't work on pipes */
} iosocket;
-LI_EXPORT iosocket * iosocket_init(void);
-LI_EXPORT void iosocket_free(iosocket *sock);
+LI_API iosocket * iosocket_init(void);
+LI_API void iosocket_free(iosocket *sock);
#endif
diff --git a/src/joblist.h b/src/joblist.h
index 4bf9b649..037f1815 100644
--- a/src/joblist.h
+++ b/src/joblist.h
@@ -3,11 +3,11 @@
#include "base.h"
-LI_EXPORT int joblist_append(server *srv, connection *con);
-LI_EXPORT void joblist_free(server *srv, connections *joblist);
+LI_API int joblist_append(server *srv, connection *con);
+LI_API void joblist_free(server *srv, connections *joblist);
-LI_EXPORT int fdwaitqueue_append(server *srv, connection *con);
-LI_EXPORT void fdwaitqueue_free(server *srv, connections *fdwaitqueue);
-LI_EXPORT connection* fdwaitqueue_unshift(server *srv, connections *fdwaitqueue);
+LI_API int fdwaitqueue_append(server *srv, connection *con);
+LI_API void fdwaitqueue_free(server *srv, connections *fdwaitqueue);
+LI_API connection* fdwaitqueue_unshift(server *srv, connections *fdwaitqueue);
#endif
diff --git a/src/keyvalue.h b/src/keyvalue.h
index 5802fa49..e3b65c38 100644
--- a/src/keyvalue.h
+++ b/src/keyvalue.h
@@ -83,30 +83,30 @@ KVB(s_keyvalue);
KVB(httpauth_keyvalue);
KVB(pcre_keyvalue);
-LI_EXPORT const char * get_http_status_name(int i);
-LI_EXPORT const char * get_http_version_name(int i);
-LI_EXPORT const char * get_http_method_name(http_method_t i);
-LI_EXPORT const char * get_http_status_body_name(int i);
-LI_EXPORT int get_http_version_key(const char *s);
-LI_EXPORT http_method_t get_http_method_key(const char *s);
-
-LI_EXPORT const char * keyvalue_get_value(keyvalue *kv, int k);
-LI_EXPORT int keyvalue_get_key(keyvalue *kv, const char *s);
-
-LI_EXPORT keyvalue_buffer * keyvalue_buffer_init(void);
-LI_EXPORT int keyvalue_buffer_append(keyvalue_buffer *kvb, int k, const char *value);
-LI_EXPORT void keyvalue_buffer_free(keyvalue_buffer *kvb);
-
-LI_EXPORT s_keyvalue_buffer * s_keyvalue_buffer_init(void);
-LI_EXPORT int s_keyvalue_buffer_append(s_keyvalue_buffer *kvb, const char *key, const char *value);
-LI_EXPORT void s_keyvalue_buffer_free(s_keyvalue_buffer *kvb);
-
-LI_EXPORT httpauth_keyvalue_buffer * httpauth_keyvalue_buffer_init(void);
-LI_EXPORT int httpauth_keyvalue_buffer_append(httpauth_keyvalue_buffer *kvb, const char *key, const char *realm, httpauth_type type);
-LI_EXPORT void httpauth_keyvalue_buffer_free(httpauth_keyvalue_buffer *kvb);
-
-LI_EXPORT pcre_keyvalue_buffer * pcre_keyvalue_buffer_init(void);
-LI_EXPORT int pcre_keyvalue_buffer_append(pcre_keyvalue_buffer *kvb, const char *key, const char *value);
-LI_EXPORT void pcre_keyvalue_buffer_free(pcre_keyvalue_buffer *kvb);
+LI_API const char * get_http_status_name(int i);
+LI_API const char * get_http_version_name(int i);
+LI_API const char * get_http_method_name(http_method_t i);
+LI_API const char * get_http_status_body_name(int i);
+LI_API int get_http_version_key(const char *s);
+LI_API http_method_t get_http_method_key(const char *s);
+
+LI_API const char * keyvalue_get_value(keyvalue *kv, int k);
+LI_API int keyvalue_get_key(keyvalue *kv, const char *s);
+
+LI_API keyvalue_buffer * keyvalue_buffer_init(void);
+LI_API int keyvalue_buffer_append(keyvalue_buffer *kvb, int k, const char *value);
+LI_API void keyvalue_buffer_free(keyvalue_buffer *kvb);
+
+LI_API s_keyvalue_buffer * s_keyvalue_buffer_init(void);
+LI_API int s_keyvalue_buffer_append(s_keyvalue_buffer *kvb, const char *key, const char *value);
+LI_API void s_keyvalue_buffer_free(s_keyvalue_buffer *kvb);
+
+LI_API httpauth_keyvalue_buffer * httpauth_keyvalue_buffer_init(void);
+LI_API int httpauth_keyvalue_buffer_append(httpauth_keyvalue_buffer *kvb, const char *key, const char *realm, httpauth_type type);
+LI_API void httpauth_keyvalue_buffer_free(httpauth_keyvalue_buffer *kvb);
+
+LI_API pcre_keyvalue_buffer * pcre_keyvalue_buffer_init(void);
+LI_API int pcre_keyvalue_buffer_append(pcre_keyvalue_buffer *kvb, const char *key, const char *value);
+LI_API void pcre_keyvalue_buffer_free(pcre_keyvalue_buffer *kvb);
#endif
diff --git a/src/log.h b/src/log.h
index 86a1d622..23962244 100644
--- a/src/log.h
+++ b/src/log.h
@@ -3,16 +3,16 @@
#include "buffer.h"
-LI_EXPORT void log_init(void);
-LI_EXPORT void log_free(void);
+LI_API void log_init(void);
+LI_API void log_free(void);
-LI_EXPORT int log_error_open(buffer *file, int use_syslog);
-LI_EXPORT int log_error_close();
-LI_EXPORT int log_error_write(void *srv, const char *filename, unsigned int line, const char *fmt, ...);
-LI_EXPORT int log_error_cycle();
+LI_API int log_error_open(buffer *file, int use_syslog);
+LI_API int log_error_close();
+LI_API int log_error_write(void *srv, const char *filename, unsigned int line, const char *fmt, ...);
+LI_API int log_error_cycle();
#define REMOVE_PATH_FROM_FILE 1
#if REMOVE_PATH_FROM_FILE
-LI_EXPORT char *remove_path(const char *path);
+LI_API char *remove_path(const char *path);
#define REMOVE_PATH(file) remove_path(file)
#else
#define REMOVE_PATH(file) file
@@ -25,5 +25,5 @@ LI_EXPORT char *remove_path(const char *path);
log_trace("%s.%d: (trace) "fmt, REMOVE_PATH(__FILE__), __LINE__, __VA_ARGS__)
#define SEGFAULT() do { ERROR("%s", "Ooh, Ooh, Ooh. Something is not good ... going down"); abort(); } while(0)
-LI_EXPORT int log_trace(const char *fmt, ...);
+LI_API int log_trace(const char *fmt, ...);
#endif
diff --git a/src/md5.h b/src/md5.h
index b9fc6acc..6d122eef 100644
--- a/src/md5.h
+++ b/src/md5.h
@@ -49,9 +49,9 @@ typedef struct {
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
-LI_EXPORT void MD5_Init (MD5_CTX *);
-LI_EXPORT void MD5_Update (MD5_CTX *, const unsigned char *, unsigned int);
-LI_EXPORT void MD5_Final (unsigned char [16], MD5_CTX *);
+LI_API void MD5_Init (MD5_CTX *);
+LI_API void MD5_Update (MD5_CTX *, const unsigned char *, unsigned int);
+LI_API void MD5_Final (unsigned char [16], MD5_CTX *);
diff --git a/src/mod_auth.c b/src/mod_auth.c
index 5fe06ed1..59fe9b68 100644
--- a/src/mod_auth.c
+++ b/src/mod_auth.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <fcntl.h>
+#include "settings.h"
#include "plugin.h"
#include "http_auth.h"
#include "log.h"
@@ -627,21 +628,21 @@ handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s) {
}
if (!buffer_is_empty(s->auth_ldap_cert)) {
- if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CERTFILE,
+ if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_CERTFILE,
s->auth_ldap_cert->ptr))) {
- log_error_write(srv, __FILE__, __LINE__, "ss",
+ log_error_write(srv, __FILE__, __LINE__, "ss",
"Loading TLS certificate failed:", ldap_err2string(ret));
-
+
return HANDLER_ERROR;
}
}
-
+
if (!buffer_is_empty(s->auth_ldap_key)) {
- if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_KEYFILE,
+ if (LDAP_OPT_SUCCESS != (ret = ldap_set_option(NULL, LDAP_OPT_X_TLS_KEYFILE,
s->auth_ldap_key->ptr))) {
- log_error_write(srv, __FILE__, __LINE__, "ss",
+ log_error_write(srv, __FILE__, __LINE__, "ss",
"Loading TLS key certificate failed:", ldap_err2string(ret));
-
+
return HANDLER_ERROR;
}
}
diff --git a/src/network.h b/src/network.h
index 83231744..1e3016f3 100644
--- a/src/network.h
+++ b/src/network.h
@@ -1,15 +1,16 @@
#ifndef _NETWORK_H_
#define _NETWORK_H_
+#include "settings.h"
#include "server.h"
-LI_EXPORT network_status_t network_write_chunkqueue(server *srv, connection *con, chunkqueue *c);
-LI_EXPORT network_status_t network_read(server *srv, connection *con, iosocket *sock, chunkqueue *c);
+LI_API network_status_t network_write_chunkqueue(server *srv, connection *con, chunkqueue *c);
+LI_API network_status_t network_read(server *srv, connection *con, iosocket *sock, chunkqueue *c);
-LI_EXPORT int network_init(server *srv);
-LI_EXPORT int network_close(server *srv);
+LI_API int network_init(server *srv);
+LI_API int network_close(server *srv);
-LI_EXPORT int network_register_fdevents(server *srv);
-LI_EXPORT handler_t network_server_handle_fdevent(void *s, void *context, int revents);
+LI_API int network_register_fdevents(server *srv);
+LI_API handler_t network_server_handle_fdevent(void *s, void *context, int revents);
#endif
diff --git a/src/network_backends.h b/src/network_backends.h
index e3f72bf2..0a96ba81 100644
--- a/src/network_backends.h
+++ b/src/network_backends.h
@@ -7,37 +7,38 @@
#include <sys/types.h>
+#include "settings.h"
#include "base.h"
#include "network.h"
#define NETWORK_BACKEND_WRITE_CHUNK(x) \
- LI_EXPORT network_status_t network_write_chunkqueue_##x(server *srv, connection *con, iosocket *sock, chunkqueue *cq, chunk *c)
+ network_status_t network_write_chunkqueue_##x(server *srv, connection *con, iosocket *sock, chunkqueue *cq, chunk *c)
#define NETWORK_BACKEND_WRITE(x) \
- LI_EXPORT network_status_t network_write_chunkqueue_##x(server *srv, connection *con, iosocket *sock, chunkqueue *cq)
+ network_status_t network_write_chunkqueue_##x(server *srv, connection *con, iosocket *sock, chunkqueue *cq)
#define NETWORK_BACKEND_READ(x) \
- LI_EXPORT network_status_t network_read_chunkqueue_##x(server *srv, connection *con, iosocket *sock, chunkqueue *cq)
+ network_status_t network_read_chunkqueue_##x(server *srv, connection *con, iosocket *sock, chunkqueue *cq)
-NETWORK_BACKEND_WRITE_CHUNK(writev_mem);
+LI_API NETWORK_BACKEND_WRITE_CHUNK(writev_mem);
-NETWORK_BACKEND_WRITE(write);
-NETWORK_BACKEND_WRITE(writev);
-NETWORK_BACKEND_WRITE(linuxsendfile);
-NETWORK_BACKEND_WRITE(linuxaiosendfile);
-NETWORK_BACKEND_WRITE(posixaio);
-NETWORK_BACKEND_WRITE(gthreadaio);
-NETWORK_BACKEND_WRITE(freebsdsendfile);
-NETWORK_BACKEND_WRITE(solarissendfilev);
+LI_API NETWORK_BACKEND_WRITE(write);
+LI_API NETWORK_BACKEND_WRITE(writev);
+LI_API NETWORK_BACKEND_WRITE(linuxsendfile);
+LI_API NETWORK_BACKEND_WRITE(linuxaiosendfile);
+LI_API NETWORK_BACKEND_WRITE(posixaio);
+LI_API NETWORK_BACKEND_WRITE(gthreadaio);
+LI_API NETWORK_BACKEND_WRITE(freebsdsendfile);
+LI_API NETWORK_BACKEND_WRITE(solarissendfilev);
-NETWORK_BACKEND_WRITE(win32transmitfile);
-NETWORK_BACKEND_WRITE(win32send);
+LI_API NETWORK_BACKEND_WRITE(win32transmitfile);
+LI_API NETWORK_BACKEND_WRITE(win32send);
-NETWORK_BACKEND_READ(read);
-NETWORK_BACKEND_READ(win32recv);
+LI_API NETWORK_BACKEND_READ(read);
+LI_API NETWORK_BACKEND_READ(win32recv);
#ifdef USE_OPENSSL
-NETWORK_BACKEND_WRITE(openssl);
-NETWORK_BACKEND_READ(openssl);
+LI_API NETWORK_BACKEND_WRITE(openssl);
+LI_API NETWORK_BACKEND_READ(openssl);
#endif
#endif
diff --git a/src/response.c b/src/response.c
index 34b6eba9..1961e1d1 100644
--- a/src/response.c
+++ b/src/response.c
@@ -12,6 +12,8 @@
#include <stdio.h>
+#include "settings.h"
+
#include "response.h"
#include "keyvalue.h"
#include "log.h"
diff --git a/src/response.h b/src/response.h
index 291d9cbe..d69ed9be 100644
--- a/src/response.h
+++ b/src/response.h
@@ -3,17 +3,19 @@
#include <time.h>
+#include "settings.h"
+
#include "server.h"
-LI_EXPORT int http_response_parse(server *srv, connection *con);
-LI_EXPORT int http_response_write_header(server *srv, connection *con, chunkqueue *cq);
+LI_API int http_response_parse(server *srv, connection *con);
+LI_API int http_response_write_header(server *srv, connection *con, chunkqueue *cq);
-LI_EXPORT int response_header_insert(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
-LI_EXPORT int response_header_overwrite(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
+LI_API int response_header_insert(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
+LI_API int response_header_overwrite(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
-LI_EXPORT handler_t handle_get_backend(server *srv, connection *con);
-LI_EXPORT int http_response_redirect_to_directory(server *srv, connection *con);
-LI_EXPORT int http_response_handle_cachable(server *srv, connection *con, buffer * mtime);
+LI_API handler_t handle_get_backend(server *srv, connection *con);
+LI_API int http_response_redirect_to_directory(server *srv, connection *con);
+LI_API int http_response_handle_cachable(server *srv, connection *con, buffer * mtime);
-LI_EXPORT buffer * strftime_cache_get(server *srv, time_t last_mod);
+LI_API buffer * strftime_cache_get(server *srv, time_t last_mod);
#endif
diff --git a/src/server.c b/src/server.c
index 7a1de9ce..a468d69b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -20,6 +20,7 @@
#include <stdio.h>
+#include "settings.h"
#include "server.h"
#include "buffer.h"
#include "network.h"
@@ -518,7 +519,7 @@ static void *joblist_queue_thread(void *_data) {
while (!srv_shutdown) {
GTimeVal ts;
connection *con;
-
+
g_cond_wait(joblist_queue_cond, joblist_queue_mutex);
/* wait for getting signaled */
@@ -538,7 +539,7 @@ static void *joblist_queue_thread(void *_data) {
int killme = 0;
do {
if (con == (void *)1) {
- /* ignore the wakeup-packet, it is only used to break out of the
+ /* ignore the wakeup-packet, it is only used to break out of the
* blocking nature of g_async_queue_timed_pop() */
} else {
killme++;
@@ -552,13 +553,13 @@ static void *joblist_queue_thread(void *_data) {
g_mutex_unlock(joblist_queue_mutex);
}
-
+
return NULL;
}
#endif
/**
- * call this function whenever you get a EMFILE or ENFILE as return-value
+ * call this function whenever you get a EMFILE or ENFILE as return-value
*
* after each socket(), accept(), connect() or open() call
*
@@ -841,7 +842,7 @@ int lighty_mainloop(server *srv) {
srv->sockets_disabled = 1;
- /* we count the number of free fds indirectly.
+ /* we count the number of free fds indirectly.
*
* instead of checking the fds we only check the connection handles we free'd since
* the server-sockets got disabled
@@ -897,7 +898,7 @@ int lighty_mainloop(server *srv) {
#ifdef USE_GTHREAD
if (FALSE == g_mutex_trylock(joblist_queue_mutex)) {
/**
- * we couldn't get the lock, looks like the joblist-thread
+ * we couldn't get the lock, looks like the joblist-thread
* is still blocking on g_async_queue_timed_pop()
*
* let's send it a bogus job to jump out of the blocking mode
@@ -1603,11 +1604,11 @@ int main (int argc, char **argv, char **envp) {
g_mutex_lock(joblist_queue_mutex);
#endif
- /* check if we really need this thread
+ /* check if we really need this thread
*
* it simplifies debugging if there is no 'futex()' making noise in the strace()s
*
- *
+ *
* */
if (srv->network_backend == NETWORK_BACKEND_POSIX_AIO ||
@@ -1625,7 +1626,7 @@ int main (int argc, char **argv, char **envp) {
srv->posix_aio_iocbs = calloc(srv->srvconf.max_read_threads, sizeof(*srv->posix_aio_iocbs));
}
#endif
-
+
#ifdef USE_LINUX_AIO_SENDFILE
if (srv->network_backend == NETWORK_BACKEND_LINUX_AIO_SENDFILE) {
linux_aio_read_thread_id = g_thread_create(linux_aio_read_thread, srv, 1, &gerr);
@@ -1633,7 +1634,7 @@ int main (int argc, char **argv, char **envp) {
ERROR("g_thread_create failed: %s", gerr->message);
return -1;
- }
+ }
srv->linux_io_iocbs = calloc(srv->srvconf.max_read_threads, sizeof(*srv->linux_io_iocbs));
if (0 != io_setup(srv->srvconf.max_read_threads, &(srv->linux_io_ctx))) {
ERROR("io-setup() failed somehow %s", "");
@@ -1725,12 +1726,12 @@ int main (int argc, char **argv, char **envp) {
g_cond_signal(joblist_queue_cond);
if (joblist_queue_thread_id) g_thread_join(joblist_queue_thread_id);
-
+
#if 0
g_mutex_lock(joblist_queue_mutex);
g_cond_free(joblist_queue_cond);
-
+
g_mutex_unlock(joblist_queue_mutex);
/* if I leave this enabled I get:
@@ -1738,10 +1739,10 @@ int main (int argc, char **argv, char **envp) {
* GThread-ERROR **: file gthread-posix.c: line 160 (): error 'Device or resource busy' during 'pthread_mutex_destroy ((pthread_mutex_t *) mutex)'
* aborting...
*
- * $ man pthread_mutex_destroy
+ * $ man pthread_mutex_destroy
*
- * EBUSY The implementation has detected an attempt to destroy the object referenced by mutex while it is locked
- * or referenced (for example, while being used in a pthread_cond_timedwait() or pthread_cond_wait())
+ * EBUSY The implementation has detected an attempt to destroy the object referenced by mutex while it is locked
+ * or referenced (for example, while being used in a pthread_cond_timedwait() or pthread_cond_wait())
* by another thread.
*
* */
diff --git a/src/settings.h b/src/settings.h
index 38909c89..a9f0e91c 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -134,15 +134,10 @@ typedef enum { HANDLER_UNSET,
#endif
#endif
-/* Define LI_API for DLL builds */
-#ifdef LI_DLL
- #ifdef LI_DLL_EXPORTS
- #define LI_API LI_EXPORT
- #else
- #define LI_API LI_IMPORT
- #endif
+#ifdef LI_DLL_EXPORTS
+#define LI_API LI_EXPORT
#else
- #define LI_API
+#define LI_API LI_IMPORT
#endif
/* Throwable classes must always be visible on GCC in all binaries */