Class: Tunnelss::HttpsProxy

Inherits:
HttpProxy
  • Object
show all
Includes:
ConfigureWithPow
Defined in:
lib/tunnelss.rb

Instance Attribute Summary

Attributes inherited from HttpProxy

#client_port

Instance Method Summary collapse

Methods included from ConfigureWithPow

#configure_with_pow, #pow_present?

Methods inherited from HttpProxy

#initialize, #unbind, #unbind_client

Constructor Details

This class inherits a constructor from Tunnelss::HttpProxy

Instance Method Details

#post_initObject



116
117
118
119
120
121
122
# File 'lib/tunnelss.rb', line 116

def post_init
  if pow_present?
    start_tls(:private_key_file => "#{dir}/key.pem", :cert_chain_file => "#{dir}/server.crt", :verify_peer => false)
  else
    start_tls
  end
end

#receive_data(data) ⇒ Object



129
130
131
132
133
134
135
136
# File 'lib/tunnelss.rb', line 129

def receive_data(data)
  if !@x_forwarded_proto_header_inserted && data =~ /\r\n\r\n/
    super data.gsub(/\r\n\r\n/, "\r\nX_FORWARDED_PROTO: https\r\n\r\n")
    @x_forwarded_proto_header_inserted = true
  else
    super
  end
end

#relay_from_client(data) ⇒ Object



124
125
126
127
# File 'lib/tunnelss.rb', line 124

def relay_from_client(data)
  super
  @x_forwarded_proto_header_inserted = false
end