Per-Request Information

The core ensures that the right information is available to the modules at the right time by matching requests to the appropriate virtual server and directory information before invoking the various functions in the modules. This, and other information, is packaged in a request_rec structure, defined in httpd.h:

struct request_rec { ap_pool *pool; conn_rec *connection; server_rec *server; request_rec *next; /* If we wind up getting redirected, * pointer to the request we redirected to. */ request_rec *prev; /* If this is an internal redirect, * pointer to where we redirected *from*. */ request_rec *main; /* If this is a subrequest (see request.h), * pointer back to the main request. */ /* Info about the request itself... we begin with stuff that only * protocol.c should ever touch... */ char *the_request; /* First line of request, so we can log it */ int assbackwards; /* HTTP/0.9, "simple" request */ int proxyreq; /* A proxy request (calculated during * post_read_request or translate_name) */ int header_only; /* HEAD request, as opposed to GET */ char *protocol; /* Protocol, as given to us, or HTTP/0.9 */ int proto_num; /* Number version of protocol; 1.1 = 1001 */ const char *hostname; /* Host, as set by full URI or Host: */ time_t request_time; /* When the request started */ char *status_line; /* Status line, if set by script */ int status; /* In any case */ /* Request method, two ways; also, protocol, etc. Outside of protocol.c, * look, but don't touch. ...

Get Apache: The Definitive Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.