Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.9.0
-
Component/s: Zend_Controller
-
Labels:None
Description
Having a method in the HTTP request object to get the client's IP would be really useful. Proposed method:
public function getClientIp() { if (!empty($this->getServer('HTTP_CLIENT_IP'))) { $ip = $this->getServer('HTTP_CLIENT_IP'); } else if (!empty($this->getServer('HTTP_X_FORWARDED_FOR'))) { $ip = $this->getServer('HTTP_X_FORWARDED_FOR'); } else { $ip = $this->getServer('REMOTE_ADDR'); } return $ip; }
Assigning back to Jurrien, as he knows the implementation desired.
Please don't forget to write tests for the functionality. 