Forum: Ruby Binding a specific IP address for Net::HTTP

Posted by Stephan Pilot (stephanpilot)
on 2006-11-27 12:57
I hope I'm not asking a question that has been answered
many times before: I can't find any information on
how to bind a specific IP address (on a server with
multiple addresses) so that a post from a Net::HTTP
object is sent with that specific IP address.

Many thanks for your help!
Posted by Paul Lutus (Guest)
on 2006-11-27 19:46
(Received via mailing list)
Stephan Pilot wrote:

> I hope I'm not asking a question that has been answered
> many times before: I can't find any information on
> how to bind a specific IP address (on a server with
> multiple addresses) so that a post from a Net::HTTP
> object is sent with that specific IP address.

AFAIK the only way to do this (absent the use of platform-specific, 
non-Ruby
properties) is to open the server using the desired address. It is not
possible to pick and choose addresses at runtime from the server side
during a server-client transaction.

Or did you mean "port" when you said "address"?
Posted by Stephan Pilot (stephanpilot)
on 2006-11-27 23:07
Paul Lutus wrote:
> Stephan Pilot wrote:
> 
>> I hope I'm not asking a question that has been answered
>> many times before: I can't find any information on
>> how to bind a specific IP address (on a server with
>> multiple addresses) so that a post from a Net::HTTP
>> object is sent with that specific IP address.
> 
> AFAIK the only way to do this (absent the use of platform-specific, 
> non-Ruby
> properties) is to open the server using the desired address. It is not
> possible to pick and choose addresses at runtime from the server side
> during a server-client transaction.
> 
> Or did you mean "port" when you said "address"?

I was referring to an option available with the wget utility on Linux
boxes ( e.g. --bind-address=10.0.0.1 ), since the http server I am
trying to contact only allows connections from a specific IP address and
I don't know how the ruby Net::HTTP selects its own IP address when 
there
are several to choose from on the machine running ruby. I guess I will 
have
to write a very basic http client using "handcrafted" sockets then?
Posted by Richard K. (richard_k)
on 2013-02-13 19:48
Did anyone find a resolution to this question? Rich
Posted by tamouse mailing lists (Guest)
on 2013-02-14 06:48
(Received via mailing list)
On Wed, Feb 13, 2013 at 12:49 PM, Richard K. <lists@ruby-forum.com> 
wrote:
> Did anyone find a resolution to this question? Rich

I've completely lost the context on this. What's the original question?
Posted by Richard K. (richard_k)
on 2013-02-14 09:53
The ability to set the outing IP address on a HTTP request, if you're 
working on a server that have multiple network interfaces.

This functionality has been introduced and is described here, 
http://www.ruby-forum.com/topic/4403034.

Rich
Posted by tamouse mailing lists (Guest)
on 2013-02-16 17:17
(Received via mailing list)
Looks like it will be in version 2.0.0 from the bug report. If you
need it now, you can probably snag the patches.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.