1 diff -ur lighttpd-1.4.8-o/src/array.h lighttpd-1.4.8/src/array.h
2 --- lighttpd-1.4.8-o/src/array.h 2005-09-23 12:24:18.000000000 -0600
3 +++ lighttpd-1.4.8/src/array.h 2005-12-30 03:01:39.000000000 -0700
6 int usage; /* fair-balancing needs the no. of connections active on this host */
7 int last_used_ndx; /* round robin */
11 data_fastcgi *data_fastcgi_init(void);
12 diff -ur lighttpd-1.4.8-o/src/data_fastcgi.c lighttpd-1.4.8/src/data_fastcgi.c
13 --- lighttpd-1.4.8-o/src/data_fastcgi.c 2005-08-23 08:36:12.000000000 -0600
14 +++ lighttpd-1.4.8/src/data_fastcgi.c 2005-12-30 03:01:39.000000000 -0700
16 ds->host = buffer_init();
19 + ds->fix_redirects = 0;
21 ds->copy = data_fastcgi_copy;
22 ds->free = data_fastcgi_free;
23 diff -ur lighttpd-1.4.8-o/src/mod_proxy.c lighttpd-1.4.8/src/mod_proxy.c
24 --- lighttpd-1.4.8-o/src/mod_proxy.c 2005-11-18 05:29:36.000000000 -0700
25 +++ lighttpd-1.4.8/src/mod_proxy.c 2005-12-30 03:01:51.000000000 -0700
27 { "host", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
28 { "port", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
29 { "balance", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 2 */
30 + { "fix-redirects", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 3 */
31 { NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
36 pcv[0].destination = df->host;
37 pcv[1].destination = &(df->port);
38 + pcv[3].destination = &(df->fix_redirects);
40 if (0 != config_insert_values_internal(srv, da_host->value, pcv)) {
46 -static int proxy_response_parse(server *srv, connection *con, plugin_data *p, buffer *in) {
47 +static int proxy_response_parse(server *srv, connection *con, plugin_data *p, buffer *in, handler_ctx *hctx) {
49 int http_response_status = -1;
54 if (0 == strncasecmp(key, "Location", key_len)) {
56 con->parsed_response |= HTTP_LOCATION;
58 + host = strndup(con->request.http_host->ptr, strchr(con->request.http_host->ptr, ':') - con->request.http_host->ptr);
60 + if(strncasecmp(value, "http://", 7) == 0 && strncasecmp(value + 7, host, strlen(host)) == 0 && *(value + 7 + strlen(host)) == ':' && atoi(value + 7 + strlen(host) + 1) == hctx->host->port) {
61 + value = strchr(value + 7 + strlen(host), '/');
69 log_error_write(srv, __FILE__, __LINE__, "sb", "Header:", hctx->response_header);
71 /* parse the response header */
72 - proxy_response_parse(srv, con, p, hctx->response_header);
73 + proxy_response_parse(srv, con, p, hctx->response_header, hctx);
75 /* enable chunked-transfer-encoding */
76 if (con->request.http_version == HTTP_VERSION_1_1 &&