228: def read_body(remain, total, dispatcher)
229: begin
230:
231:
232: remain -= @body.write(read_socket(remain % Const::CHUNK_SIZE))
233: dispatcher.request_progress(params, remain, total) if dispatcher
234:
235:
236: until remain <= 0 or @socket.closed?
237: remain -= @body.write(read_socket(Const::CHUNK_SIZE))
238:
239: dispatcher.request_progress(params, remain, total) if dispatcher
240: end
241: rescue Object
242: STDERR.puts "ERROR reading http body: #$!"
243: $!.backtrace.join("\n")
244:
245: @socket.close rescue Object
246: @body.delete if @body.class == Tempfile
247: @body = nil
248: end
249: end