Browse Source

Some core docs fixed

personal/stbuehler/wip
Stefan Bühler 13 years ago
parent
commit
897b27c692
  1. 6
      include/lighttpd/environment.h
  2. 8
      include/lighttpd/http_headers.h
  3. 2
      include/lighttpd/log.h
  4. 2
      include/lighttpd/request.h
  5. 4
      src/main/condition.c
  6. 1
      src/main/environment.c
  7. 2
      src/main/http_headers.c

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

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

2
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__)

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

4
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:

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

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

Loading…
Cancel
Save