/usr/lib/ruby/vendor_ruby/em-socksify/connect.rb is in ruby-em-socksify 0.3.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | module EventMachine
module Connectify
module CONNECT
def connect_send_handshake
header = "CONNECT #{@connect_target_host}:#{@connect_target_port} HTTP/1.0\r\n"
if @connect_username || @connect_password
encoded_credentials = Base64.strict_encode64([@connect_username, @connect_password].join(":"))
header << "Proxy-Authorization: Basic #{encoded_credentials}\r\n"
end
header << "\r\n"
send_data(header)
end
private
def connect_parse_response
unless @connect_data =~ %r{\AHTTP/1\.[01] 200 .*\r\n\r\n}m
raise CONNECTError.new, "Unexpected response: #{@connect_data}"
end
connect_unhook
rescue => e
@connect_deferrable.fail e
end
end
end
end
|