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