Project

General

Profile

Bug #1968 ยป lighty-fix_SERVER_NAME-r2476.patch

presbrey, 2009-04-27 14:58

View differences:

lighttpd-trunk/src/mod_cgi.c 2009-04-22 17:17:37.000000000 -0400
/* !!! careful: s maybe reused for SERVER_NAME !!! */
if (!buffer_is_empty(con->server_name)) {
size_t len = con->server_name->used - 1;
char *colon = strchr(con->server_name->ptr, ':');
if (colon) len = colon - con->server_name->ptr;
cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
if (colon) {
buffer_reset(p->tmp_buf);
buffer_copy_string_len(p->tmp_buf, BUF_STR(con->server_name), colon - BUF_STR(con->server_name));
cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(p->tmp_buf));
} else {
cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name));
}
} else {
/* use SERVER_ADDR */
cgi_env_add(&env, CONST_STR_LEN("SERVER_NAME"), s, strlen(s));
lighttpd-trunk/src/mod_proxy_backend_fastcgi.c 2009-04-22 17:21:26.000000000 -0400
array_set_key_value(sess->env_headers, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_NAME"/"PACKAGE_VERSION));
if (con->server_name->used) {
size_t len = con->server_name->used - 1;
char *colon = strchr(con->server_name->ptr, ':');
if (colon) len = colon - con->server_name->ptr;
array_set_key_value(sess->env_headers, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
if (colon) {
buffer_reset(p->tmp_buf);
buffer_copy_string_len(p->tmp_buf, BUF_STR(con->server_name), colon - BUF_STR(con->server_name));
array_set_key_value(sess->env_headers, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(p->tmp_buf));
} else {
array_set_key_value(sess->env_headers, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name));
}
} else {
#ifdef HAVE_IPV6
s = inet_ntop(srv_sock->addr.plain.sa_family,
lighttpd-trunk/src/mod_proxy_backend_scgi.c 2009-04-22 17:22:44.000000000 -0400
scgi_env_add(env_headers, CONST_STR_LEN("SERVER_SOFTWARE"), CONST_STR_LEN(PACKAGE_NAME"/"PACKAGE_VERSION));
if (con->server_name->used) {
size_t len = con->server_name->used - 1;
char *colon = strchr(con->server_name->ptr, ':');
if (colon) len = colon - con->server_name->ptr;
scgi_env_add(env_headers, CONST_STR_LEN("SERVER_NAME"), con->server_name->ptr, len);
if (colon) {
buffer_reset(p->tmp_buf);
buffer_copy_string_len(p->tmp_buf, BUF_STR(con->server_name), colon - BUF_STR(con->server_name));
scgi_env_add(env_headers, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(p->tmp_buf));
} else {
scgi_env_add(env_headers, CONST_STR_LEN("SERVER_NAME"), CONST_BUF_LEN(con->server_name));
}
} else {
#ifdef HAVE_IPV6
s = inet_ntop(srv_sock->addr.plain.sa_family,
    (1-1/1)