http post in chunks

This isn't strictly a rails query. I have created a rails application that accepts post data on an action and I'm writing a ruby client that sends a file using HTTP::Post. However, the file is quite big and I want to display some kind of feedback on the send progress but I can't work out any way to either write in chunks of a small size or to monitor the send progress in any other way. Is there a way I can do this?

Jeremy

Well if anyone is interested heres how i solved it:

class VerboseStringIO < StringIO     def read(len = nil)        progress = (pos.to_f / length.to_f) * 100        puts "Progress: #{progress}%"        super(len)     end end

data # string of data to post tio = VerboseStringIO.new(data)

req = Net::HTTP::Post.new("/controller/action") req.body_stream = tio req.content_length = data.length req.content_type = "text/xml" #or whatever

http = Net::HTTP.new("localhost",3000) http.read_timeout = 999 response = http.start{|query| query.request req}

This should output: Progress: 1% Progress: 2% Progress: 3%

and so on so you can do whatever and show a progress bar or something.