what does the "main" pointor in request struct mean?

Igor Sysoev igor at sysoev.ru
Thu May 27 12:19:22 MSD 2010

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

> 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?

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

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

Igor Sysoev

More information about the nginx mailing list