-
Notifications
You must be signed in to change notification settings - Fork 124
CURLOPT_INTERFACE setup breaks on proxy setup #109
base: master
Are you sure you want to change the base?
Conversation
Thanks for this. I'll have a look and merge the request appropriately. |
@@ -168,7 +168,8 @@ class EpiOAuth | |||
curl_setopt($ch, CURLOPT_ENCODING, ''); | |||
if($this->followLocation) | |||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |||
if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] != '127.0.0.1') | |||
if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && | |||
!preg_match('/^(|10\.127\.|192\.168\.|172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\.)/', $_SERVER['SERVER_ADDR'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line has the regexp messed up, needs a fix.
@@ -168,7 +168,8 @@ class EpiOAuth | |||
curl_setopt($ch, CURLOPT_ENCODING, ''); | |||
if($this->followLocation) | |||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | |||
if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] != '127.0.0.1') | |||
if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && | |||
!preg_match('/^(10\.|127\.|192\.168\.|172\.(16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31)\.)/', $_SERVER['SERVER_ADDR'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regexp is now fixed.
We spent several days trying to find out what the problem was when this lib didn't work in our production environment, but worked everything else. This turned out to be the issue - it was forcing curl to use the wrong network interface when receiving traffic from our load balancer. |
@zemaj Thanks for posting a follow up. We should merge this in. I've been terribly busy with other things and there's another PR which adds support for the 1.1 version of the API. Once the unit tests for that are done I'll merge this in. |
Dear authors!
We recently changed our network layout and had a complaint from one of our users, thet EpiTwitter wasn't working any more. As we found out, EpiOAuth tries to determine the interface address from the SERVER_ADDR as requested in your Issue #26. Unfortunately this breaks, if the hosting provider has a proxy setup and uses a different network interface for user communication as for proxy-webhost communication.
We have added a small patch to exclude the private address ranges as per RFC 1918. This is fixed in our issue #1. This is not a fool-proof fix, so you should add a switch to turn this funcionality on if somebody absolutely needs it. Otherwise the sysop should configure routing, so you don't need to touch interface binding.
Yours sincerely
Janos Pasztor
DotRoll Ltd.