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
|
<html>
<head>
<link rel="stylesheet" type="text/css" href="dox.css" />
<title>libapreq2-2.17: APR::Request::Cookie</title>
</head>
<body>
<div id="page-header">
<p class="menu">
<a href="http://www.apache.org/">Apache Software Foundation</a> > <a href="http://httpd.apache.org">HTTP Server Project</a> >
<a href="http://httpd.apache.org/apreq/">Request Library Subproject</a></p>
<p class="apache">Apache HTTP Server Request Library</p>
<img alt="" src="feather.gif" /></div>
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">APR::Request::Cookie<div class="ingroups"><a class="el" href="group__apreq__lang.html">Language Bindings</a> » <a class="el" href="group__apreq__xs.html">Perl</a></div></div> </div>
</div><!--header-->
<div class="contents">
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#OVERLOADS">OVERLOADS</a>
<ul>
<li><a href="#">""</a></li>
</ul>
</li>
<li><a href="#METHODS">METHODS</a>
<ul>
<li><a href="#new">new</a></li>
<li><a href="#freeze">freeze</a></li>
<li><a href="#thaw">thaw</a></li>
<li><a href="#name">name</a></li>
<li><a href="#value">value</a></li>
<li><a href="#secure1">secure</a></li>
<li><a href="#httponly1">httponly</a></li>
<li><a href="#version1">version</a></li>
<li><a href="#path1">path</a></li>
<li><a href="#domain1">domain</a></li>
<li><a href="#port1">port</a></li>
<li><a href="#comment1">comment</a></li>
<li><a href="#commentURL1">commentURL</a></li>
<li><a href="#is_tainted">is_tainted</a></li>
<li><a href="#make">make</a></li>
<li><a href="#as_string">as_string</a></li>
</ul>
</li>
<li><a href="#SUBROUTINES">SUBROUTINES</a>
<ul>
<li><a href="#expires1">expires</a></li>
</ul>
</li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
<li><a href="#COPYRIGHT">COPYRIGHT</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>APR::Request::Cookie - wrapper for libapreq2's cookie API.</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code>use APR::Request::Cookie;
# fetch inbound cookie
$jar = $req->jar;
$cookie1 = $jar->get("cookie1");
# generate new cookie
$cookie = APR::Request::Cookie->new($req->pool,
name => "foo",
value => "bar",
domain => "capricorn.com");
print "$cookie"; # prints "bar"
$cookie->domain("example.com"); # change domains
$cookie->version(1); # upgrade it to conform with RFC 2109/2965.
# send a response header
print sprintf "Set-Cookie: %s\n", $cookie->as_string;</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>The APR::Request::Cookie module provides base methods for interfacing with libapreq2's cookie API. It also provides a few utility functions and constants.</p>
<p>This manpage documents version 2.17 of the APR::Request::Cookie package.</p>
<h1 id="OVERLOADS">OVERLOADS</h1>
<p>APR::Request::Cookie</p>
<h2 id="">""</h2>
<pre><code>"$cookie"</code></pre>
<p>The double-quote interpolation operator maps to <code>APR::Request::Cookie::value()</code>.</p>
<pre><code>ok "$cookie" eq $cookie->value;</code></pre>
<h1 id="METHODS">METHODS</h1>
<p>APR::Request::Cookie</p>
<h2 id="new">new</h2>
<pre><code>APR::Request::Cookie->new($pool,
name => $name,
value => $value,
%args)</code></pre>
<p>Creates a new cookie. Here <code>$pool</code> is an APR::Pool object, and <code>$name</code> is the cookie's name. The <code>$value</code> is transformed into the cookie's raw value through the class' <code>freeze()</code> method. The remaining arguments are optional:</p>
<dl>
<dt id="secure">-secure</dt>
<dd>
</dd>
<dt id="httponly">-httponly</dt>
<dd>
</dd>
<dt id="version">-version</dt>
<dd>
</dd>
<dt id="path">-path</dt>
<dd>
</dd>
<dt id="domain">-domain</dt>
<dd>
</dd>
<dt id="port">-port</dt>
<dd>
</dd>
<dt id="expires">-expires</dt>
<dd>
</dd>
<dt id="comment">-comment</dt>
<dd>
</dd>
<dt id="commentURL">-commentURL</dt>
<dd>
</dd>
</dl>
<p>For details on these arguments, please consult the corresponding method's documentation.</p>
<h2 id="freeze">freeze</h2>
<pre><code>APR::Request::Cookie->freeze($value)</code></pre>
<p>Class method representing the default serializer; here it returns $value unmodified.</p>
<pre><code>ok "foo" eq APR::Request::Cookie->freeze("foo");</code></pre>
<h2 id="thaw">thaw</h2>
<pre><code>$cookie->thaw()</code></pre>
<p>Reverses <code>freeze()</code>; here it simply returns $cookie->value since freeze() is a noop.</p>
<pre><code>ok $cookie->thaw eq $cookie->value;</code></pre>
<h2 id="name">name</h2>
<pre><code>$cookie->name()</code></pre>
<p>Fetch the cookie's name. This attribute cannot be modified and is never serialized; ie freeze() and thaw() do not act on the cookie's name.</p>
<h2 id="value">value</h2>
<pre><code>$cookie->value()</code></pre>
<p>Fetch the cookie's raw (frozen) value. This attribute cannot be modified.</p>
<h2 id="secure1">secure</h2>
<pre><code>$cookie->secure()
$cookie->secure($set)</code></pre>
<p>Get/set the cookie's secure flag.</p>
<pre><code>$cookie->secure(1);
ok $cookie->secure == 1;</code></pre>
<h2 id="httponly1">httponly</h2>
<pre><code>$cookie->httponly()
$cookie->httponly($set)</code></pre>
<p>Get/set the cookie's HttpOnly flag.</p>
<pre><code>$cookie->httponly(1);
ok $cookie->httponly == 1;</code></pre>
<h2 id="version1">version</h2>
<pre><code>$cookie->version()
$cookie->version($set)</code></pre>
<p>Get/set the cookie's version number. Version 0 cookies conform to the Netscape spec; Version 1 cookies conform to either RFC 2109 or RFC 2965.</p>
<pre><code>$version = $cookie->version;
$cookie->version(1);
ok $cookie->version == 1;</code></pre>
<h2 id="path1">path</h2>
<pre><code>$cookie->path()
$cookie->path($set)</code></pre>
<p>Get/set the cookie's path string.</p>
<pre><code>$path = $cookie->path;
$cookie->path("/1/2/3/4");
ok $cookie->path eq "/1/2/3/4";</code></pre>
<h2 id="domain1">domain</h2>
<pre><code>$cookie->domain()
$cookie->domain($set)</code></pre>
<p>Get/set the cookie's domain string.</p>
<pre><code>$domain = $cookie->domain;
$cookie->domain("apache.org");
ok $cookie->domain eq "apache.org";</code></pre>
<h2 id="port1">port</h2>
<pre><code>$cookie->port()
$cookie->port($set)</code></pre>
<p>Get/set the cookie's port string. Only valid for Version 1 cookies.</p>
<pre><code>$port = $cookie->port;
$cookie->port(8888);
ok $cookie->port == 8888;</code></pre>
<h2 id="comment1">comment</h2>
<pre><code>$cookie->comment()
$cookie->comment($set)</code></pre>
<p>Get/set the cookie's comment string. Only valid for Version 1 cookies.</p>
<pre><code>$comment = $cookie->comment;
$cookie->comment("quux");
ok $cookie->comment eq "quux";</code></pre>
<h2 id="commentURL1">commentURL</h2>
<pre><code>$cookie->commentURL()
$cookie->commentURL($set)</code></pre>
<p>Get/set the cookie's commentURL string. Only valid for Version 1 cookies.</p>
<pre><code>$commentURL = $cookie->commentURL;
$cookie->commentURL("/foo/bar");
ok $cookie->commentURL eq "/foo/bar";</code></pre>
<h2 id="is_tainted">is_tainted</h2>
<pre><code>$cookie->is_tainted()
$cookie->is_tainted($set)</code></pre>
<p>Get/set the cookie's internal tainted flag.</p>
<pre><code>$tainted = $cookie->is_tainted;
$cookie->is_tainted(1);
ok $cookie->is_tainted == 1;</code></pre>
<h2 id="make">make</h2>
<pre><code>APR::Request::Cookie->make($pool, $name, $value)</code></pre>
<p>Fast XS cookie constructor invoked by <code>new()</code>. The cookie's raw name & value are taken directly from the passed in arguments; no freezing/encoding is done on the $value.</p>
<h2 id="as_string">as_string</h2>
<pre><code>$cookie->as_string()</code></pre>
<p>String representation of the cookie, suitable for inclusion in a "Set-Cookie" header.</p>
<pre><code>print "Set-Cookie: ", $cookie->as_string, "\n";</code></pre>
<h1 id="SUBROUTINES">SUBROUTINES</h1>
<pre><code>APR::Request::Cookie</code></pre>
<h2 id="expires1">expires</h2>
<pre><code>expires($date_string)</code></pre>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p><a>Apache2::Cookie</a>, <a>APR::Request</a>.</p>
<h1 id="COPYRIGHT">COPYRIGHT</h1>
<pre><code>Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.</code></pre>
</div><!-- contents -->
<div id="footer">
<p class="apache">
Copyright © 2003-2006 <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/>
See <a href="apreq_license.html">LICENSE</a>.</p>
<p class="menu">
<span style="color:#aaa">page generated by <a href="http://www.doxygen.org/"><code>doxygen</code></a>
version 1.9.1 on Thu Aug 18 2022</span>
</p>
</div>
</body>
</html>
|