# Subrequest concatenation

**URL:** <https://www.ruby-forum.com/t/subrequest-concatenation/188214>\
**Category:** NGINX\
**Created:** [May 7, 2010, 7:38pm UTC](https://www.ruby-forum.com/t/subrequest-concatenation/188214 "2010-05-07T19:38:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterjanovsky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@peterjanovsky](https://www.ruby-forum.com/u/peterjanovsky)\
**Post date:** [May 7, 2010, 7:38pm UTC](https://www.ruby-forum.com/t/subrequest-concatenation/188214/1 "2010-05-07T19:38:08Z")

</div>

if someone would shed light on how subrequests are concatenated to the  
parent request and send to the client it’d be much appreciated.  
currently i have been able to issue a subrequest and have verified both  
the parent request and subrequest successfully return a valid response.

what happens now is that neither the parent request or concatenated  
subrequest are returned to my browser. an empty request is returned to  
my browser after waiting for a response for up to 60 seconds.

i’ve looked into the addition and echo modules which were of great help,  
any other pointers you may have would be much appreciated.

Posted at Nginx Forum:

> **[subrequest concatenation](https://forum.nginx.org/read.php?2,83941,83941#msg-83941)**
>
> if someone would shed light on how subrequests are concatenated to the parent request and send to the client it'd be much appreciated. currently i have been able to issue a subrequest and have verified both the parent request and subrequest...

---

<div class="post-metadata">

**Author:** ![peterjanovsky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@peterjanovsky](https://www.ruby-forum.com/u/peterjanovsky)\
**Post date:** [May 10, 2010, 5:39am UTC](https://www.ruby-forum.com/t/subrequest-concatenation/188214/2 "2010-05-10T05:39:57Z")

</div>

On Sat, May 8, 2010 at 1:37 AM, peterjanovsky [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> if someone would shed light on how subrequests are concatenated to the parent request and send to the client it’d be much appreciated.

The subrequest model is a bit complicated. Basically, there’s a  
r-\>postponed chain that glean responses from the subrequests as well  
as the current (parent) request.

It’s worth mentioning that there’s also a r-\>posted\_requests chain  
that manage the “active request” relay sequence. Only the active  
request can respond to the read/write event of the downstream  
connection (i.e., r-\>connection).

> what happens now is that neither the parent request or concatenated subrequest are returned to my browser. an empty request is returned to my browser after waiting for a response for up to 60 seconds.

It’s not uncommon at all. I ran into similar issues last night (while  
hacking on my ngx\_srcache module) just because I didn’t get every bit  
right (see y explanation above). 🙂

Cheers,  
-agentzh

---

<div class="post-metadata">

**Author:** ![peterjanovsky](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/47e85d/32.png) [@peterjanovsky](https://www.ruby-forum.com/u/peterjanovsky)\
**Post date:** [May 10, 2010, 5:41am UTC](https://www.ruby-forum.com/t/subrequest-concatenation/188214/3 "2010-05-10T05:41:43Z")

</div>

On Mon, May 10, 2010 at 11:39 AM, agentzh [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Sat, May 8, 2010 at 1:37 AM, peterjanovsky [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > if someone would shed light on how subrequests are concatenated to the parent request and send to the client it’d be much appreciated.
> 
> The subrequest model is a bit complicated. Basically, there’s a  
> r-\>postponed chain that glean responses from the subrequests as well  
> as the current (parent) request.

Oops, forgot to mention that the concatenation actually happens in  
ngx\_http\_postpone\_filter\_module.c 🙂

I was interrupted by one of my teammates while writing that mail 😉

Cheers,  
-agentzh
