Is there a way to attach Ruby Net::HTTP request to a specific IP address / network interface?

Posted by Dan Sosedoff on Stack Overflow See other posts from Stack Overflow or by Dan Sosedoff
Published on 2010-06-09T23:24:06Z Indexed on 2010/06/09 23:32 UTC
Read the original article Hit count: 231

Filed under:
|

Hello,

Im looking a way to use different IP addresses for each GET request with standard Net::HTTP library. Server has 5 ip addresses and assuming that some API`s are blocking access when request limit per IP is reached. So, only way to do it - use another server. I cant find anything about it in ruby docs.

For example, curl allows you to attach it to specific ip address (in PHP):

$req = curl_init($url)
curl_setopt($req, CURLOPT_INTERFACE, 'ip.address.goes.here';
$result = curl_exec($req);

Is there any way to do it with Net::HTTP library? As alternative - CURB (ruby curl binding). But it will be the latest thing i`ll try.

Suggestions / Ideas?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about http-requests