Issue #6617 has been reported by mksm (Ricardo Amorim). ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: Category: Target version: Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-06-21 04:16
on 2012-06-22 01:44
Issue #6617 has been updated by drbrain (Eric Hodel).
Category set to lib
Bind to a local port like TCPSocket.new does? I'm sure this feature
could be added.
I think the easiest way to add it would result in an API like:
http = Net::HTTP.new remote_host
http.local_host = local_host
http.start do
…
end
Instead of passing the local host and port as parameters to
Net::HTTP.new or Net::HTTP.start.
----------------------------------------
Feature #6617: Net::HTTP: Bind to a specific local IP/port
https://bugs.ruby-lang.org/issues/6617#change-27343
Author: mksm (Ricardo Amorim)
Status: Open
Priority: Normal
Assignee:
Category: lib
Target version:
Despite having several solutions floating around the net, this feature
is currently not present in Net::HTTP. I searched the issues but didn't
find any discussion on this. How does the dev team feel about this? Can
I submit a patch for revision?
on 2012-06-22 03:15
Issue #6617 has been updated by mksm (Ricardo Amorim). I agree. You can pass both local_ip and local_port to TCPSocket.open in Net::HTTP#connect. Having the setter exposed would allow the user to change the local IP address between connections. Any ideas if this could cause problems with Net::HTTP or remote servers? There's also proxy and ipv6 support, both which I have never tested using this approach. ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27351 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: Category: lib Target version: Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-06-25 20:44
Issue #6617 has been updated by mksm (Ricardo Amorim). File net-http_bind_to_local_ip.patch added The patch adds accessors for @local_host and @local_port and uses both in TCPSocket.open call. ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27417 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: Category: lib Target version: Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-06-25 23:46
Issue #6617 has been updated by drbrain (Eric Hodel). Assignee set to naruse (Yui NARUSE) Target version set to 2.0.0 ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27453 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: naruse (Yui NARUSE) Category: lib Target version: 2.0.0 Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-07-03 06:14
Issue #6617 has been updated by naruse (Yui NARUSE). It looks good. Could you provide a test for it? It should be a patch for test/net/http/test_http.rb ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27740 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: naruse (Yui NARUSE) Category: lib Target version: 2.0.0 Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-07-04 12:07
Issue #6617 has been updated by madeofcode (Mark Dodwell). Forgive me if this is a silly question, but what is the point of initializing the instance variables to nil in the initializer? ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27792 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: naruse (Yui NARUSE) Category: lib Target version: 2.0.0 Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-07-04 17:06
Issue #6617 has been updated by jballanc (Joshua Ballanco).
=begin
Not sure, but it may be related to this:
>> defined?(@foo)
=> nil
>> @foo = nil
=> nil
>> defined?(@foo)
=> "instance-variable"
=end
----------------------------------------
Feature #6617: Net::HTTP: Bind to a specific local IP/port
https://bugs.ruby-lang.org/issues/6617#change-27808
Author: mksm (Ricardo Amorim)
Status: Open
Priority: Normal
Assignee: naruse (Yui NARUSE)
Category: lib
Target version: 2.0.0
Despite having several solutions floating around the net, this feature
is currently not present in Net::HTTP. I searched the issues but didn't
find any discussion on this. How does the dev team feel about this? Can
I submit a patch for revision?
on 2012-07-05 07:20
Issue #6617 has been updated by mksm (Ricardo Amorim). File net-http_bind_to_local_ip-tests.patch added @naruse: tests attached! It seems that local_host cannot be nil when setting local_port in TCPSocket.open. @madeofcode: I also do not know, just followed the pattern. jballanc may have a point, but i can't see why there would be #defined? checks on ivars. ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27822 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: naruse (Yui NARUSE) Category: lib Target version: 2.0.0 Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
on 2012-07-05 21:49
Issue #6617 has been updated by drbrain (Eric Hodel). =begin You need to initialize instance variables to prevent warnings on uninitialized access: $ ruby -we 'p @x' -e:1: warning: instance variable @x not initialized nil =end ---------------------------------------- Feature #6617: Net::HTTP: Bind to a specific local IP/port https://bugs.ruby-lang.org/issues/6617#change-27835 Author: mksm (Ricardo Amorim) Status: Open Priority: Normal Assignee: naruse (Yui NARUSE) Category: lib Target version: 2.0.0 Despite having several solutions floating around the net, this feature is currently not present in Net::HTTP. I searched the issues but didn't find any discussion on this. How does the dev team feel about this? Can I submit a patch for revision?
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
Log in with Google account | Log in with Yahoo account
No account? Register here.