diff --git a/include/lighttpd/environment.h b/include/lighttpd/environment.h index a0c2765..b42a3e5 100644 --- a/include/lighttpd/environment.h +++ b/include/lighttpd/environment.h @@ -17,9 +17,9 @@ struct liEnvironmentDup { GHashTable *table; }; -LI_API void li_environment_init(liEnvironment *env); -LI_API void li_environment_reset(liEnvironment *env); -LI_API void li_environment_clear(liEnvironment *env); +LI_API void li_environment_init(liEnvironment *env); /* create table */ +LI_API void li_environment_reset(liEnvironment *env); /* remove all entries */ +LI_API void li_environment_clear(liEnvironment *env); /* destroy table */ /* overwrite previous value */ LI_API void li_environment_set(liEnvironment *env, const gchar *key, size_t keylen, const gchar *val, size_t valuelen); diff --git a/include/lighttpd/http_headers.h b/include/lighttpd/http_headers.h index 28fa6bf..e9bc706 100644 --- a/include/lighttpd/http_headers.h +++ b/include/lighttpd/http_headers.h @@ -20,7 +20,7 @@ struct liHttpHeaders { GQueue entries; }; -/* strings alweays get copied, so you should free key and value yourself */ +/* strings always get copied, so you should free key and value yourself */ LI_API liHttpHeaders* li_http_headers_new(); LI_API void li_http_headers_reset(liHttpHeaders* headers); @@ -28,7 +28,7 @@ LI_API void li_http_headers_free(liHttpHeaders* headers); /** If header does not exist, just insert normal header. If it exists, append (", %s", value) */ LI_API void li_http_header_append(liHttpHeaders *headers, const gchar *key, size_t keylen, const gchar *val, size_t valuelen); -/** If header does not exist, just insert normal header. If it exists, append ("\r\n%s: %s", key, value) */ +/** If header does not exist, just insert normal header. If it exists, add new entry to list ("%s: %s", key, value) */ LI_API void li_http_header_insert(liHttpHeaders *headers, const gchar *key, size_t keylen, const gchar *val, size_t valuelen); /** If header does not exist, just insert normal header. If it exists, overwrite the value */ LI_API void li_http_header_overwrite(liHttpHeaders *headers, const gchar *key, size_t keylen, const gchar *val, size_t valuelen); @@ -44,8 +44,8 @@ LI_API GList* li_http_header_find_last(liHttpHeaders *headers, const gchar *key, /** Use lowercase keys! values are compared case-insensitive */ LI_API gboolean li_http_header_is(liHttpHeaders *headers, const gchar *key, size_t keylen, const gchar *val, size_t valuelen); -/** concats all headers with key with ', ' - empty if no header exists - use lowercase key*/ -LI_API void li_http_header_get_fast(GString *dest, liHttpHeaders *headers, const gchar *key, size_t keylen); +/** concats all headers with key with ', ' - empty if no header exists */ +LI_API void li_http_header_get_all(GString *dest, liHttpHeaders *headers, const gchar *key, size_t keylen); INLINE gboolean http_header_key_is(liHttpHeader *h, const gchar *key, size_t keylen) { return (h->keylen == keylen && 0 == g_ascii_strncasecmp(key, h->data->str, keylen)); diff --git a/include/lighttpd/log.h b/include/lighttpd/log.h index 12dac95..37c2c17 100644 --- a/include/lighttpd/log.h +++ b/include/lighttpd/log.h @@ -41,7 +41,7 @@ #define VR_DEBUG(vr, fmt, ...) _DEBUG(vr->wrk->srv, vr, fmt, __VA_ARGS__) #define VR_BACKEND(vr, fmt, ...) _BACKEND(vr->wrk->srv, vr, fmt, __VA_ARGS__) #define VR_BACKEND_LINES(vr, txt, fmt, ...) _BACKEND_LINES(vr->wrk->srv, vr, txt, fmt, __VA_ARGS__) -#define VR_GERROR(vr, error, fmt, ...) _GERROR(vr->work->srv, vr, error, fmt, __VA_ARGS__) +#define VR_GERROR(vr, error, fmt, ...) _GERROR(vr->wrk->srv, vr, error, fmt, __VA_ARGS__) #define SEGFAULT(srv, fmt, ...) _SEGFAULT(srv, NULL, fmt, __VA_ARGS__) #define ERROR(srv, fmt, ...) _ERROR(srv, NULL, fmt, __VA_ARGS__) diff --git a/include/lighttpd/request.h b/include/lighttpd/request.h index c14eabe..c6a398d 100644 --- a/include/lighttpd/request.h +++ b/include/lighttpd/request.h @@ -41,7 +41,7 @@ struct liRequest { liHttpHeaders *headers; /* Parsed headers: */ - goffset content_length; + goffset content_length; /* -1 if not specified */ }; LI_API void li_request_init(liRequest *req); diff --git a/src/main/condition.c b/src/main/condition.c index 2f649ed..bf1a415 100644 --- a/src/main/condition.c +++ b/src/main/condition.c @@ -384,7 +384,7 @@ static liHandlerResult li_condition_check_eval_string(liVRequest *vr, liConditio /* TODO: physical path exists */ break; case LI_COMP_REQUEST_HEADER: - li_http_header_get_fast(con->wrk->tmp_str, vr->request.headers, GSTR_LEN(cond->lvalue->key)); + li_http_header_get_all(con->wrk->tmp_str, vr->request.headers, GSTR_LEN(cond->lvalue->key)); val = con->wrk->tmp_str->str; break; case LI_COMP_REQUEST_CONTENT_LENGTH: @@ -562,7 +562,7 @@ static liHandlerResult li_condition_check_eval_ip(liVRequest *vr, liCondition *c return LI_HANDLER_ERROR; break; case LI_COMP_REQUEST_HEADER: - li_http_header_get_fast(con->wrk->tmp_str, vr->request.headers, GSTR_LEN(cond->lvalue->key)); + li_http_header_get_all(con->wrk->tmp_str, vr->request.headers, GSTR_LEN(cond->lvalue->key)); val = con->wrk->tmp_str->str; break; case LI_COMP_PHYSICAL_SIZE: diff --git a/src/main/environment.c b/src/main/environment.c index 6634ef9..109dfd2 100644 --- a/src/main/environment.c +++ b/src/main/environment.c @@ -17,6 +17,7 @@ void li_environment_reset(liEnvironment *env) { void li_environment_clear(liEnvironment *env) { g_hash_table_destroy(env->table); + env->table = NULL; } void li_environment_set(liEnvironment *env, const gchar *key, size_t keylen, const gchar *val, size_t valuelen) { diff --git a/src/main/http_headers.c b/src/main/http_headers.c index 65a153b..3288c83 100644 --- a/src/main/http_headers.c +++ b/src/main/http_headers.c @@ -154,7 +154,7 @@ gboolean li_http_header_is(liHttpHeaders *headers, const gchar *key, size_t keyl return FALSE; } -void li_http_header_get_fast(GString *dest, liHttpHeaders *headers, const gchar *key, size_t keylen) { +void li_http_header_get_all(GString *dest, liHttpHeaders *headers, const gchar *key, size_t keylen) { GList *l; g_string_truncate(dest, 0);