Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 15533144ea879a3ee7f2cdcbb31e4859 > files > 112

apache-mod_python-doc-3.3.1-12mdv2010.0.i586.rpm

<!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="next" href="pyapi-mprequest-mem.html" />
<link rel="prev" href="pyapi-mprequest.html" />
<link rel="parent" href="pyapi-mprequest.html" />
<link rel="next" href="pyapi-mprequest-mem.html" />
<meta name='aesop' content='information' />
<title>4.5.4.1 Request Methods</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 Request Object"
  href="pyapi-mprequest.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.4.2 Request Members"
  href="pyapi-mprequest-mem.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.html">4.5.4 Request Object</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-mprequest-mem.html">4.5.4.2 Request Members</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->

<H3><A NAME="SECTION006541000000000000000"></A><A NAME="pyapi-mprequest-meth"></A>
<BR>
4.5.4.1 Request Methods
</H3>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-48' xml:id='l2h-48' class="method">add_common_vars</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Calls the Apache <tt class="cfunction">ap_add_common_vars()</tt> function. After a
  call to this method, <tt class="member">req.subprocess_env</tt> will contain a
  lot of CGI information.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-49' xml:id='l2h-49' class="method">add_handler</tt></b>(</nobr></td>
  <td><var>htype, handler</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>

<P>
Allows dynamic handler registration. <var>htype</var> is a string
  containing the name of any of the apache request (but not filter or
  connection) handler directives,
  e.g. "<tt class="samp">PythonHandler</tt>". <var>handler</var> is a string containing the
  name of the module and the handler function, or the callable object
  itself. Optional <var>dir</var> is a string containing the name of the
  directory to be added to the module search path when looking for the
  handler. If no directory is specified, then the directory to search
  in is inherited from the handler which is making the registration,

<P>
A handler added this way only persists throughout the life of the
  request. It is possible to register more handlers while inside the
  handler of the same type. One has to be careful as to not to create an
  infinite loop this way.

<P>
Dynamic handler registration is a useful technique that allows the
  code to dynamically decide what will happen next. A typical example
  might be a <code>PythonAuthenHandler</code> that will assign different
  <code>PythonHandlers</code> based on the authorization level, something
  like:

<P>
<div class="verbatim"><pre>
if manager:
    req.add_handler("PythonHandler", "menu::admin")
else:
    req.add_handler("PythonHandler", "menu::basic")
</pre></div>                              

<P>
<div class="note"><b class="label">Note:</b>
If you pass this function an invalid handler, an exception will be
    generated at the time an attempt is made to find the handler. 
  </div>

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-50' xml:id='l2h-50' class="method">add_input_filter</tt></b>(</nobr></td>
  <td><var>filter_name</var>)</td></tr></table></dt>
<dd>
  Adds the named filter into the input filter chain for the current request.
  The filter should be added before the first attempt to read any data from
  the request.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-51' xml:id='l2h-51' class="method">add_output_filter</tt></b>(</nobr></td>
  <td><var>filter_name</var>)</td></tr></table></dt>
<dd>
  Adds the named filter into the output filter chain for the current request.
  The filter should be added before the first attempt to write any data for
  the response.

<P>
Provided that all data written is being buffered and not flushed, this
  could be used to add the "CONTENT_LENGTH" filter into the chain of
  output filters. The purpose of the "CONTENT_LENGTH" filter is to add a
  <code>Content-Length:</code> header to the response.

<P>
<div class="verbatim"><pre>
    req.add_output_filter("CONTENT_LENGTH")
    req.write("content",0)
</pre></div>                              

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-52' xml:id='l2h-52' class="method">allow_methods</tt></b>(</nobr></td>
  <td><var>methods</var><big>[</big><var>, reset</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
  Adds methods to the <tt class="member">req.allowed_methods</tt> list. This list
  will be passed in <code>Allowed:</code> header if
  <tt class="constant">HTTP_METHOD_NOT_ALLOWED</tt> or <tt class="constant">HTTP_NOT_IMPLEMENTED</tt>
  is returned to the client. Note that Apache doesn't do anything to
  restrict the methods, this list is only used to construct the
  header. The actual method-restricting logic has to be provided in the
  handler code.

<P>
<var>methods</var> is a sequence of strings. If <var>reset</var> is 1, then
  the list of methods is first cleared.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-53' xml:id='l2h-53' class="method">auth_name</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns AuthName setting.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-54' xml:id='l2h-54' class="method">auth_type</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns AuthType setting.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-55' xml:id='l2h-55' class="method">construct_url</tt></b>(</nobr></td>
  <td><var>uri</var>)</td></tr></table></dt>
