Per-Request Information

The core ensures that the right information is available to the modules at the right time. It does so 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:

/** A structure that represents the current request */ struct request_rec { /** The pool associated with the request */ apr_pool_t *pool; /** The connection over which this connection has been read */ conn_rec *connection; /** The virtual host this request is for */ server_rec *server; /** If we wind up getting redirected, pointer to the request we * redirected to. */ request_rec *next; /** If this is an internal redirect, pointer to where we redirected * *from*. */ request_rec *prev; /** If this is a sub_request (see request.h) pointer back to the * main request. */ request_rec *main; /* Info about the request itself... we begin with stuff that only * protocol.c should ever touch... */ /** First line of request, so we can log it */ char *the_request; /** HTTP/0.9, "simple" request */ int assbackwards; /** A proxy request (calculated during post_read_request/translate_name) * possible values PROXYREQ_NONE, PROXYREQ_PROXY, PROXYREQ_REVERSE */ int proxyreq; /** HEAD request, as opposed to GET */ int header_only; /** Protocol, as given to us, or HTTP/0.9 */ char *protocol; /** Number version of protocol; 1.1 = 1001 */ int proto_num; /** ...

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.