Class: KonoEppClient::Transport::HttpTransport
- Inherits:
-
Object
- Object
- KonoEppClient::Transport::HttpTransport
- Includes:
- KonoEppClient::Transport
- Defined in:
- lib/epp/transport/http.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(server, port) ⇒ HttpTransport
constructor
A new instance of HttpTransport.
- #read ⇒ Object
- #write(xml) ⇒ Object
Constructor Details
#initialize(server, port) ⇒ HttpTransport
Returns a new instance of HttpTransport.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |
Instance Method Details
#close ⇒ Object
45 46 |
# File 'lib/epp/transport/http.rb', line 45 def close end |
#read ⇒ Object
25 26 27 28 |
# File 'lib/epp/transport/http.rb', line 25 def read #puts @response.body @response.body end |
#write(xml) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/epp/transport/http.rb', line 30 def write( xml ) @store.transaction do = '$Version="1"' @store[:cookies].each do |c| += "; #{c[:name]}=#{c[:value]}" end if @store[:cookies] header = { "Cookie" => } @response = @net_http.post( "/", xml, header ) @store[:cookies] = ( @response["Set-Cookie"] ) if @response["Set-Cookie"] end end |