<dd>
  This function returns a fully qualified URI string from the path specified
  by uri, using the information stored in the request to determine the scheme,
  server name and port. The port number is not included in the string if it
  is the same as the default port 80.

<P>
For example, imagine that the current request is directed to the virtual
  server www.modpython.org at port 80. Then supplying "<tt class="samp">/index.html</tt>" will
  yield the string "<tt class="samp">http://www.modpython.org/index.html</tt>".

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-56' xml:id='l2h-56' class="method">discard_request_body</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Tests for and reads any message body in the request, simply discarding
  whatever it receives.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-57' xml:id='l2h-57' class="method">document_root</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns DocumentRoot setting.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-58' xml:id='l2h-58' class="method">get_basic_auth_pw</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns a string containing the password when Basic authentication is
  used.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-59' xml:id='l2h-59' class="method">get_config</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns a reference to the table object containing the mod_python
  configuration in effect for this request except for
  <code>Python*Handler</code> and <code>PythonOption</code> (The latter can be
  obtained via <tt class="method">req.get_options()</tt>. The table has directives as
  keys, and their values, if any, as values.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-60' xml:id='l2h-60' class="method">get_remote_host</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>type, str_is_ip</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>

<P>
This method is used to determine remote client's DNS name or IP
  number. The first call to this function may entail a DNS look up, but
  subsequent calls will use the cached result from the first call.

<P>
The optional <var>type</var> argument can specify the following: 

<P>

<UL>
<LI><code>apache.REMOTE_HOST</code> Look up the DNS name. Return None if Apache
    directive <code>HostNameLookups</code> is <code>off</code> or the hostname cannot
    be determined.

<P>
</LI>
<LI><code>apache.REMOTE_NAME</code> <em>(Default)</em> Return the DNS name if
    possible, or the IP (as a string in dotted decimal notation)
    otherwise.

<P>
</LI>
<LI><code>apache.REMOTE_NOLOOKUP</code> Don't perform a DNS lookup, return an
    IP. Note: if a lookup was performed prior to this call, then the
    cached host name is returned.

<P>
</LI>
<LI><code>apache.REMOTE_DOUBLE_REV</code> Force a double-reverse lookup. On 
    failure, return None.

<P>
</LI>
</UL>

<P>
If <var>str_is_ip</var> is <code>None</code> or unspecified, then the return
  value is a string representing the DNS name or IP address.

<P>
If the optional <var>str_is_ip</var> argument is not <code>None</code>, then the
  return value is an <code>(address, str_is_ip)</code> tuple, where <var>str_is_ip</var>
  is non-zero if <code>address</code> is an IP address string.

<P>
On failure, <code>None</code> is returned.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-61' xml:id='l2h-61' class="method">get_options</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns a reference to the table object containing the options set by
  the <code>PythonOption</code> directives.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-62' xml:id='l2h-62' class="method">internal_redirect</tt></b>(</nobr></td>
  <td><var>new_uri</var>)</td></tr></table></dt>
<dd>
  Internally redirects the request to the <var>new_uri</var>. <var>new_uri</var>
  must be a string.

<P>
The httpd server handles internal redirection by creating a new
  request object and processing all request phases. Within an internal
  redirect, <code>req.prev</code> will contain a reference to a request
  object from which it was redirected.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-63' xml:id='l2h-63' class="method">is_https</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Returns non-zero if the connection is using SSL/TLS. Will always return
  zero if the mod_ssl Apache module is not loaded.

<P>
You can use this method during any request phase, unlike looking for
  the <code>HTTPS</code> variable in the <code>subprocess_env</code> member dictionary.
  This makes it possible to write an authentication or access handler
  that makes decisions based upon whether SSL is being used.

