diff options
| author | 2025-11-11 08:17:12 +0100 | |
|---|---|---|
| committer | 2025-11-11 08:17:12 +0100 | |
| commit | a18c35046daee15e7ac5f85db290d54541a03e3c (patch) | |
| tree | ec638cf7c93537a4f81b27216097d8509252eb81 /lib/Minz/Request.php | |
| parent | 5e622c60fa5c40793138807280319f7e84d00cc6 (diff) | |
Housekeeping lib_rss.php (#8193)
* Housekeeping lib_rss.php
`lib_rss.php` had become much too large, especially after https://github.com/FreshRSS/FreshRSS/pull/7924
Moved most functions to other places.
Mostly no change of code otherwise (see comments).
* Extension: composer run-script phpstan-third-party
Diffstat (limited to 'lib/Minz/Request.php')
| -rw-r--r-- | lib/Minz/Request.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Minz/Request.php b/lib/Minz/Request.php index c938afd7c..973e46f2c 100644 --- a/lib/Minz/Request.php +++ b/lib/Minz/Request.php @@ -255,6 +255,20 @@ class Minz_Request { } /** + * Use CONN_REMOTE_ADDR (if available, to be robust even when using Apache mod_remoteip) or REMOTE_ADDR environment variable to determine the connection IP. + */ + public static function connectionRemoteAddress(): string { + $remoteIp = is_string($_SERVER['CONN_REMOTE_ADDR'] ?? null) ? $_SERVER['CONN_REMOTE_ADDR'] : ''; + if ($remoteIp == '') { + $remoteIp = is_string($_SERVER['REMOTE_ADDR'] ?? null) ? $_SERVER['REMOTE_ADDR'] : ''; + } + if ($remoteIp == 0) { + $remoteIp = ''; + } + return $remoteIp; + } + + /** * Return true if the request is over HTTPS, false otherwise (HTTP) */ public static function isHttps(): bool { |
