# What does the "main" pointor in request struct mean?

**URL:** <https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235>\
**Category:** NGINX\
**Created:** [May 27, 2010, 8:56am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235 "2010-05-27T08:56:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 27, 2010, 8:56am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/1 "2010-05-27T08:56:56Z")

</div>

I found in Nginx that:  
struct ngx\_http\_request\_s {  
…  
ngx\_http\_request\_t \*main;  
…  
};  
what does this argument mean?

I also found a similar argument in Apache:  
request\_rec\* request\_rec::main  
//Pointer to the main request if this is a sub-request (see  
http\_request.h)

so,  
Do they have the same meaning?  
and if yes, what dose a main request and a sub-request mean? What’s the  
difference between the 2 http requests?

hope anybody’s help. Thx~~

Posted at Nginx Forum:

> **[what does the "main" pointor in request struct mean?](https://forum.nginx.org/read.php?2,90805,90805#msg-90805)**
>
> I found in Nginx that: struct ngx\_http\_request\_s { ... ngx\_http\_request\_t \*main; ... }; what does this argument mean? I also found a similar argument in Apache: request\_rec\* request\_rec::main //Pointer

---

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 27, 2010, 10:39am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/2 "2010-05-27T10:39:23Z")

</div>

Just out of curiosity, if GET #1 is index.html and this file has an  
img tag, is the second GET a subrequest?

–  
() ascii-rubanda kampajno - kontraÅ­ html-a retpoÅto  
/\ ascii ribbon campaign - against html e-mail

---

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 27, 2010, 10:20am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/3 "2010-05-27T10:20:04Z")

</div>

On Thu, May 27, 2010 at 02:55:57AM -0400, 4everpan wrote:

> //Pointer to the main request if this is a sub-request (see http\_request.h)
> 
> so,  
> Do they have the same meaning?  
> and if yes, what dose a main request and a sub-request mean? What’s the difference between the 2 http requests?

Yes, this is the same as in Apache.  
Subrequests are requests made inside a request, for example, in SSI:

```
<!--# include virtual="/header.html" -->

```

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 27, 2010, 10:56am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/4 "2010-05-27T10:56:57Z")

</div>

On Thu, May 27, 2010 at 09:38:07AM +0100, Nuno Magalhães wrote:

> Just out of curiosity, if GET #1 is index.html and this file has an  
> img tag, is the second GET a subrequest?

No. The image request is a separate client request.  
Subrequests are invisible to a client as well as internal redirects.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 28, 2010, 8:20am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/5 "2010-05-28T08:20:14Z")

</div>

## Igor S. Wrote:

> > 
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

It’s really a surprise for me that Igor S. answered my first  
question in our forum! (^o^)/~

But I’m not familiar with SSI or shtml protocal… So… let me think  
about it:  
When I enter the URL “[http://www.g.cn](http://www.g.cn)” into IE, the URL will be  
redirected to “[http://www.google.cn](http://www.google.cn)” such as follows:

Started Time Sent Received Method Result Type URL

- 0.000 0.134 406 532 GET 301 Redirect to  
[Google](http://www.google.cn/webhp?source=g_cn)[http://www.g.cn/](http://www.g.cn/)

Dose the GET of URL"[Google](http://www.google.cn/webhp?source=g_cn)" is a  
sub-request of the GET of URL"[http://www.g.cn/](http://www.g.cn/)"?

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,90805,91363#msg-91363](http://forum.nginx.org/read.php?2,90805,91363#msg-91363)

---

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 28, 2010, 12:03pm UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/6 "2010-05-28T12:03:49Z")

</div>

## agentzh Wrote:

> > - 0.000 0.134 Â 406 Â Â 532 Â Â GET Â Â
> 
> Both of them are “main requests”.
> 
> Cheers,  
> -agentzh
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

I see… thx~ seems I need to look into the details of HTTP  
protocal first…

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,90805,91435#msg-91435](http://forum.nginx.org/read.php?2,90805,91435#msg-91435)

---

<div class="post-metadata">

**Author:** ![4everpan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/4/d07c76/32.png) [@4everpan](https://www.ruby-forum.com/u/4everpan)\
**Post date:** [May 28, 2010, 10:53am UTC](https://www.ruby-forum.com/t/what-does-the-main-pointor-in-request-struct-mean/189235/7 "2010-05-28T10:53:35Z")

</div>

On Fri, May 28, 2010 at 2:19 PM, 4everpan [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> But I’m not familiar with SSI or shtml protocal… So… let me think about it:  
> When I enter the URL “[http://www.g.cn](http://www.g.cn)” into IE, the URL will be redirected to “[http://www.google.cn](http://www.google.cn)” such as follows:
> 
> Started Time Sent Received Method Result Type URL
> 
> - 0.000 0.134 406 532 GET 301 Redirect to [Google](http://www.google.cn/webhp?source=g_cn)[http://www.g.cn/](http://www.g.cn/)
> 
> Dose the GET of URL"[Google](http://www.google.cn/webhp?source=g_cn)" is a sub-request of the GET of URL"[http://www.g.cn/](http://www.g.cn/)"?

No.

Both of them are “main requests”.

Cheers,  
-agentzh
