# File lib/mongrel.rb, line 228
228:     def read_body(remain, total, dispatcher)
229:       begin
230:         # write the odd sized chunk first
231: 
232:         remain -= @body.write(read_socket(remain % Const::CHUNK_SIZE))
233:         dispatcher.request_progress(params, remain, total) if dispatcher
234: 
235:         # then stream out nothing but perfectly sized chunks
236:         until remain <= 0 or @socket.closed?
237:           remain -= @body.write(read_socket(Const::CHUNK_SIZE))
238:           # ASSUME: we are writing to a disk and these writes always write the requested amount
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:         # any errors means we should delete the file, including if the file is dumped
245:         @socket.close rescue Object
246:         @body.delete if @body.class == Tempfile
247:         @body = nil # signals that there was a problem
248:       end
249:     end