Browse Source

load mod_indexfile before, mod_fastcgi and friends and let array regenerated unique ids if necessary

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@560 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.2
Jan Kneschke 17 years ago
parent
commit
c052589bb3
  1. 3
      src/array.c
  2. 1
      src/array.h
  3. 8
      src/configfile-glue.c
  4. 13
      src/configfile.c

3
src/array.c

@ -28,6 +28,7 @@ array *array_init_array(array *src) {
a->size = src->size;
a->next_power_of_2 = src->next_power_of_2;
a->unique_ndx = src->unique_ndx;
a->is_array = src->is_array;
a->data = malloc(sizeof(*src->data) * src->size);
for (i = 0; i < src->size; i++) {
@ -168,10 +169,10 @@ int array_insert_unique(array *a, data_unset *str) {
/* generate unique index if neccesary */
if (str->key->used == 0) {
buffer_copy_long(str->key, a->unique_ndx++);
a->is_array = 1;
}
/* try to find the string */
if (-1 != (ndx = array_get_index(a, str->key->ptr, str->key->used, &pos))) {
/* found, leave here */
if (a->data[ndx]->type == str->type) {

1
src/array.h

@ -33,6 +33,7 @@ typedef struct {
size_t size;
size_t unique_ndx;
int is_array; /* 0 if it is a hash, 1 for array (autogenerated keys) */
size_t next_power_of_2;
int is_weakref; /* data is weakref, don't bother the data */

8
src/configfile-glue.c

@ -1,4 +1,3 @@
#include "base.h"
#include "buffer.h"
#include "array.h"
@ -43,7 +42,12 @@ int config_insert_values_internal(server *srv, array *ca, const config_values_t
data_string *ds = data_string_init();
buffer_copy_string_buffer(ds->value, ((data_string *)(da->value->data[j]))->value);
buffer_copy_string_buffer(ds->key, ((data_string *)(da->value->data[j]))->key);
if (!da->value->is_array) {
/* the id's were generated automaticly, as we copy now we might have to renumber them
* this is used to prepend server.modules by mod_indexfiles as it has to be loaded
* before mod_fastcgi and friends */
buffer_copy_string_buffer(ds->key, ((data_string *)(da->value->data[j]))->key);
}
array_insert_unique(cv[i].destination, (data_unset *)ds);
} else {

13
src/configfile.c

@ -117,6 +117,13 @@ static int config_insert(server *srv) {
assert(srv->config_storage);
/* prepend default modules */
if (NULL == array_get_element(srv->srvconf.modules, "mod_indexfile")) {
ds = data_string_init();
buffer_copy_string(ds->value, "mod_indexfile");
array_insert_unique(srv->srvconf.modules, (data_unset *)ds);
}
for (i = 0; i < srv->config_context->used; i++) {
specific_config *s;
@ -207,12 +214,6 @@ static int config_insert(server *srv) {
srv->srvconf.modules->unique_ndx = srv->srvconf.modules->used;
/* append default modules */
if (NULL == array_get_element(srv->srvconf.modules, "mod_indexfile")) {
ds = data_string_init();
buffer_copy_string(ds->value, "mod_indexfile");
array_insert_unique(srv->srvconf.modules, (data_unset *)ds);
}
if (NULL == array_get_element(srv->srvconf.modules, "mod_dirlisting")) {
ds = data_string_init();
buffer_copy_string(ds->value, "mod_dirlisting");

Loading…
Cancel
Save