From 8496968ef07dadac2657206e059520675c5eb28a Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 28 Apr 2021 18:27:59 +0200 Subject: Simplify a bit get_ip() --- src/sp_utils.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src') diff --git a/src/sp_utils.c b/src/sp_utils.c index a7a3d27..a1fa400 100644 --- a/src/sp_utils.c +++ b/src/sp_utils.c @@ -19,25 +19,7 @@ const char* get_ipaddr() { return fwd_ip; } - /* Some hosters (like heroku, see - * https://github.com/jvoisin/snuffleupagus/issues/336) are clearing the - * environment variables, so we don't have access to them, hence why we're - * resorting to $_SERVER['REMOTE_ADDR']. - */ - if (!Z_ISUNDEF(PG(http_globals)[TRACK_VARS_SERVER])) { - const zval* const globals_client_ip = - zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), - "REMOTE_ADDR", sizeof("REMOTE_ADDR") - 1); - if (globals_client_ip) { - if (Z_TYPE_P(globals_client_ip) == IS_STRING) { - if (Z_STRLEN_P(globals_client_ip) != 0) { - return estrdup(Z_STRVAL_P(globals_client_ip)); - } - } - } - } - - return default_ipaddr; + return default_ipaddr; } void sp_log_msgf(char const* restrict feature, int level, int type, -- cgit v1.3