AxKit2
view release on metacpan or search on metacpan
lib/AxKit2/Constants.pm view on Meta::CPAN
my %return_codes = (
# HTTP Codes
OK => 200,
NO_CONTENT => 204,
PARTIAL_CONTENT => 206,
REDIRECT => 302,
NOT_MODIFIED => 304,
BAD_REQUEST => 400,
UNAUTHORIZED => 401,
FORBIDDEN => 403,
NOT_FOUND => 404,
SERVER_ERROR => 500,
NOT_IMPLEMENTED => 501,
SERVICE_UNAVAILABLE => 503,
# AxKit specific codes
DECLINED => 909,
DONE => 910,
CONTINUATION => 911,
);
lib/AxKit2/Constants.pm view on Meta::CPAN
=head1 HTTP RESPONSE CONSTANTS
OK => 200,
NO_CONTENT => 204,
PARTIAL_CONTENT => 206,
REDIRECT => 302,
NOT_MODIFIED => 304,
BAD_REQUEST => 400,
UNAUTHORIZED => 401,
FORBIDDEN => 403,
NOT_FOUND => 404,
SERVER_ERROR => 500,
NOT_IMPLEMENTED => 501,
SERVICE_UNAVAILABLE => 503,
=head1 LOGGING CONSTANTS
The following log level constants are also available:
LOGDEBUG => 7,
LOGINFO => 6,
lib/AxKit2/HTTPHeaders.pm view on Meta::CPAN
);
our $HTTPCode = {
200 => 'OK',
204 => 'No Content',
206 => 'Partial Content',
302 => 'Found',
304 => 'Not Modified',
400 => 'Bad request',
403 => 'Forbidden',
404 => 'Not Found',
416 => 'Request range not satisfiable',
500 => 'Internal Server Error',
501 => 'Not Implemented',
503 => 'Service Unavailable',
};
=head2 C<< CLASS->new( STRREF, IS_RESPONSE, IS_LAME ) >>
Construct a new header object from the given C<STRREF>. Assumes the header is
a response header if C<IS_RESPONSE> is set. Assumes C<HTTP/0.9> if C<IS_LAME> is
lib/AxKit2/Plugin.pm view on Meta::CPAN
=head2 response
Params: HEADERS
Main response phase. Used for sending normal responses to the client.
Return Value:
=over 4
=item * C<DECLINED> - Sends a 404 response to the browser.
=item * C<OK> or C<DONE> - Stops processing this request. Response has been
sent.
=item * Anything Else - send the appropriate error response to the browser.
=back
=head2 response_sent
Params: CODE
Called after the response has been sent to the browser. The parameter is the
response code used (e.g. 200 for OK, 404 for Not Found, etc).
The return codes for this hook are used to determine if the connection should
be kept open in a keep-alive request.
Return Value:
=over 4
=item * C<DECLINED/OK> - Use default keep-alive response depending on request
type.
t/10uri_to_file.t view on Meta::CPAN
use AxKit2::Test tests => 8;
start_server("t/server1",[qw(uri_to_file serve_file)],['DirectoryIndex index.html']);
content_is('/index.html','This is index.html', 'Basic path translation');
content_is('/','This is index.html', 'DirectoryIndex');
content_is('/index.html/foobar','This is index.html', 'path_info');
is_redirect('/foo','/foo/', 'directory redirect');
status_is('/index',404, 'nonexistant file');
status_is('/..',400, 'invalid URL');
status_is('/i..ndex',400, 'better-safe-than-sorry invalid URL');
status_is('/i.%2Endex',400, 'hidden invalid URL');
t/10uri_to_file_aio.t view on Meta::CPAN
plan tests => 8;
}
start_server("t/server1",[qw(aio/uri_to_file serve_file)],['DirectoryIndex index.html']);
content_is('/index.html','This is index.html', 'Basic path translation');
content_is('/','This is index.html', 'DirectoryIndex');
content_is('/index.html/foobar','This is index.html', 'path_info');
is_redirect('/foo','/foo/', 'directory redirect');
status_is('/index',404, 'nonexistant file');
status_is('/..',400, 'invalid URL');
status_is('/i..ndex',400, 'better-safe-than-sorry invalid URL');
status_is('/i.%2Endex',400, 'hidden invalid URL');
t/11typeless_uri.t view on Meta::CPAN
content_is('/','This is index.html', 'typeless DirectoryIndex');
content_is('/index/foo','This is index.html', 'typeless path_info');
is_redirect('/foo','/foo/', 'directory redirect');
content_is('/foo','This is foo/index.html', 'directory redirect plus DirectoryIndex');
no_redirect('/multi', 'no typeless directory redirect');
content_is('/multi','This is multi.html', 'typeless plus directory');
content_is('/multi/','This is multi/index.html', 'typeless plus DirectoryIndex');
status_is('/index.foo',404, 'nonexistant file');
status_is('/bar',404, 'nonexistant file');
( run in 0.693 second using v1.01-cache-2.11-cpan-39bf76dae61 )