Parent

Thrift::HTTPClientTransport

Public Class Methods

new(url) click to toggle source
# File lib/thrift/transport/http_client_transport.rb, line 28
def initialize(url)
  @url = URI url
  @headers = {'Content-Type' => 'application/x-thrift'}
  @outbuf = Bytes.empty_byte_buffer
end

Public Instance Methods

add_headers(headers) click to toggle source
# File lib/thrift/transport/http_client_transport.rb, line 38
def add_headers(headers)
  @headers = @headers.merge(headers)
end
flush() click to toggle source
# File lib/thrift/transport/http_client_transport.rb, line 42
def flush
  http = Net::HTTP.new @url.host, @url.port
  http.use_ssl = @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
open?() click to toggle source
# File lib/thrift/transport/http_client_transport.rb, line 34
def open?; true end
read(sz) click to toggle source
# File lib/thrift/transport/http_client_transport.rb, line 35
def read(sz); @inbuf.read sz end
write(buf) click to toggle source
# File lib/thrift/transport/http_client_transport.rb, line 36
def write(buf); @outbuf << Bytes.force_binary_encoding(buf) end

[Validate]

Generated with the Darkfish Rdoc Generator 2.