/usr/share/doc/libapache2-mod-perl2-doc/docs/2.0/api/Apache2/RequestIO.html is in libapache2-mod-perl2-doc 2.0.9~1624218-2+deb8u2.
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 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | <?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<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="#API">API</a>
<ul>
<li><a href="#discard_request_body">discard_request_body</a></li>
<li><a href="#print">print</a></li>
<li><a href="#printf">printf</a></li>
<li><a href="#puts">puts</a></li>
<li><a href="#read">read</a></li>
<li><a href="#rflush">rflush</a></li>
<li><a href="#sendfile">sendfile</a></li>
<li><a href="#write">write</a></li>
</ul>
</li>
<li><a href="#TIE-Interface">TIE Interface</a>
<ul>
<li><a href="#BINMODE">BINMODE</a></li>
<li><a href="#CLOSE">CLOSE</a></li>
<li><a href="#FILENO">FILENO</a></li>
<li><a href="#GETC">GETC</a></li>
<li><a href="#OPEN">OPEN</a></li>
<li><a href="#PRINT">PRINT</a></li>
<li><a href="#PRINTF">PRINTF</a></li>
<li><a href="#READ">READ</a></li>
<li><a href="#TIEHANDLE">TIEHANDLE</a></li>
<li><a href="#UNTIE">UNTIE</a></li>
<li><a href="#WRITE">WRITE</a></li>
</ul>
</li>
<li><a href="#Deprecated-API">Deprecated API</a>
<ul>
<li><a href="#get_client_block">get_client_block</a></li>
<li><a href="#setup_client_block">setup_client_block</a></li>
<li><a href="#should_client_block">should_client_block</a></li>
</ul>
</li>
<li><a href="#See-Also">See Also</a></li>
<li><a href="#Copyright">Copyright</a></li>
<li><a href="#Authors">Authors</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Apache2::RequestIO - Perl API for Apache request record IO</p>
<h1 id="Synopsis">Synopsis</h1>
<pre><code> use Apache2::RequestIO ();
$rc = $r->discard_request_body();
$r->print("foo", "bar");
$r->puts("foo", "bar"); # same as print, but no flushing
$r->printf("%s $d", "foo", 5);
$r->read($buffer, $len);
$r->rflush();
$r->sendfile($filename);
$r->write("foobartarcar", 3, 5);</code></pre>
<h1 id="Description">Description</h1>
<p><code>Apache2::RequestIO</code> provides the API to perform IO on the <a>Apache request object</a>.</p>
<h1 id="API">API</h1>
<p><code>Apache2::RequestIO</code> provides the following functions and/or methods:</p>
<h2 id="discard_request_body"><code>discard_request_body</code></h2>
<p>In HTTP/1.1, any method can have a body. However, most GET handlers wouldn't know what to do with a request body if they received one. This helper routine tests for and reads any message body in the request, simply discarding whatever it receives. We need to do this because failing to read the request body would cause it to be interpreted as the next request on a persistent connection.</p>
<pre><code> $rc = $r->discard_request_body();</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
<p>The current request</p>
</dd>
<dt id="ret:-rc-integer">ret: <code>$rc</code> ( integer )</dt>
<dd>
<p><code><a>APR::Const status constant</a></code> if request is malformed, <code>Apache2::Const::OK</code> otherwise.</p>
</dd>
<dt id="since:-2.0.00">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>Since we return an error status if the request is malformed, this routine should be called at the beginning of a no-body handler, e.g.,</p>
<pre><code> use Apache2::Const -compile => qw(OK);
$rc = $r->discard_request_body;
return $rc if $rc != Apache2::Const::OK;</code></pre>
<h2 id="print"><code>print</code></h2>
<p>Send data to the client.</p>
<pre><code> $cnt = $r->print(@msg);</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object1">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-msg-ARRAY">arg1: <code>@msg</code> ( ARRAY )</dt>
<dd>
<p>Data to send</p>
</dd>
<dt id="ret:-cnt-number">ret: <code>$cnt</code> ( number )</dt>
<dd>
<p>How many bytes were sent (or buffered). If zero bytes were sent, <code>print</code> will return <code>0E0</code>, or "zero but true," which will still evaluate to <code>0</code> in a numerical context.</p>
</dd>
<dt id="excpt:-APR::Error">excpt: <code><a>APR::Error</a></code></dt>
<dd>
</dd>
<dt id="since:-2.0.001">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>The data is flushed only if STDOUT stream's <code>$|</code> is true. Otherwise it's buffered up to the size of the buffer, flushing only excessive data.</p>
<h2 id="printf"><code>printf</code></h2>
<p>Format and send data to the client (same as <code>printf</code>).</p>
<pre><code> $cnt = $r->printf($format, @args);</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object2">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-format-string">arg1: <code>$format</code> ( string )</dt>
<dd>
<p>Format string, as in the Perl core <code>printf</code> function.</p>
</dd>
<dt id="arg2:-args-ARRAY">arg2: <code>@args</code> ( ARRAY )</dt>
<dd>
<p>Arguments to be formatted, as in the Perl core <code>printf</code> function.</p>
</dd>
<dt id="ret:-cnt-number1">ret: <code>$cnt</code> ( number )</dt>
<dd>
<p>How many bytes were sent (or buffered)</p>
</dd>
<dt id="excpt:-APR::Error1">excpt: <code><a>APR::Error</a></code></dt>
<dd>
</dd>
<dt id="since:-2.0.002">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>The data is flushed only if STDOUT stream's <code>$|</code> is true. Otherwise it's buffered up to the size of the buffer, flushing only excessive data.</p>
<h2 id="puts"><code>puts</code></h2>
<p>Send data to the client</p>
<pre><code> $cnt = $r->puts(@msg);</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object3">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-msg-ARRAY1">arg1: <code>@msg</code> ( ARRAY )</dt>
<dd>
<p>Data to send</p>
</dd>
<dt id="ret:-cnt-number2">ret: <code>$cnt</code> ( number )</dt>
<dd>
<p>How many bytes were sent (or buffered)</p>
</dd>
<dt id="excpt:-APR::Error2">excpt: <code><a>APR::Error</a></code></dt>
<dd>
</dd>
<dt id="since:-2.0.003">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p><code>puts()</code> is similar to <code><a href="#C_print_">print()</a></code>, but it won't attempt to flush data, no matter what the value of STDOUT stream's <code>$|</code> is. Therefore assuming that STDOUT stream's <code>$|</code> is true, this method should be a tiny bit faster than <code><a href="#C_print_">print()</a></code>, especially if small strings are printed.</p>
<h2 id="read"><code>read</code></h2>
<p>Read data from the client.</p>
<pre><code> $cnt = $r->read($buffer, $len);
$cnt = $r->read($buffer, $len, $offset);</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object4">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-buffer-SCALAR">arg1: <code>$buffer</code> ( SCALAR )</dt>
<dd>
<p>The buffer to populate with the read data</p>
</dd>
<dt id="arg2:-len-number">arg2: <code>$len</code> ( number )</dt>
<dd>
<p>How many bytes to attempt to read</p>
</dd>
<dt id="opt-arg3:-offset-number">opt arg3: <code>$offset</code> ( number )</dt>
<dd>
<p>If a non-zero <code>$offset</code> is specified, the read data will be placed at that offset in the <code>$buffer</code>.</p>
<p>META: negative offset and \0 padding are not supported at the moment</p>
</dd>
<dt id="ret:-cnt-number3">ret: <code>$cnt</code> ( number )</dt>
<dd>
<p>How many characters were actually read</p>
</dd>
<dt id="excpt:-APR::Error3">excpt: <code><a>APR::Error</a></code></dt>
<dd>
</dd>
<dt id="since:-2.0.004">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>This method shares a lot of similarities with the Perl core <code>read()</code> function. The main difference in the error handling, which is done via <code><a>APR::Error exceptions</a></code></p>
<h2 id="rflush"><code>rflush</code></h2>
<p>Flush any buffered data to the client.</p>
<pre><code> $r->rflush();</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object5">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="ret:-no-return-value">ret: no return value</dt>
<dd>
</dd>
<dt id="since:-2.0.005">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>Unless STDOUT stream's <code>$|</code> is false, data sent via <code><a href="#C_print_">$r->print()</a></code> is buffered. This method flushes that data to the client.</p>
<h2 id="sendfile"><code>sendfile</code></h2>
<p>Send a file or a part of it</p>
<pre><code> $rc = $r->sendfile($filename);
$rc = $r->sendfile($filename, $offset);
$rc = $r->sendfile($filename, $offset, $len);</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object6">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-filename-string">arg1: <code>$filename</code> ( string )</dt>
<dd>
<p>The full path to the file (using <code>/</code> on all systems)</p>
</dd>
<dt id="opt-arg2:-offset-integer">opt arg2: <code>$offset</code> ( integer )</dt>
<dd>
<p>Offset into the file to start sending.</p>
<p>No offset is used if <code>$offset</code> is not specified.</p>
</dd>
<dt id="opt-arg3:-len-integer">opt arg3: <code>$len</code> ( integer )</dt>
<dd>
<p>How many bytes to send.</p>
<p>If not specified the whole file is sent (or a part of it, if <code>$offset</code> if specified)</p>
</dd>
<dt id="ret:-rc-APR::Const-status-constant">ret: <code>$rc</code> ( <code><a>APR::Const status constant</a></code> )</dt>
<dd>
<p>On success, <code><a>APR::Const::SUCCESS</a></code> is returned.</p>
<p>In case of a failure -- a failure code is returned, in which case normally it should be returned to the caller.</p>
</dd>
<dt id="excpt:-APR::Error4">excpt: <code><a>APR::Error</a></code></dt>
<dd>
<p>Exceptions are thrown only when this function is called in the VOID context. So if you don't want to handle the errors, just don't ask for a return value and the function will handle all the errors on its own.</p>
</dd>
<dt id="since:-2.0.006">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<h2 id="write"><code>write</code></h2>
<p>Send partial string to the client</p>
<pre><code> $cnt = $r->write($buffer);
$cnt = $r->write($buffer, $len);
$cnt = $r->write($buffer, $len, $offset);</code></pre>
<dl>
<dt id="obj:-r-Apache2::RequestRec-object7">obj: <code>$r</code> ( <code><a>Apache2::RequestRec object</a></code> )</dt>
<dd>
</dd>
<dt id="arg1:-buffer-SCALAR1">arg1: <code>$buffer</code> ( SCALAR )</dt>
<dd>
<p>The string with data</p>
</dd>
<dt id="opt-arg2:-len-SCALAR">opt arg2: <code>$len</code> ( SCALAR )</dt>
<dd>
<p>How many bytes to send. If not specified, or -1 is specified, all the data in <code>$buffer</code> (or starting from <code>$offset</code>) will be sent.</p>
</dd>
<dt id="opt-arg3:-offset-number1">opt arg3: <code>$offset</code> ( number )</dt>
<dd>
<p>Offset into the <code>$buffer</code> string.</p>
</dd>
<dt id="ret:-cnt-number4">ret: <code>$cnt</code> ( number )</dt>
<dd>
<p>How many bytes were sent (or buffered)</p>
</dd>
<dt id="excpt:-APR::Error5">excpt: <code><a>APR::Error</a></code></dt>
<dd>
</dd>
<dt id="since:-2.0.007">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>Examples:</p>
<p>Assuming that we have a string:</p>
<pre><code> $string = "123456789";</code></pre>
<p>Then:</p>
<pre><code> $r->write($string);</code></pre>
<p>sends:</p>
<pre><code> 123456789</code></pre>
<p>Whereas:</p>
<pre><code> $r->write($string, 3);</code></pre>
<p>sends:</p>
<pre><code> 123</code></pre>
<p>And:</p>
<pre><code> $r->write($string, 3, 5);</code></pre>
<p>sends:</p>
<pre><code> 678</code></pre>
<p>Finally:</p>
<pre><code> $r->write($string, -1, 5);</code></pre>
<p>sends:</p>
<pre><code> 6789</code></pre>
<h1 id="TIE-Interface">TIE Interface</h1>
<p>The TIE interface implementation. This interface is used for HTTP request handlers, when running under <code><a>SetHandler perl-script</a></code> and Perl doesn't have perlio enabled.</p>
<p>See the <i>perltie</i> manpage for more information.</p>
<h2 id="BINMODE"><code>BINMODE</code></h2>
<dl>
<dt id="since:-2.0.008">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>NoOP</p>
<p>See the <i>binmode</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="CLOSE"><code>CLOSE</code></h2>
<dl>
<dt id="since:-2.0.009">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>NoOP</p>
<p>See the <i>close</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="FILENO"><code>FILENO</code></h2>
<dl>
<dt id="since:-2.0.0010">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>fileno</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="GETC"><code>GETC</code></h2>
<dl>
<dt id="since:-2.0.0011">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>getc</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="OPEN"><code>OPEN</code></h2>
<dl>
<dt id="since:-2.0.0012">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>open</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="PRINT"><code>PRINT</code></h2>
<dl>
<dt id="since:-2.0.0013">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>print</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="PRINTF"><code>PRINTF</code></h2>
<dl>
<dt id="since:-2.0.0014">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>printf</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="READ"><code>READ</code></h2>
<dl>
<dt id="since:-2.0.0015">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>read</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="TIEHANDLE"><code>TIEHANDLE</code></h2>
<dl>
<dt id="since:-2.0.0016">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>tie</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="UNTIE"><code>UNTIE</code></h2>
<dl>
<dt id="since:-2.0.0017">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>NoOP</p>
<p>See the <i>untie</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h2 id="WRITE"><code>WRITE</code></h2>
<dl>
<dt id="since:-2.0.0018">since: 2.0.00</dt>
<dd>
</dd>
</dl>
<p>See the <i>write</i> Perl entry in the <i>perlfunc</i> manpage</p>
<h1 id="Deprecated-API">Deprecated API</h1>
<p>The following methods are deprecated, Apache plans to remove those in the future, therefore avoid using them.</p>
<h2 id="get_client_block"><code>get_client_block</code></h2>
<p>This method is deprecated since the C implementation is buggy and we don't want you to use it at all. Instead use the plain <code><a href="#C_read_">$r->read()</a></code>.</p>
<h2 id="setup_client_block"><code>setup_client_block</code></h2>
<p>This method is deprecated since <code><a href="#C__get_client_block_">$r->get_client_block</a></code> is deprecated.</p>
<h2 id="should_client_block"><code>should_client_block</code></h2>
<p>This method is deprecated since <code><a href="#C__get_client_block_">$r->get_client_block</a></code> is deprecated.</p>
<h1 id="See-Also">See Also</h1>
<p><a>mod_perl 2.0 documentation</a>.</p>
<h1 id="Copyright">Copyright</h1>
<p>mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.</p>
<h1 id="Authors">Authors</h1>
<p><a>The mod_perl development team and numerous contributors</a>.</p>
</body>
</html>
|