# RE:problem in cofiguring in mongrel's http\_request.rb

**URL:** <https://www.ruby-forum.com/t/re-problem-in-cofiguring-in-mongrels-http-request-rb/197152>\
**Category:** Rails\
**Created:** [October 6, 2010, 10:16am UTC](https://www.ruby-forum.com/t/re-problem-in-cofiguring-in-mongrels-http-request-rb/197152 "2010-10-06T10:16:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amit-singh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/9f8e36/32.png) [@amit-singh](https://www.ruby-forum.com/u/amit-singh)\
**Post date:** [October 6, 2010, 10:16am UTC](https://www.ruby-forum.com/t/re-problem-in-cofiguring-in-mongrels-http-request-rb/197152/1 "2010-10-06T10:16:00Z")

</div>

Hi all ,  
Am looking to configure mongrels’s http\_request.rb in  
order to  
delete mongrel temporary file after upload .This is what i would like to  
have

def initialize(params, socket, dispatchers)  
@params = params  
@socket = socket  
@dispatchers = dispatchers  
content\_length = @params[Const::CONTENT\_LENGTH].to\_i  
remain = content\_length - @params.http\_body.length

```
  # tell all dispatchers the request has begun
  @dispatchers.each do |dispatcher|
    dispatcher.request_begins(@params)
  end unless @dispatchers.nil? || @dispatchers.empty?

  # Some clients (like FF1.0) report 0 for body and then send a

```

body. This will probably truncate them but at least the request goes  
through usually.  
if remain \<= 0  
# we’ve got everything, pack it up  
@body = StringIO.new  
@body.write @params.http\_body  
update\_request\_progress(0, content\_length)  
elsif remain \> 0  
# must read more data to complete body  
if remain \> Const::MAX\_BODY  
# huge body, put it in a tempfile  
@body = Tempfile.new(Const::MONGREL\_TMP\_BASE)  
@body.binmode  
else  
# small body, just use that  
@body = StringIO.new  
end

```
    @body.write @params.http_body
    read_body(remain, content_length)
  end

  @body.rewind if @body
end

```

Here i would like to close this @body after use by using something like  
@body.close but while doing so am getting error what should i do and  
whre should i call this @body.close
