1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 12:42:29 +02:00

Merge branch 'PHP-5.6'

* PHP-5.6:
  Fix bug #68421 access.format='%R' doesn't log ipv6 address
This commit is contained in:
Remi Collet
2014-11-14 19:10:43 +01:00
3 changed files with 10 additions and 4 deletions

View File

@@ -137,6 +137,7 @@ typedef union _sa_t {
struct sockaddr sa;
struct sockaddr_un sa_unix;
struct sockaddr_in sa_inet;
struct sockaddr_in6 sa_inet6;
} sa_t;
static HashTable fcgi_mgmt_vars;
@@ -1073,12 +1074,17 @@ void fcgi_free_mgmt_var_cb(zval *zv)
zend_string_free(Z_STR_P(zv));
}
char *fcgi_get_last_client_ip() /* {{{ */
const char *fcgi_get_last_client_ip() /* {{{ */
{
static char str[INET6_ADDRSTRLEN];
if (client_sa.sa.sa_family == AF_UNIX) {
return NULL;
}
return inet_ntoa(client_sa.sa_inet.sin_addr);
if (client_sa.sa.sa_family == AF_INET) {
return inet_ntop(client_sa.sa.sa_family, &client_sa.sa_inet.sin_addr, str, INET6_ADDRSTRLEN);
}
return inet_ntop(client_sa.sa.sa_family, &client_sa.sa_inet6.sin6_addr, str, INET6_ADDRSTRLEN);
}
/* }}} */
/*

View File

@@ -133,7 +133,7 @@ int fcgi_flush(fcgi_request *req, int close);
void fcgi_set_mgmt_var(const char * name, size_t name_len, const char * value, size_t value_len);
void fcgi_free_mgmt_var_cb(zval *ptr);
char *fcgi_get_last_client_ip();
const char *fcgi_get_last_client_ip();
/*
* Local variables:

View File

@@ -367,7 +367,7 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */
case 'R': /* remote IP address */
if (!test) {
char *tmp = fcgi_get_last_client_ip();
const char *tmp = fcgi_get_last_client_ip();
len2 = snprintf(b, FPM_LOG_BUFFER - len, "%s", tmp ? tmp : "-");
}
break;