Method: DRb::HTTP0::ClientSide#post

Defined in:
lib/drb/http0.rb

#post(url, data) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# 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