Debian Codegraph @

docs/html/group__apreq__xs__apr__request__cookie.html

raw
1 <html>
2 <head>
3 <link rel="stylesheet" type="text/css" href="dox.css" />
4 <title>libapreq2-2.17: APR::Request::Cookie</title>
5 </head>
6 <body>
7 <div id="page-header">
8 <p class="menu">
9 <a href="http://www.apache.org/">Apache Software Foundation</a> &gt; <a href="http://httpd.apache.org">HTTP Server Project</a> &gt;
10 <a href="http://httpd.apache.org/apreq/">Request Library Subproject</a></p>
11 <p class="apache">Apache HTTP Server Request Library</p>
12 <img alt="" src="feather.gif" /></div>
13 <!-- Generated by Doxygen 1.9.1 -->
14 <script type="text/javascript" src="menudata.js"></script>
15 <script type="text/javascript" src="menu.js"></script>
16 <script type="text/javascript">
17 /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
18 $(function() {
19 initMenu('',false,false,'search.php','Search');
20 });
21 /* @license-end */</script>
22 <div id="main-nav"></div>
23 </div><!-- top -->
24 <div class="header">
25 <div class="headertitle">
26 <div class="title">APR::Request::Cookie<div class="ingroups"><a class="el" href="group__apreq__lang.html">Language Bindings</a> &raquo; <a class="el" href="group__apreq__xs.html">Perl</a></div></div> </div>
27 </div><!--header-->
28 <div class="contents">
29
30
31
32
33 <ul id="index">
34 <li><a href="#NAME">NAME</a></li>
35 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
36 <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
37 <li><a href="#OVERLOADS">OVERLOADS</a>
38 <ul>
39 <li><a href="#">&quot;&quot;</a></li>
40 </ul>
41 </li>
42 <li><a href="#METHODS">METHODS</a>
43 <ul>
44 <li><a href="#new">new</a></li>
45 <li><a href="#freeze">freeze</a></li>
46 <li><a href="#thaw">thaw</a></li>
47 <li><a href="#name">name</a></li>
48 <li><a href="#value">value</a></li>
49 <li><a href="#secure1">secure</a></li>
50 <li><a href="#httponly1">httponly</a></li>
51 <li><a href="#version1">version</a></li>
52 <li><a href="#path1">path</a></li>
53 <li><a href="#domain1">domain</a></li>
54 <li><a href="#port1">port</a></li>
55 <li><a href="#comment1">comment</a></li>
56 <li><a href="#commentURL1">commentURL</a></li>
57 <li><a href="#is_tainted">is_tainted</a></li>
58 <li><a href="#make">make</a></li>
59 <li><a href="#as_string">as_string</a></li>
60 </ul>
61 </li>
62 <li><a href="#SUBROUTINES">SUBROUTINES</a>
63 <ul>
64 <li><a href="#expires1">expires</a></li>
65 </ul>
66 </li>
67 <li><a href="#SEE-ALSO">SEE ALSO</a></li>
68 <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
69 </ul>
70
71 <h1 id="NAME">NAME</h1>
72
73 <p>APR::Request::Cookie - wrapper for libapreq2&#39;s cookie API.</p>
74
75 <h1 id="SYNOPSIS">SYNOPSIS</h1>
76
77 <pre><code>use APR::Request::Cookie;
78
79 # fetch inbound cookie
80 $jar = $req-&gt;jar;
81 $cookie1 = $jar-&gt;get(&quot;cookie1&quot;);
82
83 # generate new cookie
84 $cookie = APR::Request::Cookie-&gt;new($req-&gt;pool,
85 name =&gt; &quot;foo&quot;,
86 value =&gt; &quot;bar&quot;,
87 domain =&gt; &quot;capricorn.com&quot;);
88 print &quot;$cookie&quot;; # prints &quot;bar&quot;
89
90 $cookie-&gt;domain(&quot;example.com&quot;); # change domains
91 $cookie-&gt;version(1); # upgrade it to conform with RFC 2109/2965.
92
93 # send a response header
94 print sprintf &quot;Set-Cookie: %s\n&quot;, $cookie-&gt;as_string;</code></pre>
95
96 <h1 id="DESCRIPTION">DESCRIPTION</h1>
97
98 <p>The APR::Request::Cookie module provides base methods for interfacing with libapreq2&#39;s cookie API. It also provides a few utility functions and constants.</p>
99
100 <p>This manpage documents version 2.17 of the APR::Request::Cookie package.</p>
101
102 <h1 id="OVERLOADS">OVERLOADS</h1>
103
104 <p>APR::Request::Cookie</p>
105
106 <h2 id="">&quot;&quot;</h2>
107
108 <pre><code>&quot;$cookie&quot;</code></pre>
109
110 <p>The double-quote interpolation operator maps to <code>APR::Request::Cookie::value()</code>.</p>
111
112 <pre><code>ok &quot;$cookie&quot; eq $cookie-&gt;value;</code></pre>
113
114 <h1 id="METHODS">METHODS</h1>
115
116 <p>APR::Request::Cookie</p>
117
118 <h2 id="new">new</h2>
119
120 <pre><code>APR::Request::Cookie-&gt;new($pool,
121 name =&gt; $name,
122 value =&gt; $value,
123 %args)</code></pre>
124
125 <p>Creates a new cookie. Here <code>$pool</code> is an APR::Pool object, and <code>$name</code> is the cookie&#39;s name. The <code>$value</code> is transformed into the cookie&#39;s raw value through the class&#39; <code>freeze()</code> method. The remaining arguments are optional:</p>
126
127 <dl>
128
129 <dt id="secure">-secure</dt>
130 <dd>
131
132 </dd>
133 <dt id="httponly">-httponly</dt>
134 <dd>
135
136 </dd>
137 <dt id="version">-version</dt>
138 <dd>
139
140 </dd>
141 <dt id="path">-path</dt>
142 <dd>
143
144 </dd>
145 <dt id="domain">-domain</dt>
146 <dd>
147
148 </dd>
149 <dt id="port">-port</dt>
150 <dd>
151
152 </dd>
153 <dt id="expires">-expires</dt>
154 <dd>
155
156 </dd>
157 <dt id="comment">-comment</dt>
158 <dd>
159
160 </dd>
161 <dt id="commentURL">-commentURL</dt>
162 <dd>
163
164 </dd>
165 </dl>
166
167 <p>For details on these arguments, please consult the corresponding method&#39;s documentation.</p>
168
169 <h2 id="freeze">freeze</h2>
170
171 <pre><code>APR::Request::Cookie-&gt;freeze($value)</code></pre>
172
173 <p>Class method representing the default serializer; here it returns $value unmodified.</p>
174
175 <pre><code>ok &quot;foo&quot; eq APR::Request::Cookie-&gt;freeze(&quot;foo&quot;);</code></pre>
176
177 <h2 id="thaw">thaw</h2>
178
179 <pre><code>$cookie-&gt;thaw()</code></pre>
180
181 <p>Reverses <code>freeze()</code>; here it simply returns $cookie-&gt;value since freeze() is a noop.</p>
182
183 <pre><code>ok $cookie-&gt;thaw eq $cookie-&gt;value;</code></pre>
184
185 <h2 id="name">name</h2>
186
187 <pre><code>$cookie-&gt;name()</code></pre>
188
189 <p>Fetch the cookie&#39;s name. This attribute cannot be modified and is never serialized; ie freeze() and thaw() do not act on the cookie&#39;s name.</p>
190
191 <h2 id="value">value</h2>
192
193 <pre><code>$cookie-&gt;value()</code></pre>
194
195 <p>Fetch the cookie&#39;s raw (frozen) value. This attribute cannot be modified.</p>
196
197 <h2 id="secure1">secure</h2>
198
199 <pre><code>$cookie-&gt;secure()
200 $cookie-&gt;secure($set)</code></pre>
201
202 <p>Get/set the cookie&#39;s secure flag.</p>
203
204 <pre><code>$cookie-&gt;secure(1);
205 ok $cookie-&gt;secure == 1;</code></pre>
206
207 <h2 id="httponly1">httponly</h2>
208
209 <pre><code>$cookie-&gt;httponly()
210 $cookie-&gt;httponly($set)</code></pre>
211
212 <p>Get/set the cookie&#39;s HttpOnly flag.</p>
213
214 <pre><code>$cookie-&gt;httponly(1);
215 ok $cookie-&gt;httponly == 1;</code></pre>
216
217 <h2 id="version1">version</h2>
218
219 <pre><code>$cookie-&gt;version()
220 $cookie-&gt;version($set)</code></pre>
221
222 <p>Get/set the cookie&#39;s version number. Version 0 cookies conform to the Netscape spec; Version 1 cookies conform to either RFC 2109 or RFC 2965.</p>
223
224 <pre><code>$version = $cookie-&gt;version;
225 $cookie-&gt;version(1);
226 ok $cookie-&gt;version == 1;</code></pre>
227
228 <h2 id="path1">path</h2>
229
230 <pre><code>$cookie-&gt;path()
231 $cookie-&gt;path($set)</code></pre>
232
233 <p>Get/set the cookie&#39;s path string.</p>
234
235 <pre><code>$path = $cookie-&gt;path;
236 $cookie-&gt;path(&quot;/1/2/3/4&quot;);
237 ok $cookie-&gt;path eq &quot;/1/2/3/4&quot;;</code></pre>
238
239 <h2 id="domain1">domain</h2>
240
241 <pre><code>$cookie-&gt;domain()
242 $cookie-&gt;domain($set)</code></pre>
243
244 <p>Get/set the cookie&#39;s domain string.</p>
245
246 <pre><code>$domain = $cookie-&gt;domain;
247 $cookie-&gt;domain(&quot;apache.org&quot;);
248 ok $cookie-&gt;domain eq &quot;apache.org&quot;;</code></pre>
249
250 <h2 id="port1">port</h2>
251
252 <pre><code>$cookie-&gt;port()
253 $cookie-&gt;port($set)</code></pre>
254
255 <p>Get/set the cookie&#39;s port string. Only valid for Version 1 cookies.</p>
256
257 <pre><code>$port = $cookie-&gt;port;
258 $cookie-&gt;port(8888);
259 ok $cookie-&gt;port == 8888;</code></pre>
260
261 <h2 id="comment1">comment</h2>
262
263 <pre><code>$cookie-&gt;comment()
264 $cookie-&gt;comment($set)</code></pre>
265
266 <p>Get/set the cookie&#39;s comment string. Only valid for Version 1 cookies.</p>
267
268 <pre><code>$comment = $cookie-&gt;comment;
269 $cookie-&gt;comment(&quot;quux&quot;);
270 ok $cookie-&gt;comment eq &quot;quux&quot;;</code></pre>
271
272 <h2 id="commentURL1">commentURL</h2>
273
274 <pre><code>$cookie-&gt;commentURL()
275 $cookie-&gt;commentURL($set)</code></pre>
276
277 <p>Get/set the cookie&#39;s commentURL string. Only valid for Version 1 cookies.</p>
278
279 <pre><code>$commentURL = $cookie-&gt;commentURL;
280 $cookie-&gt;commentURL(&quot;/foo/bar&quot;);
281 ok $cookie-&gt;commentURL eq &quot;/foo/bar&quot;;</code></pre>
282
283 <h2 id="is_tainted">is_tainted</h2>
284
285 <pre><code>$cookie-&gt;is_tainted()
286 $cookie-&gt;is_tainted($set)</code></pre>
287
288 <p>Get/set the cookie&#39;s internal tainted flag.</p>
289
290 <pre><code>$tainted = $cookie-&gt;is_tainted;
291 $cookie-&gt;is_tainted(1);
292 ok $cookie-&gt;is_tainted == 1;</code></pre>
293
294 <h2 id="make">make</h2>
295
296 <pre><code>APR::Request::Cookie-&gt;make($pool, $name, $value)</code></pre>
297
298 <p>Fast XS cookie constructor invoked by <code>new()</code>. The cookie&#39;s raw name &amp; value are taken directly from the passed in arguments; no freezing/encoding is done on the $value.</p>
299
300 <h2 id="as_string">as_string</h2>
301
302 <pre><code>$cookie-&gt;as_string()</code></pre>
303
304 <p>String representation of the cookie, suitable for inclusion in a &quot;Set-Cookie&quot; header.</p>
305
306 <pre><code>print &quot;Set-Cookie: &quot;, $cookie-&gt;as_string, &quot;\n&quot;;</code></pre>
307
308 <h1 id="SUBROUTINES">SUBROUTINES</h1>
309
310 <pre><code>APR::Request::Cookie</code></pre>
311
312 <h2 id="expires1">expires</h2>
313
314 <pre><code>expires($date_string)</code></pre>
315
316 <h1 id="SEE-ALSO">SEE ALSO</h1>
317
318 <p><a>Apache2::Cookie</a>, <a>APR::Request</a>.</p>
319
320 <h1 id="COPYRIGHT">COPYRIGHT</h1>
321
322 <pre><code>Licensed to the Apache Software Foundation (ASF) under one or more
323 contributor license agreements. See the NOTICE file distributed with
324 this work for additional information regarding copyright ownership.
325 The ASF licenses this file to You under the Apache License, Version 2.0
326 (the &quot;License&quot;); you may not use this file except in compliance with
327 the License. You may obtain a copy of the License at
328
329 http://www.apache.org/licenses/LICENSE-2.0
330
331 Unless required by applicable law or agreed to in writing, software
332 distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
333 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334 See the License for the specific language governing permissions and
335 limitations under the License.</code></pre>
336
337
338 </div><!-- contents -->
339 <div id="footer">
340 <p class="apache">
341 Copyright &copy; 2003-2006 <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/>
342 See <a href="apreq_license.html">LICENSE</a>.</p>
343 <p class="menu">
344 <span style="color:#aaa">page generated by <a href="http://www.doxygen.org/"><code>doxygen</code></a>
345 version 1.9.1 on Thu Aug 18 2022</span>
346 </p>
347 </div>
348 </body>
349 </html>