How to determine if a IP addresssis "local"?

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

Justin Bailey wrote:

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