class Thrift::HTTPClientTransport
Public Class Methods
new(url)
click to toggle source
# File lib/thrift/transport/http_client_transport.rb 29 def initialize(url) 30 @url = URI url 31 @headers = {'Content-Type' => 'application/x-thrift'} 32 @outbuf = "" 33 end
Public Instance Methods
add_headers(headers)
click to toggle source
# File lib/thrift/transport/http_client_transport.rb 39 def add_headers(headers) 40 @headers = @headers.merge(headers) 41 end
flush()
click to toggle source
# File lib/thrift/transport/http_client_transport.rb 43 def flush 44 http = Net::HTTP.new @url.host, @url.port 45 http.use_ssl = @url.scheme == "https" 46 resp, data = http.post(@url.request_uri, @outbuf, @headers) 47 @inbuf = StringIO.new data 48 @outbuf = "" 49 end
open?()
click to toggle source
# File lib/thrift/transport/http_client_transport.rb 35 def open?; true end
read(sz)
click to toggle source
# File lib/thrift/transport/http_client_transport.rb 36 def read(sz); @inbuf.read sz end
write(buf)
click to toggle source
# File lib/thrift/transport/http_client_transport.rb 37 def write(buf); @outbuf << buf end