class DRb::HTTP0::ClientSide

Public Class Methods

new(uri, config) click to toggle source
# File lib/drb/http0.rb, line 41
def initialize(uri, config)
  @uri = uri
  @res = nil
  @config = config
  @msg = DRbMessage.new(config)
  @proxy = ENV['HTTP_PROXY']
end

Public Instance Methods

alive?() click to toggle source
# File lib/drb/http0.rb, line 50
def alive?; false; end
close() click to toggle source
# File lib/drb/http0.rb, line 49
def close; end
post(url, data) click to toggle source
# File lib/drb/http0.rb, line 63
def post(url, data)
  it = URI.parse(url)
  path = [(it.path=='' ? '/' : it.path), it.query].compact.join('?')
  http = Net::HTTP.new(it.host, it.port)
  sio = StrStream.new
  http.post(path, data, {'Content-Type'=>'application/octetstream;'}) do |str|
    sio.write(str)
    if @config[:load_limit] < sio.buf.size
      raise TypeError, 'too large packet'
    end
  end
  @reply_stream = sio
end
recv_reply() click to toggle source
# File lib/drb/http0.rb, line 59
def recv_reply
  @msg.recv_reply(@reply_stream)
end
send_request(ref, msg_id, *arg, &b) click to toggle source
# File lib/drb/http0.rb, line 52
def send_request(ref, msg_id, *arg, &b)
  stream = StrStream.new
  @msg.send_request(stream, ref, msg_id, *arg, &b)
  @reply_stream = StrStream.new
  post(@uri, stream.buf)
end