# File lib/mongrel.rb, line 245
245:     def read_body(remain, total)
246:       begin
247:         # write the odd sized chunk first
248:         @params.http_body = read_socket(remain % Const::CHUNK_SIZE)
249: 
250:         remain -= @body.write(@params.http_body)
251: 
252:         update_request_progress(remain, total)
253: 
254:         # then stream out nothing but perfectly sized chunks
255:         until remain <= 0 or @socket.closed?
256:           # ASSUME: we are writing to a disk and these writes always write the requested amount
257:           @params.http_body = read_socket(Const::CHUNK_SIZE)
258:           remain -= @body.write(@params.http_body)
259: 
260:           update_request_progress(remain, total)
261:         end
262:       rescue Object
263:         STDERR.puts "ERROR reading http body: #$!"
264:         $!.backtrace.join("\n")
265:         # any errors means we should delete the file, including if the file is dumped
266:         @socket.close rescue Object
267:         @body.delete if @body.class == Tempfile
268:         @body = nil # signals that there was a problem
269:       end
270:     end