/usr/lib/perl5/Apache2/Response.pm is in libapache2-mod-perl2 2.0.5-5ubuntu1.
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 | #
# /*
# * *********** WARNING **************
# * This file generated by ModPerl::WrapXS/0.01
# * Any changes made here will be lost
# * ***********************************
# * 01: lib/ModPerl/Code.pm:709
# * 02: lib/ModPerl/WrapXS.pm:626
# * 03: lib/ModPerl/WrapXS.pm:1175
# * 04: Makefile.PL:424
# * 05: Makefile.PL:326
# * 06: Makefile.PL:57
# */
#
package Apache2::Response;
use strict;
use warnings FATAL => 'all';
use Apache2::XSLoader ();
our $VERSION = '2.000005';
Apache2::XSLoader::load __PACKAGE__;
1;
__END__
=head1 NAME
Apache2::Response - Perl API for Apache HTTP request response methods
=head1 Synopsis
use Apache2::Response ();
$r->custom_response(Apache2::Const::FORBIDDEN, "No Entry today");
$etag = $r->make_etag($force_weak);
$r->set_etag();
$status = $r->meets_conditions();
$mtime_rat = $r->rationalize_mtime($mtime);
$r->set_last_modified($mtime);
$r->update_mtime($mtime);
$r->send_cgi_header($buffer);
$r->set_content_length($length);
$ret = $r->set_keepalive();
=head1 Description
C<Apache2::Response> provides the L<Apache request
object|docs::2.0::api::Apache2::RequestRec> utilities API for dealing
with HTTP response generation process.
=head1 API
C<Apache2::Response> provides the following functions and/or methods:
=head2 C<custom_response>
Install a custom response handler for a given status
$r->custom_response($status, $string);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$status> ( C<L<Apache2::Const
constant|docs::2.0::api::Apache2::Const>> )
The status for which the custom response should be used
(e.g. C<Apache2::Const::AUTH_REQUIRED>)
=item arg2: C<$string> (string)
The custom response to use. This can be a static string, or a URL,
full or just the uri path (I</foo/bar.txt>).
=item ret: no return value
=item since: 2.0.00
=back
C<custom_response()> doesn't alter the response code, but is used to
replace the standard response body. For example, here is how to change
the response body for the access handler failure:
package MyApache2::MyShop;
use Apache2::Response ();
use Apache2::Const -compile => qw(FORBIDDEN OK);
sub access {
my $r = shift;
if (MyApache2::MyShop::tired_squirrels()) {
$r->custom_response(Apache2::Const::FORBIDDEN,
"It's siesta time, please try later");
return Apache2::Const::FORBIDDEN;
}
return Apache2::Const::OK;
}
...
# httpd.conf
PerlModule MyApache2::MyShop
<Location /TestAPI__custom_response>
AuthName dummy
AuthType none
PerlAccessHandler MyApache2::MyShop::access
PerlResponseHandler MyApache2::MyShop::response
</Location>
When squirrels can't run any more, the handler will return 403, with
the custom message:
It's siesta time, please try later
=head2 C<make_etag>
Construct an entity tag from the resource information. If it's a real
file, build in some of the file characteristics.
$etag = $r->make_etag($force_weak);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$force_weak> (number)
Force the entity tag to be weak - it could be modified
again in as short an interval.
=item ret: C<$etag> (string)
The entity tag
=item since: 2.0.00
=back
=head2 C<meets_conditions>
Implements condition C<GET> rules for HTTP/1.1 specification. This
function inspects the client headers and determines if the response
fulfills the specified requirements.
$status = $r->meets_conditions();
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item ret: C<$status> ( C<L<Apache2::Const
status constant|docs::2.0::api::Apache2::Const>> )
C<Apache2::Const::OK> if the response fulfills the condition GET
rules. Otherwise some other status code (which should be returned to
Apache).
=item since: 2.0.00
=back
Refer to the L<Generating Correct HTTP
Headers|docs::general::correct_headers::correct_headers/> document
for an indepth discussion of this method.
=head2 C<rationalize_mtime>
Return the latest rational time from a request/mtime pair.
$mtime_rat = $r->rationalize_mtime($mtime);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$mtime> ( time in seconds )
The last modified time
=item ret: C<$mtime_rat> ( time in seconds )
the latest rational time from a request/mtime pair. Mtime is
returned unless it's in the future, in which case we return the
current time.
=item since: 2.0.00
=back
=head2 C<send_cgi_header>
Parse the header
$r->send_cgi_header($buffer);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
=item arg1: C<$buffer> (string)
headers and optionally a response body
=item ret: no return value
=item since: 2.0.00
=back
This method is really for back-compatibility with mod_perl 1.0. It's
very inefficient to send headers this way, because of the parsing
overhead.
If there is a response body following the headers it'll be handled too
(as if it was sent via
C<L<print()|docs::2.0::api::Apache2::RequestIO/C_print_>>).
Notice that if only HTTP headers are included they won't be sent until
some body is sent (again the "send" part is retained from the mod_perl
1.0 method).
=head2 C<set_content_length>
Set the content length for this request.
$r->set_content_length($length);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$length> (integer)
The new content length
=item ret: no return value
=item since: 2.0.00
=back
=head2 C<set_etag>
Set the E-tag outgoing header
$r->set_etag();
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
=item ret: no return value
=item since: 2.0.00
=back
=head2 C<set_keepalive>
Set the keepalive status for this request
$ret = $r->set_keepalive();
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item ret: C<$ret> ( boolean )
true if keepalive can be set, false otherwise
=item since: 2.0.00
=back
It's called by C<ap_http_header_filter()>. For the complete
complicated logic implemented by this method see
F<httpd-2.0/server/http_protocol.c>.
=head2 C<set_last_modified>
sets the C<Last-Modified> response header field to the value of the
mtime field in the request structure -- rationalized to keep it from
being in the future.
$r->set_last_modified($mtime);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
=item opt arg1: C<$mtime> ( time in seconds )
if the C<$mtime> argument is passed,
L<$r-E<gt>update_mtime|/C_update_mtime_> will be first run with that
argument.
=item ret: no return value
=item since: 2.0.00
=back
=head2 C<update_mtime>
Set the
C<L<$r-E<gt>mtime|docs::2.0::api::Apache2::RequestRec/C_mtime_>> field
to the specified value if it's later than what's already there.
$r->update_mtime($mtime);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$mtime> ( time in seconds )
=item ret: no return value
=item since: 2.0.00
=back
See also: L<$r-E<gt>set_last_modified|/C_set_last_modified_>.
=head1 Unsupported API
C<Apache2::Response> also provides auto-generated Perl interface for a
few other methods which aren't tested at the moment and therefore
their API is a subject to change. These methods will be finalized
later as a need arises. If you want to rely on any of the following
methods please contact the L<the mod_perl development mailing
list|maillist::dev> so we can help each other take the steps necessary
to shift the method to an officially supported API.
=head2 C<send_error_response>
Send an "error" response back to client. It is used for any response
that can be generated by the server from the request record. This
includes all 204 (no content), 3xx (redirect), 4xx (client error), and
5xx (server error) messages that have not been redirected to another
handler via the ErrorDocument feature.
$r->send_error_response($recursive_error);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$recursive_error> ( boolean )
the error status in case we get an error in the process of trying to
deal with an C<ErrorDocument> to handle some other error. In that
case, we print the default report for the first thing that went wrong,
and more briefly report on the problem with the C<ErrorDocument>.
=item ret: no return value
=item since: 2.0.00
=back
META: it's really an internal Apache method, I'm not quite sure how
can it be used externally.
=head2 C<send_mmap>
META: Autogenerated - needs to be reviewed/completed
Send an MMAP'ed file to the client
$ret = $r->send_mmap($mm, $offset, $length);
=over 4
=item obj: C<$r>
( C<L<Apache2::RequestRec object|docs::2.0::api::Apache2::RequestRec>> )
The current request
=item arg1: C<$mm> (C<L<APR::Mmap|docs::2.0::api::APR::Mmap>>)
The MMAP'ed file to send
=item arg2: C<$offset> (number)
The offset into the MMAP to start sending
=item arg3: C<$length> (integer)
The amount of data to send
=item ret: C<$ret> (integer)
The number of bytes sent
=item since: 2.0.00
=back
META: requires a working APR::Mmap, which is not supported at the
moment.
=head1 See Also
L<mod_perl 2.0 documentation|docs::2.0::index>.
=head1 Copyright
mod_perl 2.0 and its core modules are copyrighted under
The Apache Software License, Version 2.0.
=head1 Authors
L<The mod_perl development team and numerous
contributors|about::contributors::people>.
=cut
|