/usr/share/doc/python3-paste/docs/modules/httpheaders.html is in python3-paste 1.7.5.1-6ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>paste.httpheaders – Manipulate HTTP Headers — Paste 1.7.5.1 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.7.5.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="top" title="Paste 1.7.5.1 documentation" href="../index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Paste 1.7.5.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="paste-httpheaders-manipulate-http-headers">
<h1><a class="reference internal" href="#module-paste.httpheaders" title="paste.httpheaders"><tt class="xref py py-mod docutils literal"><span class="pre">paste.httpheaders</span></tt></a> – Manipulate HTTP Headers<a class="headerlink" href="#paste-httpheaders-manipulate-http-headers" title="Permalink to this headline">¶</a></h1>
<span class="target" id="module-paste.httpheaders"></span><p>HTTP Message Header Fields (see RFC 4229)</p>
<p>This contains general support for HTTP/1.1 message headers <a class="footnote-reference" href="#id4" id="id1">[1]</a> in a
manner that supports WSGI <tt class="docutils literal"><span class="pre">environ</span></tt> <a class="footnote-reference" href="#id5" id="id2">[2]</a> and <tt class="docutils literal"><span class="pre">response_headers</span></tt>
<a class="footnote-reference" href="#id6" id="id3">[3]</a>. Specifically, this module defines a <tt class="docutils literal"><span class="pre">HTTPHeader</span></tt> class whose
instances correspond to field-name items. The actual field-content for
the message-header is stored in the appropriate WSGI collection (either
the <tt class="docutils literal"><span class="pre">environ</span></tt> for requests, or <tt class="docutils literal"><span class="pre">response_headers</span></tt> for responses).</p>
<p>Each <tt class="docutils literal"><span class="pre">HTTPHeader</span></tt> instance is a callable (defining <tt class="docutils literal"><span class="pre">__call__</span></tt>)
that takes one of the following:</p>
<blockquote>
<div><ul class="simple">
<li>an <tt class="docutils literal"><span class="pre">environ</span></tt> dictionary, returning the corresponding header
value by according to the WSGI’s <tt class="docutils literal"><span class="pre">HTTP_</span></tt> prefix mechanism, e.g.,
<tt class="docutils literal"><span class="pre">USER_AGENT(environ)</span></tt> returns <tt class="docutils literal"><span class="pre">environ.get('HTTP_USER_AGENT')</span></tt></li>
<li>a <tt class="docutils literal"><span class="pre">response_headers</span></tt> list, giving a comma-delimited string for
each corresponding <tt class="docutils literal"><span class="pre">header_value</span></tt> tuple entries (see below).</li>
<li>a sequence of string <tt class="docutils literal"><span class="pre">*args</span></tt> that are comma-delimited into
a single string value: <tt class="docutils literal"><span class="pre">CONTENT_TYPE("text/html","text/plain")</span></tt>
returns <tt class="docutils literal"><span class="pre">"text/html,</span> <span class="pre">text/plain"</span></tt></li>
<li>a set of <tt class="docutils literal"><span class="pre">**kwargs</span></tt> keyword arguments that are used to create
a header value, in a manner dependent upon the particular header in
question (to make value construction easier and error-free):
<tt class="docutils literal"><span class="pre">CONTENT_DISPOSITION(max_age=CONTENT_DISPOSITION.ONEWEEK)</span></tt>
returns <tt class="docutils literal"><span class="pre">"public,</span> <span class="pre">max-age=60480"</span></tt></li>
</ul>
</div></blockquote>
<p>Each <tt class="docutils literal"><span class="pre">HTTPHeader</span></tt> instance also provides several methods to act on
a WSGI collection, for removing and setting header values.</p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">delete(collection)</span></tt></p>
<blockquote>
<div>This method removes all entries of the corresponding header from
the given collection (<tt class="docutils literal"><span class="pre">environ</span></tt> or <tt class="docutils literal"><span class="pre">response_headers</span></tt>), e.g.,
<tt class="docutils literal"><span class="pre">USER_AGENT.delete(environ)</span></tt> deletes the ‘HTTP_USER_AGENT’ entry
from the <tt class="docutils literal"><span class="pre">environ</span></tt>.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">update(collection,</span> <span class="pre">*args,</span> <span class="pre">**kwargs)</span></tt></p>
<blockquote>
<div><p>This method does an in-place replacement of the given header entry,
for example: <tt class="docutils literal"><span class="pre">CONTENT_LENGTH(response_headers,len(body))</span></tt></p>
<p>The first argument is a valid <tt class="docutils literal"><span class="pre">environ</span></tt> dictionary or
<tt class="docutils literal"><span class="pre">response_headers</span></tt> list; remaining arguments are passed on to
<tt class="docutils literal"><span class="pre">__call__(*args,</span> <span class="pre">**kwargs)</span></tt> for value construction.</p>
</div></blockquote>
<p><tt class="docutils literal"><span class="pre">apply(collection,</span> <span class="pre">**kwargs)</span></tt></p>
<blockquote>
<div>This method is similar to update, only that it may affect other
headers. For example, according to recommendations in RFC 2616,
certain Cache-Control configurations should also set the
<tt class="docutils literal"><span class="pre">Expires</span></tt> header for HTTP/1.0 clients. By default, <tt class="docutils literal"><span class="pre">apply()</span></tt>
is simply <tt class="docutils literal"><span class="pre">update()</span></tt> but limited to keyword arguments.</div></blockquote>
</div></blockquote>
<p>This particular approach to managing headers within a WSGI collection
has several advantages:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Typos in the header name are easily detected since they become a
<tt class="docutils literal"><span class="pre">NameError</span></tt> when executed. The approach of using header strings
directly can be problematic; for example, the following should
return <tt class="docutils literal"><span class="pre">None</span></tt> : <tt class="docutils literal"><span class="pre">environ.get("HTTP_ACCEPT_LANGUAGES")</span></tt></li>
<li>For specific headers with validation, using <tt class="docutils literal"><span class="pre">__call__</span></tt> will
result in an automatic header value check. For example, the
_ContentDisposition header will reject a value having <tt class="docutils literal"><span class="pre">maxage</span></tt>
or <tt class="docutils literal"><span class="pre">max_age</span></tt> (the appropriate parameter is <tt class="docutils literal"><span class="pre">max-age</span></tt> ).</li>
<li>When appending/replacing headers, the field-name has the suggested
RFC capitalization (e.g. <tt class="docutils literal"><span class="pre">Content-Type</span></tt> or <tt class="docutils literal"><span class="pre">ETag</span></tt>) for
user-agents that incorrectly use case-sensitive matches.</li>
<li>Some headers (such as <tt class="docutils literal"><span class="pre">Content-Type</span></tt>) are 0, that is,
only one entry of this type may occur in a given set of
<tt class="docutils literal"><span class="pre">response_headers</span></tt>. This module knows about those cases and
enforces this cardinality constraint.</li>
<li>The exact details of WSGI header management are abstracted so
the programmer need not worry about operational differences
between <tt class="docutils literal"><span class="pre">environ</span></tt> dictionary or <tt class="docutils literal"><span class="pre">response_headers</span></tt> list.</li>
<li>Sorting of <tt class="docutils literal"><span class="pre">HTTPHeaders</span></tt> is done following the RFC suggestion
that general-headers come first, followed by request and response
headers, and finishing with entity-headers.</li>
<li>Special care is given to exceptional cases such as Set-Cookie
which violates the RFC’s recommendation about combining header
content into a single entry using comma separation.</li>
</ol>
</div></blockquote>
<p>A particular difficulty with HTTP message headers is a categorization
of sorts as described in section 4.2:</p>
<blockquote>
<div>Multiple message-header fields with the same field-name MAY be
present in a message if and only if the entire field-value for
that header field is defined as a comma-separated list [i.e.,
#(values)]. It MUST be possible to combine the multiple header
fields into one “field-name: field-value” pair, without changing
the semantics of the message, by appending each subsequent
field-value to the first, each separated by a comma.</div></blockquote>
<p>This creates three fundamentally different kinds of headers:</p>
<blockquote>
<div><ul class="simple">
<li>Those that do not have a #(values) production, and hence are
singular and may only occur once in a set of response fields;
this case is handled by the <tt class="docutils literal"><span class="pre">_SingleValueHeader</span></tt> subclass.</li>
<li>Those which have the #(values) production and follow the
combining rule outlined above; our <tt class="docutils literal"><span class="pre">_MultiValueHeader</span></tt> case.</li>
<li>Those which are multi-valued, but cannot be combined (such as the
<tt class="docutils literal"><span class="pre">Set-Cookie</span></tt> header due to its <tt class="docutils literal"><span class="pre">Expires</span></tt> parameter); or where
combining them into a single header entry would cause common
user-agents to fail (<tt class="docutils literal"><span class="pre">WWW-Authenticate</span></tt>, <tt class="docutils literal"><span class="pre">Warning</span></tt>) since
they fail to handle dates even when properly quoted. This case
is handled by <tt class="docutils literal"><span class="pre">_MultiEntryHeader</span></tt>.</li>
</ul>
</div></blockquote>
<p>Since this project does not have time to provide rigorous support
and validation for all headers, it does a basic construction of
headers listed in RFC 2616 (plus a few others) so that they can
be obtained by simply doing <tt class="docutils literal"><span class="pre">from</span> <span class="pre">paste.httpheaders</span> <span class="pre">import</span> <span class="pre">*</span></tt>;
the name of the header instance is the “common name” less any
dashes to give CamelCase style names.</p>
<table class="docutils footnote" frame="void" id="id4" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2">http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id5" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id2">[2]</a></td><td><a class="reference external" href="http://www.python.org/peps/pep-0333.html#environ-variables">http://www.python.org/peps/pep-0333.html#environ-variables</a></td></tr>
</tbody>
</table>
<table class="docutils footnote" frame="void" id="id6" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id3">[3]</a></td><td><a class="reference external" href="http://www.python.org/peps/pep-0333.html#the-start-response-callable">http://www.python.org/peps/pep-0333.html#the-start-response-callable</a></td></tr>
</tbody>
</table>
<dl class="function">
<dt id="paste.httpheaders.get_header">
<tt class="descclassname">paste.httpheaders.</tt><tt class="descname">get_header</tt><big>(</big><em>name</em>, <em>raiseError=True</em><big>)</big><a class="headerlink" href="#paste.httpheaders.get_header" title="Permalink to this definition">¶</a></dt>
<dd><p>find the given <tt class="docutils literal"><span class="pre">HTTPHeader</span></tt> instance</p>
<p>This function finds the corresponding <tt class="docutils literal"><span class="pre">HTTPHeader</span></tt> for the
<tt class="docutils literal"><span class="pre">name</span></tt> provided. So that python-style names can be used,
underscores are converted to dashes before the lookup.</p>
</dd></dl>
<dl class="function">
<dt id="paste.httpheaders.list_headers">
<tt class="descclassname">paste.httpheaders.</tt><tt class="descname">list_headers</tt><big>(</big><em>general=None</em>, <em>request=None</em>, <em>response=None</em>, <em>entity=None</em><big>)</big><a class="headerlink" href="#paste.httpheaders.list_headers" title="Permalink to this definition">¶</a></dt>
<dd><p>list all headers for a given category</p>
</dd></dl>
<dl class="function">
<dt id="paste.httpheaders.normalize_headers">
<tt class="descclassname">paste.httpheaders.</tt><tt class="descname">normalize_headers</tt><big>(</big><em>response_headers</em>, <em>strict=True</em><big>)</big><a class="headerlink" href="#paste.httpheaders.normalize_headers" title="Permalink to this definition">¶</a></dt>
<dd><p>sort headers as suggested by RFC 2616</p>
<p>This alters the underlying response_headers to use the common
name for each header; as well as sorting them with general
headers first, followed by request/response headers, then
entity headers, and unknown headers last.</p>
</dd></dl>
<dl class="class">
<dt id="paste.httpheaders.HTTPHeader">
<em class="property">class </em><tt class="descclassname">paste.httpheaders.</tt><tt class="descname">HTTPHeader</tt><a class="headerlink" href="#paste.httpheaders.HTTPHeader" title="Permalink to this definition">¶</a></dt>
<dd><p>an HTTP header</p>
<p>HTTPHeader instances represent a particular <tt class="docutils literal"><span class="pre">field-name</span></tt> of an
HTTP message header. They do not hold a field-value, but instead
provide operations that work on is corresponding values. Storage
of the actual field values is done with WSGI <tt class="docutils literal"><span class="pre">environ</span></tt> or
<tt class="docutils literal"><span class="pre">response_headers</span></tt> as appropriate. Typically, a sub-classes that
represent a specific HTTP header, such as _ContentDisposition, are
0. Once constructed the HTTPHeader instances themselves
are immutable and stateless.</p>
<p>For purposes of documentation a “container” refers to either a
WSGI <tt class="docutils literal"><span class="pre">environ</span></tt> dictionary, or a <tt class="docutils literal"><span class="pre">response_headers</span></tt> list.</p>
<p>Member variables (and correspondingly constructor arguments).</p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">name</span></tt></p>
<blockquote>
<div>the <tt class="docutils literal"><span class="pre">field-name</span></tt> of the header, in “common form”
as presented in RFC 2616; e.g. ‘Content-Type’</div></blockquote>
<p><tt class="docutils literal"><span class="pre">category</span></tt></p>
<blockquote>
<div>one of ‘general’, ‘request’, ‘response’, or ‘entity’</div></blockquote>
<p><tt class="docutils literal"><span class="pre">version</span></tt></p>
<blockquote>
<div>version of HTTP (informational) with which the header should
be recognized</div></blockquote>
<p><tt class="docutils literal"><span class="pre">sort_order</span></tt></p>
<blockquote>
<div>sorting order to be applied before sorting on
field-name when ordering headers in a response</div></blockquote>
</div></blockquote>
<p>Special Methods:</p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">__call__</span></tt></p>
<blockquote>
<div>The primary method of the HTTPHeader instance is to make
it a callable, it takes either a collection, a string value,
or keyword arguments and attempts to find/construct a valid
field-value</div></blockquote>
<p><tt class="docutils literal"><span class="pre">__lt__</span></tt></p>
<blockquote>
<div>This method is used so that HTTPHeader objects can be
sorted in a manner suggested by RFC 2616.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">__str__</span></tt></p>
<blockquote>
<div>The string-value for instances of this class is
the <tt class="docutils literal"><span class="pre">field-name</span></tt>.</div></blockquote>
</div></blockquote>
<p>Primary Methods:</p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">delete()</span></tt></p>
<blockquote>
<div>remove the all occurrences (if any) of the given
header in the collection provided</div></blockquote>
<p><tt class="docutils literal"><span class="pre">update()</span></tt></p>
<blockquote>
<div>replaces (if they exist) all field-value items
in the given collection with the value provided</div></blockquote>
<p><tt class="docutils literal"><span class="pre">tuples()</span></tt></p>
<blockquote>
<div>returns a set of (field-name, field-value) tuples
5 for extending <tt class="docutils literal"><span class="pre">response_headers</span></tt></div></blockquote>
</div></blockquote>
<p>Custom Methods (these may not be implemented):</p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">apply()</span></tt></p>
<blockquote>
<div>similar to <tt class="docutils literal"><span class="pre">update</span></tt>, but with two differences; first,
only keyword arguments can be used, and second, specific
sub-classes may introduce side-effects</div></blockquote>
<p><tt class="docutils literal"><span class="pre">parse()</span></tt></p>
<blockquote>
<div>converts a string value of the header into a more usable
form, such as time in seconds for a date header, etc.</div></blockquote>
</div></blockquote>
<p>The collected versions of initialized header instances are immediately
registered and accessible through the <tt class="docutils literal"><span class="pre">get_header</span></tt> function. Do not
inherit from this directly, use one of <tt class="docutils literal"><span class="pre">_SingleValueHeader</span></tt>,
<tt class="docutils literal"><span class="pre">_MultiValueHeader</span></tt>, or <tt class="docutils literal"><span class="pre">_MultiEntryHeader</span></tt> as appropriate.</p>
<dl class="method">
<dt id="paste.httpheaders.HTTPHeader.apply">
<tt class="descname">apply</tt><big>(</big><em>collection</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#paste.httpheaders.HTTPHeader.apply" title="Permalink to this definition">¶</a></dt>
<dd><p>update the collection /w header value (may have side effects)</p>
<p>This method is similar to <tt class="docutils literal"><span class="pre">update</span></tt> only that usage may result
in other headers being changed as recommended by the corresponding
specification. The return value is defined by the particular
sub-class. For example, the <tt class="docutils literal"><span class="pre">_CacheControl.apply()</span></tt> sets the
<tt class="docutils literal"><span class="pre">Expires</span></tt> header in addition to its normal behavior.</p>
</dd></dl>
<dl class="method">
<dt id="paste.httpheaders.HTTPHeader.compose">
<tt class="descname">compose</tt><big>(</big><em>**kwargs</em><big>)</big><a class="headerlink" href="#paste.httpheaders.HTTPHeader.compose" title="Permalink to this definition">¶</a></dt>
<dd><p>build header value from keyword arguments</p>
<p>This method is used to build the corresponding header value when
keyword arguments (or no arguments) were provided. The result
should be a sequence of values. For example, the <tt class="docutils literal"><span class="pre">Expires</span></tt>
header takes a keyword argument <tt class="docutils literal"><span class="pre">time</span></tt> (e.g. time.time()) from
which it returns a the corresponding date.</p>
</dd></dl>
<dl class="method">
<dt id="paste.httpheaders.HTTPHeader.delete">
<tt class="descname">delete</tt><big>(</big><em>collection</em><big>)</big><a class="headerlink" href="#paste.httpheaders.HTTPHeader.delete" title="Permalink to this definition">¶</a></dt>
<dd><p>removes all occurances of the header from the collection provided</p>
</dd></dl>
<dl class="method">
<dt id="paste.httpheaders.HTTPHeader.parse">
<tt class="descname">parse</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#paste.httpheaders.HTTPHeader.parse" title="Permalink to this definition">¶</a></dt>
<dd><p>convert raw header value into more usable form</p>
<p>This method invokes <tt class="docutils literal"><span class="pre">values()</span></tt> with the arguments provided,
parses the header results, and then returns a header-specific
data structure corresponding to the header. For example, the
<tt class="docutils literal"><span class="pre">Expires</span></tt> header returns seconds (as returned by time.time())</p>
</dd></dl>
<dl class="method">
<dt id="paste.httpheaders.HTTPHeader.update">
<tt class="descname">update</tt><big>(</big><em>collection</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#paste.httpheaders.HTTPHeader.update" title="Permalink to this definition">¶</a></dt>
<dd><p>updates the collection with the provided header value</p>
<p>This method replaces (in-place when possible) all occurrences of
the given header with the provided value. If no value is
provided, this is the same as <tt class="docutils literal"><span class="pre">remove</span></tt> (note that this case
can only occur if the target is a collection w/o a corresponding
header value). The return value is the new header value (which
could be a list for <tt class="docutils literal"><span class="pre">_MultiEntryHeader</span></tt> instances).</p>
</dd></dl>
<dl class="method">
<dt id="paste.httpheaders.HTTPHeader.values">
<tt class="descname">values</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#paste.httpheaders.HTTPHeader.values" title="Permalink to this definition">¶</a></dt>
<dd><p>find/construct field-value(s) for the given header</p>
<p>Resolution is done according to the following arguments:</p>
<ul class="simple">
<li>If only keyword arguments are given, then this is equivalent
to <tt class="docutils literal"><span class="pre">compose(**kwargs)</span></tt>.</li>
<li>If the first (and only) argument is a dict, it is assumed
to be a WSGI <tt class="docutils literal"><span class="pre">environ</span></tt> and the result of the corresponding
<tt class="docutils literal"><span class="pre">HTTP_</span></tt> entry is returned.</li>
<li>If the first (and only) argument is a list, it is assumed
to be a WSGI <tt class="docutils literal"><span class="pre">response_headers</span></tt> and the field-value(s)
for this header are collected and returned.</li>
<li>In all other cases, the arguments are collected, checked that
they are string values, possibly verified by the header’s
logic, and returned.</li>
</ul>
<p>At this time it is an error to provide keyword arguments if args
is present (this might change). It is an error to provide both
a WSGI object and also string arguments. If no arguments are
provided, then <tt class="docutils literal"><span class="pre">compose()</span></tt> is called to provide a default
value for the header; if there is not default it is an error.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="paste.httpheaders.EnvironVariable">
<em class="property">class </em><tt class="descclassname">paste.httpheaders.</tt><tt class="descname">EnvironVariable</tt><a class="headerlink" href="#paste.httpheaders.EnvironVariable" title="Permalink to this definition">¶</a></dt>
<dd><p>a CGI <tt class="docutils literal"><span class="pre">environ</span></tt> variable as described by WSGI</p>
<p>This is a helper object so that standard WSGI <tt class="docutils literal"><span class="pre">environ</span></tt> variables
can be extracted w/o syntax error possibility.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/modules/httpheaders.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li><a href="../index.html">Paste 1.7.5.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008, Ian Bicking.
Last updated on Apr 11, 2014.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.2.
</div>
</body>
</html>
|