Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add support for connection by hostname #2

Merged
merged 2 commits into from

2 participants

@meh

Looking at socksify-ruby and em-socksify I found what was missing.

My em-http-request thingy doesn't work yet, but now I don't know where the error is.

If you want to check out the code that uses em-http-request it's here: https://github.com/meh/torb/blob/master/puppet/puppet.rb

@igrigorik
Owner

I'm not sure I follow these changes. How is the end result any different? We're still resolving the hostname and sending the same bytes over the wire?

@igrigorik
Owner

Hmm, to answer my own question, I think I'm following it now: if the name can't be resolved then pack it and forward as is.

Interesting... not familiar with Tor internals, hence the confusion!

@igrigorik igrigorik merged commit b6b387b into igrigorik:master
@meh

Keep in mind that I can't get it to work properly yet, if you could give it a look it would be best, I know pretty much nothing about SOCKS (or Tor internals), and I really need this to work or I can't make my tor2web :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 27, 2011
  1. @meh
  2. @meh

    Fix connection packs

    meh authored
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 6 deletions.
  1. +9 −6 lib/em-socksify/socksify.rb
View
15 lib/em-socksify/socksify.rb
@@ -31,14 +31,17 @@ def send_socks_handshake
end
def send_socks_connect_request
- begin
- # TO-DO: Implement address types for IPv6 and Domain
- ip_address = Socket.gethostbyname(@host).last
- send_data [5, 1, 0, 1, ip_address, @port].flatten.pack('CCCCA4n')
+ send_data [5, 1, 0].pack('CCC')
+ begin
+ # TODO: Implement address types for IPv6 and Domain
+ # TODO: resolve domain through the proxy
+ send_data [1, Socket.gethostbyname(@host).last].pack('CA4')
rescue
- fail("could not resolve host")
+ send_data [3, @host.size, @host].pack('CCA*')
end
+
+ send_data [@port].pack('n')
end
private
@@ -119,4 +122,4 @@ def socks_methods
end
end
-end
+end
Something went wrong with that request. Please try again.