version 1.1, 2013/10/14 10:32:48
|
version 1.1.1.2, 2014/06/15 20:20:06
|
Line 155 static int config_insert(server *srv) {
|
Line 155 static int config_insert(server *srv) {
|
|
|
srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); |
srv->config_storage = calloc(1, srv->config_context->used * sizeof(specific_config *)); |
|
|
assert(srv->config_storage); | force_assert(srv->config_storage); |
|
|
for (i = 0; i < srv->config_context->used; i++) { |
for (i = 0; i < srv->config_context->used; i++) { |
specific_config *s; |
specific_config *s; |
|
|
s = calloc(1, sizeof(specific_config)); |
s = calloc(1, sizeof(specific_config)); |
assert(s); | force_assert(s); |
s->document_root = buffer_init(); |
s->document_root = buffer_init(); |
s->mimetypes = array_init(); |
s->mimetypes = array_init(); |
s->server_name = buffer_init(); |
s->server_name = buffer_init(); |
Line 339 int config_setup_connection(server *srv, connection *c
|
Line 339 int config_setup_connection(server *srv, connection *c
|
|
|
PATCH(ssl_pemfile); |
PATCH(ssl_pemfile); |
#ifdef USE_OPENSSL |
#ifdef USE_OPENSSL |
PATCH(ssl_ctx); | PATCH(ssl_pemfile_x509); |
| PATCH(ssl_pemfile_pkey); |
#endif |
#endif |
PATCH(ssl_ca_file); |
PATCH(ssl_ca_file); |
|
#ifdef USE_OPENSSL |
|
PATCH(ssl_ca_file_cert_names); |
|
#endif |
PATCH(ssl_cipher_list); |
PATCH(ssl_cipher_list); |
PATCH(ssl_dh_file); |
PATCH(ssl_dh_file); |
PATCH(ssl_ec_curve); |
PATCH(ssl_ec_curve); |
Line 409 int config_patch_connection(server *srv, connection *c
|
Line 413 int config_patch_connection(server *srv, connection *c
|
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.pemfile"))) { |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.pemfile"))) { |
PATCH(ssl_pemfile); |
PATCH(ssl_pemfile); |
#ifdef USE_OPENSSL |
#ifdef USE_OPENSSL |
PATCH(ssl_ctx); | PATCH(ssl_pemfile_x509); |
| PATCH(ssl_pemfile_pkey); |
#endif |
#endif |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.ca-file"))) { |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.ca-file"))) { |
PATCH(ssl_ca_file); |
PATCH(ssl_ca_file); |
|
#ifdef USE_OPENSSL |
|
PATCH(ssl_ca_file_cert_names); |
|
#endif |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.honor-cipher-order"))) { |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.honor-cipher-order"))) { |
PATCH(ssl_honor_cipher_order); |
PATCH(ssl_honor_cipher_order); |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.empty-fragments"))) { |
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.empty-fragments"))) { |
Line 541 static int tokenizer_close(server *srv, tokenizer_t *t
|
Line 549 static int tokenizer_close(server *srv, tokenizer_t *t
|
#endif |
#endif |
static int config_skip_newline(tokenizer_t *t) { |
static int config_skip_newline(tokenizer_t *t) { |
int skipped = 1; |
int skipped = 1; |
assert(t->input[t->offset] == '\r' || t->input[t->offset] == '\n'); | force_assert(t->input[t->offset] == '\r' || t->input[t->offset] == '\n'); |
if (t->input[t->offset] == '\r' && t->input[t->offset + 1] == '\n') { |
if (t->input[t->offset] == '\r' && t->input[t->offset + 1] == '\n') { |
skipped ++; |
skipped ++; |
t->offset ++; |
t->offset ++; |
Line 552 static int config_skip_newline(tokenizer_t *t) {
|
Line 560 static int config_skip_newline(tokenizer_t *t) {
|
|
|
static int config_skip_comment(tokenizer_t *t) { |
static int config_skip_comment(tokenizer_t *t) { |
int i; |
int i; |
assert(t->input[t->offset] == '#'); | force_assert(t->input[t->offset] == '#'); |
for (i = 1; t->input[t->offset + i] && |
for (i = 1; t->input[t->offset + i] && |
(t->input[t->offset + i] != '\n' && t->input[t->offset + i] != '\r'); |
(t->input[t->offset + i] != '\n' && t->input[t->offset + i] != '\r'); |
i++); |
i++); |
Line 1018 static char* getCWD(void) {
|
Line 1026 static char* getCWD(void) {
|
s = malloc(len); |
s = malloc(len); |
if (!s) return NULL; |
if (!s) return NULL; |
while (NULL == getcwd(s, len)) { |
while (NULL == getcwd(s, len)) { |
if (errno != ERANGE || SSIZE_MAX - len < len) return NULL; | if (errno != ERANGE || SSIZE_MAX - len < len) { |
| free(s); |
| return NULL; |
| } |
len *= 2; |
len *= 2; |
s1 = realloc(s, len); |
s1 = realloc(s, len); |
if (!s1) { |
if (!s1) { |
Line 1104 int config_read(server *srv, const char *fn) {
|
Line 1115 int config_read(server *srv, const char *fn) {
|
dc = data_config_init(); |
dc = data_config_init(); |
buffer_copy_string_len(dc->key, CONST_STR_LEN("global")); |
buffer_copy_string_len(dc->key, CONST_STR_LEN("global")); |
|
|
assert(context.all_configs->used == 0); | force_assert(context.all_configs->used == 0); |
dc->context_ndx = context.all_configs->used; |
dc->context_ndx = context.all_configs->used; |
array_insert_unique(context.all_configs, (data_unset *)dc); |
array_insert_unique(context.all_configs, (data_unset *)dc); |
context.current = dc; |
context.current = dc; |
Line 1122 int config_read(server *srv, const char *fn) {
|
Line 1133 int config_read(server *srv, const char *fn) {
|
dcwd->value->used = strlen(dcwd->value->ptr) + 1; |
dcwd->value->used = strlen(dcwd->value->ptr) + 1; |
buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD")); |
buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD")); |
array_insert_unique(srv->config, (data_unset *)dcwd); |
array_insert_unique(srv->config, (data_unset *)dcwd); |
|
} else { |
|
dcwd->free((data_unset*) dcwd); |
} |
} |
|
|
ret = config_parse_file(srv, &context, fn); |
ret = config_parse_file(srv, &context, fn); |
|
|
/* remains nothing if parser is ok */ |
/* remains nothing if parser is ok */ |
assert(!(0 == ret && context.ok && 0 != context.configs_stack->used)); | force_assert(!(0 == ret && context.ok && 0 != context.configs_stack->used)); |
context_free(&context); |
context_free(&context); |
|
|
if (0 != ret) { |
if (0 != ret) { |
Line 1159 int config_read(server *srv, const char *fn) {
|
Line 1172 int config_read(server *srv, const char *fn) {
|
} |
} |
|
|
prepends = (data_array *)configparser_merge_data((data_unset *)prepends, (data_unset *)modules); |
prepends = (data_array *)configparser_merge_data((data_unset *)prepends, (data_unset *)modules); |
|
force_assert(NULL != prepends); |
buffer_copy_string_buffer(prepends->key, modules->key); |
buffer_copy_string_buffer(prepends->key, modules->key); |
array_replace(srv->config, (data_unset *)prepends); |
array_replace(srv->config, (data_unset *)prepends); |
modules->free((data_unset *)modules); |
modules->free((data_unset *)modules); |