merge [109], [259], [266] and [267]

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@277 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
Jan Kneschke 2005-04-14 21:20:29 +00:00
parent ea73c9e512
commit 4f14ff8424
4 changed files with 35 additions and 14 deletions

View File

@ -5,6 +5,7 @@
%include {
#include <assert.h>
#include <stdio.h>
#include "config.h"
#include "configfile.h"
#include "buffer.h"
@ -31,7 +32,14 @@ metaline ::= EOL.
varline ::= key(A) ASSIGN value(B). {
buffer_copy_string_buffer(B->key, A);
array_insert_unique(ctx->ctx_config, B);
if (NULL == array_get_element(ctx->ctx_config, B->key->ptr)) {
array_insert_unique(ctx->ctx_config, B);
} else {
fprintf(stderr, "Duplicate config variable in conditional %s: %s\n",
ctx->ctx_name->ptr, B->key->ptr);
ctx->ok = 0;
B->free(B);
}
buffer_free(A);
}
@ -62,7 +70,15 @@ array(A) ::= LPARAN aelements(B) RPARAN. {
}
aelements(A) ::= aelements(C) COMMA aelement(B). {
array_insert_unique(C, B);
if (buffer_is_empty(B->key) ||
NULL == array_get_element(C, B->key->ptr)) {
array_insert_unique(C, B);
} else {
fprintf(stderr, "Duplicate array-key: %s\n",
B->key->ptr);
B->free(B);
ctx->ok = 0;
}
A = C;
}

View File

@ -403,7 +403,7 @@ handler_t file_cache_get_entry(server *srv, connection *con, buffer *name, file_
if (s_len < ct_len) continue;
if (0 == strncmp(name->ptr + s_len - ct_len, ds->key->ptr, ct_len)) {
if (0 == strncasecmp(name->ptr + s_len - ct_len, ds->key->ptr, ct_len)) {
buffer_copy_string_buffer(fce->content_type, ds->value);
break;
}

View File

@ -362,8 +362,6 @@ static int proxy_establish_connection(server *srv, handler_ctx *hctx) {
log_error_write(srv, __FILE__, __LINE__, "sdsd",
"connect failed:", proxy_fd, strerror(errno), errno);
proxy_connection_cleanup(srv, hctx);
return -1;
}
}
@ -631,7 +629,7 @@ static int proxy_demux_response(server *srv, handler_ctx *hctx) {
}
static int proxy_write_request(server *srv, handler_ctx *hctx) {
static handler_t proxy_write_request(server *srv, handler_ctx *hctx) {
data_proxy *host= hctx->host;
int r;
@ -645,7 +643,7 @@ static int proxy_write_request(server *srv, handler_ctx *hctx) {
if (-1 == (hctx->fd = socket(r, SOCK_STREAM, 0))) {
log_error_write(srv, __FILE__, __LINE__, "ss", "socket failed: ", strerror(errno));
return -1;
return HANDLER_ERROR;
}
hctx->fde_ndx = -1;
@ -656,9 +654,7 @@ static int proxy_write_request(server *srv, handler_ctx *hctx) {
if (-1 == fdevent_fcntl_set(srv->ev, hctx->fd)) {
log_error_write(srv, __FILE__, __LINE__, "ss", "fcntl failed: ", strerror(errno));
proxy_connection_cleanup(srv, hctx);
return -1;
return HANDLER_ERROR;
}
/* fall through */
@ -740,10 +736,10 @@ static int proxy_write_request(server *srv, handler_ctx *hctx) {
break;
default:
log_error_write(srv, __FILE__, __LINE__, "s", "(debug) unknown state");
return -1;
return HANDLER_ERROR;
}
return 0;
return HANDLER_GO_ON;
}
#define PATCH(x) \
@ -813,7 +809,8 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequest) {
if (con->mode != p->id) return HANDLER_GO_ON;
/* ok, create the request */
if (-1 == proxy_write_request(srv, hctx)) {
switch(proxy_write_request(srv, hctx)) {
case HANDLER_ERROR:
log_error_write(srv, __FILE__, __LINE__, "sbdd", "proxy-server disabled:",
host->host,
host->port,
@ -823,9 +820,17 @@ SUBREQUEST_FUNC(mod_proxy_handle_subrequest) {
host->usage = -1;
host->disable_ts = srv->cur_ts;
proxy_connection_cleanup(srv, hctx);
con->mode = DIRECT;
con->http_status = 503;
return HANDLER_FINISHED;
case HANDLER_WAIT_FOR_EVENT:
return HANDLER_WAIT_FOR_EVENT;
case HANDLER_WAIT_FOR_FD:
return HANDLER_WAIT_FOR_FD;
default:
break;
}
if (con->file_started == 1) {

View File

@ -127,7 +127,7 @@ static int mod_setenv_patch_connection(server *srv, connection *con, plugin_data
PATCH(request_header);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("setenv.add-response-header"))) {
PATCH(response_header);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("setenv.environment"))) {
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("setenv.add-environment"))) {
PATCH(environment);
}
}