# File lib/thrift/transport/http_client_transport.rb, line 29 def initialize(url, opts = {}) @url = URI url @headers = {'Content-Type' => 'application/x-thrift'} @outbuf = Bytes.empty_byte_buffer @ssl_verify_mode = opts.fetch(:ssl_verify_mode, OpenSSL::SSL::VERIFY_PEER) end
# File lib/thrift/transport/http_client_transport.rb, line 40 def add_headers(headers) @headers = @headers.merge(headers) end
# File lib/thrift/transport/http_client_transport.rb, line 44 def flush http = Net::HTTP.new @url.host, @url.port http.use_ssl = @url.scheme == 'https' http.verify_mode = @ssl_verify_mode if @url.scheme == 'https' resp = http.post(@url.request_uri, @outbuf, @headers) data = resp.body data = Bytes.force_binary_encoding(data) @inbuf = StringIO.new data @outbuf = Bytes.empty_byte_buffer end
# File lib/thrift/transport/http_client_transport.rb, line 36 def open?; true end
Generated with the Darkfish Rdoc Generator 2.