Class Thrift::HTTPClientTransport
In: lib/thrift/transport/http_client_transport.rb
lib/thrift/transport/http_client_transport.rb
Parent: BaseTransport

Methods

add_headers   add_headers   flush   flush   new   new   open?   open?   read   read   write   write  

Public Class methods

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 29
29:     def initialize(url)
30:       @url = URI url
31:       @headers = {'Content-Type' => 'application/x-thrift'}
32:       @outbuf = Bytes.empty_byte_buffer
33:     end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 29
29:     def initialize(url)
30:       @url = URI url
31:       @headers = {'Content-Type' => 'application/x-thrift'}
32:       @outbuf = Bytes.empty_byte_buffer
33:     end

Public Instance methods

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 39
39:     def add_headers(headers)
40:       @headers = @headers.merge(headers)
41:     end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 39
39:     def add_headers(headers)
40:       @headers = @headers.merge(headers)
41:     end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 43
43:     def flush
44:       http = Net::HTTP.new @url.host, @url.port
45:       http.use_ssl = @url.scheme == 'https'
46:       resp = http.post(@url.request_uri, @outbuf, @headers)
47:       data = resp.body
48:       data = Bytes.force_binary_encoding(data)
49:       @inbuf = StringIO.new data
50:       @outbuf = Bytes.empty_byte_buffer
51:     end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 43
43:     def flush
44:       http = Net::HTTP.new @url.host, @url.port
45:       http.use_ssl = @url.scheme == 'https'
46:       resp = http.post(@url.request_uri, @outbuf, @headers)
47:       data = resp.body
48:       data = Bytes.force_binary_encoding(data)
49:       @inbuf = StringIO.new data
50:       @outbuf = Bytes.empty_byte_buffer
51:     end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 35
35:     def open?; true end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 35
35:     def open?; true end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 36
36:     def read(sz); @inbuf.read sz end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 36
36:     def read(sz); @inbuf.read sz end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 37
37:     def write(buf); @outbuf << Bytes.force_binary_encoding(buf) end

[Source]

    # File lib/thrift/transport/http_client_transport.rb, line 37
37:     def write(buf); @outbuf << Bytes.force_binary_encoding(buf) end

[Validate]