# Post Handler Hook

**URL:** <https://www.ruby-forum.com/t/post-handler-hook/189736>\
**Category:** NGINX\
**Created:** [June 6, 2010, 4:20pm UTC](https://www.ruby-forum.com/t/post-handler-hook/189736 "2010-06-06T16:20:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shameem\_Ahamed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Shameem\_Ahamed](https://www.ruby-forum.com/u/Shameem_Ahamed)\
**Post date:** [June 6, 2010, 4:20pm UTC](https://www.ruby-forum.com/t/post-handler-hook/189736/1 "2010-06-06T16:20:32Z")

</div>

Hi All,

I am writing a test module for nginx. Basically I want to limit the  
simultaneous downloads of the files. I am creating a temp file when a  
download request comes. I am doing it in the start of handler.

I want to remove the temp file, when the request is finished. I couldn’t  
find any post handler hook. Can i remove the temp file at the end of the  
handler ?

Any suggestion will be highly appreciated.

Regards,  
Shameem

---

<div class="post-metadata">

**Author:** ![Shameem\_Ahamed](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@Shameem\_Ahamed](https://www.ruby-forum.com/u/Shameem_Ahamed)\
**Post date:** [June 6, 2010, 11:21pm UTC](https://www.ruby-forum.com/t/post-handler-hook/189736/2 "2010-06-06T23:21:59Z")

</div>

Hello!

On Sun, Jun 06, 2010 at 07:49:25PM +0530, Shameem Ahamed wrote:

> I am writing a test module for nginx. Basically I want to limit  
> the simultaneous downloads of the files. I am creating a temp  
> file when a download request comes. I am doing it in the start  
> of handler.
> 
> I want to remove the temp file, when the request is finished. I  
> couldn’t find any post handler hook. Can i remove the temp file  
> at the end of the handler ?
> 
> Any suggestion will be highly appreciated.

You have to add cleanup handler to request pool. Take a look at  
limit\_zone module for an example.

Maxim D.
