# Determine when request is fully sent

**URL:** <https://www.ruby-forum.com/t/determine-when-request-is-fully-sent/128880>\
**Category:** NGINX\
**Created:** [February 12, 2008, 12:14pm UTC](https://www.ruby-forum.com/t/determine-when-request-is-fully-sent/128880 "2008-02-12T12:14:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcin\_Gajda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e19adc/32.png) [@Marcin\_Gajda](https://www.ruby-forum.com/u/Marcin_Gajda)\
**Post date:** [February 12, 2008, 12:14pm UTC](https://www.ruby-forum.com/t/determine-when-request-is-fully-sent/128880/1 "2008-02-12T12:14:15Z")

</div>

Hi all!

I need to write a module which will make an action when all request body  
is sent to the client (or after breaking the connection by the client).  
It is very important to me to do it when data are really sent, not only  
scheduled for sending. Is this possible using nginx module framework?  
Which kind of module (handler, filter or balancer) should I use?

I looked on handler and filter module references but it seems that they  
just prepare/update response body for sending. I would like to insert  
callback after real, phisicall send.

Best regards,

---

<div class="post-metadata">

**Author:** ![Marcin\_Gajda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e19adc/32.png) [@Marcin\_Gajda](https://www.ruby-forum.com/u/Marcin_Gajda)\
**Post date:** [February 12, 2008, 12:27pm UTC](https://www.ruby-forum.com/t/determine-when-request-is-fully-sent/128880/2 "2008-02-12T12:27:50Z")

</div>

On Tue, Feb 12, 2008 at 11:05:01AM +0100, Marcin Gajda wrote:

> I need to write a module which will make an action when all request body  
> is sent to the client (or after breaking the connection by the client).  
> It is very important to me to do it when data are really sent, not only  
> scheduled for sending. Is this possible using nginx module framework?  
> Which kind of module (handler, filter or balancer) should I use?
> 
> I looked on handler and filter module references but it seems that they  
> just prepare/update response body for sending. I would like to insert  
> callback after real, phisicall send.

nginx may report only successful sending full response to a kernel,  
but it can not say whether response was sent by kernel to client.

---

<div class="post-metadata">

**Author:** ![Marcin\_Gajda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e19adc/32.png) [@Marcin\_Gajda](https://www.ruby-forum.com/u/Marcin_Gajda)\
**Post date:** [February 12, 2008, 3:56pm UTC](https://www.ruby-forum.com/t/determine-when-request-is-fully-sent/128880/3 "2008-02-12T15:56:37Z")

</div>

On Tue, Feb 12, 2008 at 02:18:01PM +0300, Igor S. wrote:

> nginx may report only successful sending full response to a kernel,  
> but it can not say whether response was sent by kernel to client.

Hm… It’s a pity for me ☹

But perhaps the solution with sending full response to a kernel could be  
sufficient for me. Could you write me, which module type should I use?  
Maybe a filter linked somewhere at the end?

Best regards,

---

<div class="post-metadata">

**Author:** ![Marcin\_Gajda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e19adc/32.png) [@Marcin\_Gajda](https://www.ruby-forum.com/u/Marcin_Gajda)\
**Post date:** [February 12, 2008, 4:25pm UTC](https://www.ruby-forum.com/t/determine-when-request-is-fully-sent/128880/4 "2008-02-12T16:25:01Z")

</div>

On Tue, Feb 12, 2008 at 03:48:20PM +0100, Marcin Gajda wrote:

> On Tue, Feb 12, 2008 at 02:18:01PM +0300, Igor S. wrote:
> 
> > nginx may report only successful sending full response to a kernel,  
> > but it can not say whether response was sent by kernel to client.
> 
> Hm… It’s a pity for me ☹
> 
> But perhaps the solution with sending full response to a kernel could be  
> sufficient for me. Could you write me, which module type should I use?  
> Maybe a filter linked somewhere at the end?

```
  location / {
       post_action /post;
  }

  location = /post {
       proxy_pass/etc.
       # $request_completion here is "OK" if request complete
       # or "" otherwise.
  }
```
