<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <link rel="STYLESHEET" href="modpython.css" type='text/css' /> <link rel="first" href="modpython.html" title='Mod_python Manual' /> <link rel='contents' href='contents.html' title="Contents" /> <link rel='index' href='genindex.html' title='Index' /> <link rel='last' href='about.html' title='About this document...' /> <link rel='help' href='about.html' title='About this document...' /> <link rel="prev" href="pyapi-mprequest-meth.html" /> <link rel="parent" href="pyapi-mprequest.html" /> <link rel="next" href="pyapi-mpconn.html" /> <meta name='aesop' content='information' /> <title>4.5.4.2 Request Members</title> </head> <body> <DIV CLASS="navigation"> <div id='top-navigation-panel' xml:id='top-navigation-panel'> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="4.5.4.1 Request Methods" href="pyapi-mprequest-meth.html"><img src='previous.png' border='0' height='32' alt='Previous Page' width='32' /></A></td> <td class='online-navigation'><a rel="parent" title="4.5.4 Request Object" href="pyapi-mprequest.html"><img src='up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td> <td class='online-navigation'><a rel="next" title="4.5.5 Connection Object (mp_conn)" href="pyapi-mpconn.html"><img src='next.png' border='0' height='32' alt='Next Page' width='32' /></A></td> <td align="center" width="100%">Mod_python Manual</td> <td class='online-navigation'><a rel="contents" title="Table of Contents" href="contents.html"><img src='contents.png' border='0' height='32' alt='Contents' width='32' /></A></td> <td class='online-navigation'><img src='blank.png' border='0' height='32' alt='' width='32' /></td> <td class='online-navigation'><a rel="index" title="Index" href="genindex.html"><img src='index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <div class='online-navigation'> <b class="navlabel">Previous:</b> <a class="sectref" rel="prev" href="pyapi-mprequest-meth.html">4.5.4.1 Request Methods</A> <b class="navlabel">Up:</b> <a class="sectref" rel="parent" href="pyapi-mprequest.html">4.5.4 Request Object</A> <b class="navlabel">Next:</b> <a class="sectref" rel="next" href="pyapi-mpconn.html">4.5.5 Connection Object (mp_conn)</A> </div> <hr /></div> </DIV> <!--End of Navigation Panel--> <H3><A NAME="SECTION006542000000000000000"></A><A NAME="pyapi-mprequest-mem"></A> <BR> 4.5.4.2 Request Members </H3> <P> <dl><dt><b><tt id='l2h-81' xml:id='l2h-81' class="member">connection</tt></b></dt> <dd> A <code>connection</code> object associated with this request. See Connection Object below for details. <em>(Read-Only)</em> </dl> <P> <dl><dt><b><tt id='l2h-82' xml:id='l2h-82' class="member">server</tt></b></dt> <dd> A server object associate with this request. See Server Object below for details. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-83' xml:id='l2h-83' class="member">next</tt></b></dt> <dd> If this is an internal redirect, the request object we redirect to. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-84' xml:id='l2h-84' class="member">prev</tt></b></dt> <dd> If this is an internal redirect, the request object we redirect from. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-85' xml:id='l2h-85' class="member">main</tt></b></dt> <dd> If this is a sub-request, pointer to the main request. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-86' xml:id='l2h-86' class="member">the_request</tt></b></dt> <dd> String containing the first line of the request. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-87' xml:id='l2h-87' class="member">assbackwards</tt></b></dt> <dd> Indicates an HTTP/0.9 ``simple'' request. This means that the response will contain no headers, only the body. Although this exists for backwards compatibility with obsolescent browsers, some people have figred out that setting assbackwards to 1 can be a useful technique when including part of the response from an internal redirect to avoid headers being sent. </dl> <P> <dl><dt><b><tt id='l2h-88' xml:id='l2h-88' class="member">proxyreq</tt></b></dt> <dd> A proxy request: one of <tt class="constant">apache.PROXYREQ_*</tt> values. </dl> <P> <dl><dt><b><tt id='l2h-89' xml:id='l2h-89' class="member">header_only</tt></b></dt> <dd> A boolean value indicating HEAD request, as opposed to GET. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-90' xml:id='l2h-90' class="member">protocol</tt></b></dt> <dd> Protocol, as given by the client, or "<tt class="samp">HTTP/0.9</tt>". Same as CGI <a class="envvar" id='l2h-138' xml:id='l2h-138'>SERVER_PROTOCOL</a>. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-91' xml:id='l2h-91' class="member">proto_num</tt></b></dt> <dd> Integer. Number version of protocol; 1.1 = 1001 <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-92' xml:id='l2h-92' class="member">hostname</tt></b></dt> <dd> String. Host, as set by full URI or Host: header. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-93' xml:id='l2h-93' class="member">request_time</tt></b></dt> <dd> A long integer. When request started. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-94' xml:id='l2h-94' class="member">status_line</tt></b></dt> <dd> Status line. E.g. "<tt class="samp">200 OK</tt>". <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-95' xml:id='l2h-95' class="member">status</tt></b></dt> <dd> Status. One of <tt class="constant">apache.HTTP_*</tt> values. </dl> <P> <dl><dt><b><tt id='l2h-96' xml:id='l2h-96' class="member">method</tt></b></dt> <dd> A string containing the method - 'GET', 'HEAD', 'POST', etc. Same as CGI <a class="envvar" id='l2h-139' xml:id='l2h-139'>REQUEST_METHOD</a>. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-97' xml:id='l2h-97' class="member">method_number</tt></b></dt> <dd> Integer containing the method number. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-98' xml:id='l2h-98' class="member">allowed</tt></b></dt> <dd> Integer. A bitvector of the allowed methods. Used to construct the Allowed: header when responding with <tt class="constant">HTTP_METHOD_NOT_ALLOWED</tt> or <tt class="constant">HTTP_NOT_IMPLEMENTED</tt>. This field is for Apache's internal use, to set the Allowed: methods use <tt class="method">req.allow_methods()</tt> method, described in section <A href="pyapi-mprequest-meth.html#pyapi-mprequest-meth">4.5.4</A>. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-99' xml:id='l2h-99' class="member">allowed_xmethods</tt></b></dt> <dd> Tuple. Allowed extension methods. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-100' xml:id='l2h-100' class="member">allowed_methods</tt></b></dt> <dd> Tuple. List of allowed methods. Used in relation with <tt class="constant">METHOD_NOT_ALLOWED</tt>. This member can be modified via <tt class="method">req.allow_methods()</tt> described in section <A href="pyapi-mprequest-meth.html#pyapi-mprequest-meth">4.5.4</A>. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-101' xml:id='l2h-101' class="member">sent_bodyct</tt></b></dt> <dd> Integer. Byte count in stream is for body. (?) <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-102' xml:id='l2h-102' class="member">bytes_sent</tt></b></dt> <dd> Long integer. Number of bytes sent. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-103' xml:id='l2h-103' class="member">mtime</tt></b></dt> <dd> Long integer. Time the resource was last modified. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-104' xml:id='l2h-104' class="member">chunked</tt></b></dt> <dd> Boolean value indicating when sending chunked transfer-coding. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-105' xml:id='l2h-105' class="member">range</tt></b></dt> <dd> String. The <code>Range:</code> header. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-106' xml:id='l2h-106' class="member">clength</tt></b></dt> <dd> Long integer. The ``real'' content length. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-107' xml:id='l2h-107' class="member">remaining</tt></b></dt> <dd> Long integer. Bytes left to read. (Only makes sense inside a read operation.) <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-108' xml:id='l2h-108' class="member">read_length</tt></b></dt> <dd> Long integer. Number of bytes read. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-109' xml:id='l2h-109' class="member">read_body</tt></b></dt> <dd> Integer. How the request body should be read. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-110' xml:id='l2h-110' class="member">read_chunked</tt></b></dt> <dd> Boolean. Read chunked transfer coding. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-111' xml:id='l2h-111' class="member">expecting_100</tt></b></dt> <dd> Boolean. Is client waiting for a 100 (<tt class="constant">HTTP_CONTINUE</tt>) response. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-112' xml:id='l2h-112' class="member">headers_in</tt></b></dt> <dd> A table object containing headers sent by the client. </dl> <P> <dl><dt><b><tt id='l2h-113' xml:id='l2h-113' class="member">headers_out</tt></b></dt> <dd> A <code>table</code> object representing the headers to be sent to the client. </dl> <P> <dl><dt><b><tt id='l2h-114' xml:id='l2h-114' class="member">err_headers_out</tt></b></dt> <dd> These headers get send with the error response, instead of headers_out. </dl> <P> <dl><dt><b><tt id='l2h-115' xml:id='l2h-115' class="member">subprocess_env</tt></b></dt> <dd> A <code>table</code> object containing environment information typically usable for CGI. You may have to call <tt class="member">req.add_common_vars()</tt> first to fill in the information you need. </dl> <P> <dl><dt><b><tt id='l2h-116' xml:id='l2h-116' class="member">notes</tt></b></dt> <dd> A <code>table</code> object that could be used to store miscellaneous general purpose info that lives for as long as the request lives. If you need to pass data between handlers, it's better to simply add members to the request object than to use <tt class="member">notes</tt>. </dl> <P> <dl><dt><b><tt id='l2h-117' xml:id='l2h-117' class="member">phase</tt></b></dt> <dd> The phase currently being being processed, e.g. "<tt class="samp">PythonHandler</tt>". <em>(Read-Only)</em> </dl> <P> <dl><dt><b><tt id='l2h-118' xml:id='l2h-118' class="member">interpreter</tt></b></dt> <dd> The name of the subinterpreter under which we're running. <em>(Read-Only)</em> </dl> <P> <dl><dt><b><tt id='l2h-119' xml:id='l2h-119' class="member">content_type</tt></b></dt> <dd> String. The content type. Mod_python maintains an internal flag (<tt class="member">req._content_type_set</tt>) to keep track of whether <tt class="member">content_type</tt> was set manually from within Python. The publisher handler uses this flag in the following way: when <tt class="member">content_type</tt> isn't explicitly set, it attempts to guess the content type by examining the first few bytes of the output. </dl> <P> <dl><dt><b><tt id='l2h-120' xml:id='l2h-120' class="member">content_languages</tt></b></dt> <dd> Tuple. List of strings representing the content languages. </dl> <P> <dl><dt><b><tt id='l2h-121' xml:id='l2h-121' class="member">handler</tt></b></dt> <dd> The symbolic name of the content handler (as in module, not mod_python handler) that will service the request during the response phase. When the SetHandler/AddHandler directives are used to trigger mod_python, this will be set to "<tt class="samp">mod_python</tt>" by mod_mime. A mod_python handler executing prior to the response phase may also set this to "<tt class="samp">mod_python</tt>" along with calling "<tt class="samp">req.add_handler()</tt>" to register a mod_python handler for the response phase. <P> <div class="verbatim"><pre> def typehandler(req): if os.path.splitext(req.filename)[1] == ".py": req.handler = "mod_python" req.add_handler("PythonHandler", "mod_python.publisher") return apache.OK return apache.DECLINED </pre></div> <P> </dl> <P> <dl><dt><b><tt id='l2h-122' xml:id='l2h-122' class="member">content_encoding</tt></b></dt> <dd> String. Content encoding. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-123' xml:id='l2h-123' class="member">vlist_validator</tt></b></dt> <dd> Integer. Variant list validator (if negotiated). <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-124' xml:id='l2h-124' class="member">user</tt></b></dt> <dd> If an authentication check is made, this will hold the user name. Same as CGI <a class="envvar" id='l2h-140' xml:id='l2h-140'>REMOTE_USER</a>. <div class="note"><b class="label">Note:</b> <tt class="method">req.get_basic_auth_pw()</tt> must be called prior to using this value. </div> </dl> <P> <dl><dt><b><tt id='l2h-125' xml:id='l2h-125' class="member">ap_auth_type</tt></b></dt> <dd> Authentication type. Same as CGI <a class="envvar" id='l2h-141' xml:id='l2h-141'>AUTH_TYPE</a>. </dl> <P> <dl><dt><b><tt id='l2h-126' xml:id='l2h-126' class="member">no_cache</tt></b></dt> <dd> Boolean. This response cannot be cached. </dl> <P> <dl><dt><b><tt id='l2h-127' xml:id='l2h-127' class="member">no_local_copy</tt></b></dt> <dd> Boolean. No local copy exists. </dl> <P> <dl><dt><b><tt id='l2h-128' xml:id='l2h-128' class="member">unparsed_uri</tt></b></dt> <dd> The URI without any parsing performed. <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-129' xml:id='l2h-129' class="member">uri</tt></b></dt> <dd> The path portion of the URI. </dl> <P> <dl><dt><b><tt id='l2h-130' xml:id='l2h-130' class="member">filename</tt></b></dt> <dd> String. File name being requested. </dl> <P> <dl><dt><b><tt id='l2h-131' xml:id='l2h-131' class="member">canonical_filename</tt></b></dt> <dd> String. The true filename (<tt class="member">req.filename</tt> is canonicalized if they don't match). </dl> <P> <dl><dt><b><tt id='l2h-132' xml:id='l2h-132' class="member">path_info</tt></b></dt> <dd> String. What follows after the file name, but is before query args, if anything. Same as CGI <a class="envvar" id='l2h-142' xml:id='l2h-142'>PATH_INFO</a>. </dl> <P> <dl><dt><b><tt id='l2h-133' xml:id='l2h-133' class="member">args</tt></b></dt> <dd> String. Same as CGI <a class="envvar" id='l2h-143' xml:id='l2h-143'>QUERY_ARGS</a>. </dl> <P> <dl><dt><b><tt id='l2h-134' xml:id='l2h-134' class="member">finfo</tt></b></dt> <dd> A file information object with type <code>mp_finfo</code>, analogous to the result of the POSIX stat function, describing the file pointed to by the URI. The object provides the attributes <code>fname</code>, <code>filetype</code>, <code>valid</code>, <code>protection</code>, <code>user</code>, <code>group</code>, <code>size</code>, <code>inode</code>, <code>device</code>, <code>nlink</code>, <code>atime</code>, <code>mtime</code>, <code>ctime</code> and <code>name</code>. <P> The attribute may be assigned to using the result of <code>apache.stat()</code>. For example: <P> <div class="verbatim"><pre> if req.finfo.filetype == apache.APR_DIR: req.filename = posixpath.join(req.filename, 'index.html') req.finfo = apache.stat(req.filename, apache.APR_FINFO_MIN) </pre></div> <P> For backward compatability, the object can also be accessed as if it were a tuple. The <code>apache</code> module defines a set of <tt class="constant">FINFO_*</tt> constants that should be used to access elements of this tuple. <P> <div class="verbatim"><pre> user = req.finfo[apache.FINFO_USER] </pre></div> </dl> <P> <dl><dt><b><tt id='l2h-135' xml:id='l2h-135' class="member">parsed_uri</tt></b></dt> <dd> Tuple. The URI broken down into pieces. <code>(scheme, hostinfo, user, password, hostname, port, path, query, fragment)</code>. The <code>apache</code> module defines a set of <tt class="constant">URI_*</tt> constants that should be used to access elements of this tuple. Example: <div class="verbatim"><pre> fname = req.parsed_uri[apache.URI_PATH] </pre></div> <em>(Read-Only</em>) </dl> <P> <dl><dt><b><tt id='l2h-136' xml:id='l2h-136' class="member">used_path_info</tt></b></dt> <dd> Flag to accept or reject path_info on current request. </dl> <P> <dl><dt><b><tt id='l2h-137' xml:id='l2h-137' class="member">eos_sent</tt></b></dt> <dd> Boolean. EOS bucket sent. <em>(Read-Only</em>) </dl> <P> <DIV CLASS="navigation"> <div class='online-navigation'> <p></p><hr /> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td class='online-navigation'><a rel="prev" title="4.5.4.1 Request Methods" href="pyapi-mprequest-meth.html"><img src='previous.png' border='0' height='32' alt='Previous Page' width='32' /></A></td> <td class='online-navigation'><a rel="parent" title="4.5.4 Request Object" href="pyapi-mprequest.html"><img src='up.png' border='0' height='32' alt='Up One Level' width='32' /></A></td> <td class='online-navigation'><a rel="next" title="4.5.5 Connection Object (mp_conn)" href="pyapi-mpconn.html"><img src='next.png' border='0' height='32' alt='Next Page' width='32' /></A></td> <td align="center" width="100%">Mod_python Manual</td> <td class='online-navigation'><a rel="contents" title="Table of Contents" href="contents.html"><img src='contents.png' border='0' height='32' alt='Contents' width='32' /></A></td> <td class='online-navigation'><img src='blank.png' border='0' height='32' alt='' width='32' /></td> <td class='online-navigation'><a rel="index" title="Index" href="genindex.html"><img src='index.png' border='0' height='32' alt='Index' width='32' /></A></td> </tr></table> <div class='online-navigation'> <b class="navlabel">Previous:</b> <a class="sectref" rel="prev" href="pyapi-mprequest-meth.html">4.5.4.1 Request Methods</A> <b class="navlabel">Up:</b> <a class="sectref" rel="parent" href="pyapi-mprequest.html">4.5.4 Request Object</A> <b class="navlabel">Next:</b> <a class="sectref" rel="next" href="pyapi-mpconn.html">4.5.5 Connection Object (mp_conn)</A> </div> </div> <hr /> <span class="release-info">Release 3.3.1, documentation updated on January 29, 2007.</span> </DIV> <!--End of Navigation Panel--> </BODY> </HTML>