How to determine if a IP addresssis "local"?

J

Justin Bailey

Does the ruby standard library or core include a way to determine if a
network address is "local"? Specifically, my workplace uses a proxy
server for all web traffic. I have several scripts that use open-uri.
When the http_proxy environment variable is set, open-uri will proxy
all requests to the defined proxy server. I'd like to write patch it
to ignore that behavior for "local" addresses, and I'm hoping the ruby
library already gives me the ability to determine that. Anyone know?

If not - how would I make that determination? Would it just be
requests to the "fake" IP addresses (i.e. 172.16.*, etc)?

Thanks!

Justin
 
D

David Vallner

Justin said:
Does the ruby standard library or core include a way to determine if a
network address is "local"? Specifically, my workplace uses a proxy
server for all web traffic. I have several scripts that use open-uri.
When the http_proxy environment variable is set, open-uri will proxy
all requests to the defined proxy server. I'd like to write patch it
to ignore that behavior for "local" addresses, and I'm hoping the ruby
library already gives me the ability to determine that. Anyone know?

Hmm. Proxy autoconfiguration file support in open-uri? I presume there's
a pac file on your intranet someplace that mentions what addresses are
local - this wouldn't be a bad new feature.

David Vallner
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top