class KonoEppClient::Transport::HttpTransport

Public Class Methods

new( server, port ) click to toggle source
# File lib/epp/transport/http.rb, line 9
def initialize( server, port )
  @net_http = Net::HTTP.new( server, port )

  @net_http.use_ssl = true
  @net_http.ssl_version = :TLSv1
  @net_http.verify_mode = OpenSSL::SSL::VERIFY_PEER
  
  #FIXME: Commented because not work on MacOS (dev machine), is necessary for Linux machine?
  #@net_http.ca_path = '/etc/ssl/certs'
  
  # @net_http.set_debug_output $stderr
   #@net_http.set_debug_output File.open( "/tmp/net.log", "a")

  @store = PStore.new( "cookies.pstore" )
end

Public Instance Methods

close() click to toggle source
# File lib/epp/transport/http.rb, line 45
def close
end
read() click to toggle source
# File lib/epp/transport/http.rb, line 25
def read
  #puts @response.body
  @response.body
end
write( xml ) click to toggle source
# File lib/epp/transport/http.rb, line 30
def write( xml )
  @store.transaction do
    cookie_str = '$Version="1"'
    @store[:cookies].each do |c|
      cookie_str += "; #{c[:name]}=#{c[:value]}"
    end if @store[:cookies]

    header = { "Cookie" => cookie_str }

    @response = @net_http.post( "/", xml, header )

    @store[:cookies] = parse_set_cookie( @response["Set-Cookie"] ) if @response["Set-Cookie"]
  end
end

Private Instance Methods

http_post() click to toggle source
# File lib/epp/transport/http.rb, line 63
def http_post
end