Class: Thrift::HTTPClientTransport
- Inherits:
-
BaseTransport
- Object
- BaseTransport
- Thrift::HTTPClientTransport
- Defined in:
- lib/thrift/transport/http_client_transport.rb
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(url) ⇒ HTTPClientTransport
constructor
A new instance of HTTPClientTransport.
- #open? ⇒ Boolean
- #read(sz) ⇒ Object
- #write(buf) ⇒ Object
Methods inherited from BaseTransport
Constructor Details
#initialize(url) ⇒ HTTPClientTransport
Returns a new instance of HTTPClientTransport.
28 29 30 31 |
# File 'lib/thrift/transport/http_client_transport.rb', line 28 def initialize(url) @url = URI url @outbuf = "" end |
Instance Method Details
#flush ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/thrift/transport/http_client_transport.rb', line 36 def flush http = Net::HTTP.new @url.host, @url.port http.use_ssl = @url.scheme == "https" headers = { 'Content-Type' => 'application/x-thrift' } resp, data = http.post(@url.path, @outbuf, headers) @inbuf = StringIO.new data @outbuf = "" end |
#open? ⇒ Boolean
33 |
# File 'lib/thrift/transport/http_client_transport.rb', line 33 def open?; true end |
#read(sz) ⇒ Object
34 |
# File 'lib/thrift/transport/http_client_transport.rb', line 34 def read(sz); @inbuf.read sz end |
#write(buf) ⇒ Object
35 |
# File 'lib/thrift/transport/http_client_transport.rb', line 35 def write(buf); @outbuf << buf end |