<P>
Note that this method will not determine the quality of the
  encryption being used.  For that you should call the <code>ssl_var_lookup</code>
  method to get one of the <code>SSL_CIPHER*</code> variables.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-64' xml:id='l2h-64' class="method">log_error</tt></b>(</nobr></td>
  <td><var>message</var><big>[</big><var>, level</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
  An interface to the Apache <code>ap_log_rerror</code>
  function. <var>message</var> is a string with the error message,
  <var>level</var> is one of the following flags constants:

<P>
<div class="verbatim"><pre>
    APLOG_EMERG
    APLOG_ALERT
    APLOG_CRIT
    APLOG_ERR
    APLOG_WARNING
    APLOG_NOTICE
    APLOG_INFO
    APLOG_DEBUG
    APLOG_NOERRNO
</pre></div>            

<P>
If you need to write to log and do not have a reference to a request object,
  use the <tt class="function">apache.log_error</tt> function.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-65' xml:id='l2h-65' class="method">meets_conditions</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Calls the Apache <tt class="cfunction">ap_meets_conditions()</tt> function which returns
  a status code. If <var>status</var> is <tt class="constant">apache.OK</tt>, generate the
  content of the response normally. If not, simply return <var>status</var>.
  Note that <var>mtime</var> (and possibly the ETag header) should be set as
  appropriate prior to calling this function. The same goes for
  <tt class="member">req.status</tt> if the status differs from <tt class="constant">apache.OK</tt>.

<P>
Example:
  <div class="verbatim"><pre>
...
r.headers_out['ETag'] = '"1130794f-3774-4584-a4ea-0ab19e684268"'
r.headers_out['Expires'] = 'Mon, 18 Apr 2005 17:30:00 GMT'
r.update_mtime(1000000000)
r.set_last_modified()

status = r.meets_conditions()
if status != apache.OK:
  return status

... do expensive generation of the response content ...
</pre></div>

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-66' xml:id='l2h-66' class="method">requires</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>

<P>
Returns a tuple of strings of arguments to <code>require</code> directive.

<P>
For example, with the following apache configuration:
  <div class="verbatim"><pre>
AuthType Basic
require user joe
require valid-user
</pre></div>
  <tt class="method">requires()</tt> would return <code>('user joe', 'valid-user')</code>.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-67' xml:id='l2h-67' class="method">read</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>len</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>

<P>
Reads at most <var>len</var> bytes directly from the client, returning a
  string with the data read. If the <var>len</var> argument is negative or
  omitted, reads all data given by the client.

<P>
This function is affected by the <code>Timeout</code> Apache configuration
  directive. The read will be aborted and an <tt class="exception">IOError</tt>
  raised if the <code>Timeout</code> is reached while reading client data.

<P>
This function relies on the client providing the <code>Content-length</code>
  header. Absence of the <code>Content-length</code> header will be treated as
  if <code>Content-length: 0</code> was supplied.

<P>
Incorrect <code>Content-length</code> may cause the function to try to read
  more data than available, which will make the function block until a
  <code>Timeout</code> is reached.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-68' xml:id='l2h-68' class="method">readline</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>len</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
  Like <tt class="function">read()</tt> but reads until end of line. 

<P>
<div class="note"><b class="label">Note:</b>
In accordance with the HTTP specification, most clients will
    be terminating lines with "<tt class="samp">&#92;r&#92;n</tt>" rather
    than simply "<tt class="samp">&#92;n</tt>".
  </div>

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-69' xml:id='l2h-69' class="method">readlines</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>sizehint</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
  Reads all lines using <tt class="method">readline</tt> and returns a list of the lines read.
  If the optional <var>sizehint</var> parameter is given in, the method will read
  at least <var>sizehint</var> bytes of data, up to the completion of the line in
  which the <var>sizehint</var> bytes limit is reached.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-70' xml:id='l2h-70' class="method">register_cleanup</tt></b>(</nobr></td>
  <td><var>callable</var><big>[</big><var>, data</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>

<P>
Registers a cleanup. Argument <var>callable</var> can be any callable
  object, the optional argument <var>data</var> can be any object (default is
  <code>None</code>). At the very end of the request, just before the actual
  request record is destroyed by Apache, <var>callable</var> will be called
  with one argument, <var>data</var>.

<P>
It is OK to pass the request object as data, but keep in mind that
  when the cleanup is executed, the request processing is already
  complete, so doing things like writing to the client is completely
  pointless. 

<P>
If errors are encountered during cleanup processing, they should be in
  error log, but otherwise will not affect request processing in any
  way, which makes cleanup bugs sometimes hard to spot.

<P>
If the server is shut down before the cleanup had a chance to run,
  it's possible that it will not be executed.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-71' xml:id='l2h-71' class="method">register_input_filter</tt></b>(</nobr></td>
  <td><var>filter_name, filter</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>

<P>
Allows dynamic registration of mod_python input filters. <var>filter_name</var>
  is a string which would then subsequently be used to identify the filter.
  <var>filter</var> is a string containing the name of the module and the filter
  function or the callable object itself.  Optional <var>dir</var> is a string
  containing the name of the directory to be added to the module search when
  looking for the module.

<P>
The registration of the filter this way only persists for the life of the
  request. To actually add the filter into the chain of input filters for
  the current request <code>req.add_input_filter()</code> would be used.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-72' xml:id='l2h-72' class="method">register_output_filter</tt></b>(</nobr></td>
  <td><var>filter_name, filter</var><big>[</big><var>, dir</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>

<P>
Allows dynamic registration of mod_python output filters. <var>filter_name</var>
  is a string which would then subsequently be used to identify the filter.
  <var>filter</var> is a string containing the name of the module and the filter
  function or the callable object itself. Optional <var>dir</var> is a string
  containing the name of the directory to be added to the module search
  path when looking for the handler.

<P>
The registration of the filter this way only persists for the life of the
  request. To actually add the filter into the chain of output filters for
  the current request <code>req.add_output_filter()</code> would be used.

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-73' xml:id='l2h-73' class="method">sendfile</tt></b>(</nobr></td>
  <td><var>path</var><big>[</big><var>, offset, len</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
  Sends <var>len</var> bytes of file <var>path</var> directly to the client,
  starting at offset <var>offset</var> using the server's internal
  API. <var>offset</var> defaults to 0, and <var>len</var> defaults to -1 (send
  the entire file). 

<P>
Returns the number of bytes sent, or raises an IOError exception
  on failure.

<P>
This function provides the most efficient way to send a file to the
  client.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-74' xml:id='l2h-74' class="method">set_etag</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Sets the outgoing "<tt class="samp">ETag</tt>" header.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-75' xml:id='l2h-75' class="method">set_last_modified</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Sets the outgoing "<tt class="samp">Last-Modified</tt>" header based on value of
  <code>mtime</code> attribute.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-76' xml:id='l2h-76' class="method">ssl_var_lookup</tt></b>(</nobr></td>
  <td><var>var_name</var>)</td></tr></table></dt>
<dd>
  Looks up the value of the named SSL variable.  This method queries
  the mod_ssl Apache module directly, and may therefore be used in
  early request phases (unlike using the <code>subprocess_env</code> member.

<P>
If the mod_ssl Apache module is not loaded or the variable is not
  found then <code>None</code> is returned.

<P>
If you just want to know if a SSL or TLS connection is being used,
  you may consider calling the <code>is_https</code> method instead.

<P>
It is unfortunately not possible to get a list of all available
  variables with the current mod_ssl implementation, so you must know
  the name of the variable you want.  Some of the potentially useful
  ssl variables are listed below.  For a complete list of variables
  and a description of their values see the mod_ssl documentation.

<P>
<div class="verbatim"><pre>
    SSL_CIPHER
    SSL_CLIENT_CERT
    SSL_CLIENT_VERIFY
    SSL_PROTOCOL
    SSL_SESSION_ID
</pre></div>

<P>
<div class="note"><b class="label">Note:</b>
Not all SSL variables are defined or have useful values in every
  request phase.  Also use caution when relying on these values for
  security purposes, as SSL or TLS protocol parameters can often be
  renegotiated at any time during a request.
  </div>

<P>
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-77' xml:id='l2h-77' class="method">update_mtime</tt></b>(</nobr></td>
  <td><var>dependency_mtime</var>)</td></tr></table></dt>
<dd>
  If <var>dependency_mtime</var> is later than the value in the <code>mtime</code>
  attribute, sets the attribute to the new value.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-78' xml:id='l2h-78' class="method">write</tt></b>(</nobr></td>
  <td><var>string</var><big>[</big><var>, flush=1</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
  Writes <var>string</var> directly to the client, then flushes the buffer,
  unless flush is 0.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-79' xml:id='l2h-79' class="method">flush</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
  Flushes the output buffer.
</dl>

<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-80' xml:id='l2h-80' class="method">set_content_length</tt></b>(</nobr></td>
  <td><var>len</var>)</td></tr></table></dt>
<dd>
  Sets the value of <tt class="member">req.clength</tt> and the "<tt class="samp">Content-Length</tt>"  header to len. Note that after the headers have been sent out (which
  happens just before the first byte of the body is written,
  i.e. first call to <tt class="member">req.write()</tt>), calling the method is
  meaningless.
</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 Request Object"
  href="pyapi-mprequest.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.4.2 Request Members"
  href="pyapi-mprequest-mem.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.html">4.5.4 Request Object</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-mprequest-mem.html">4.5.4.2 Request Members</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>