Apache2-API

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

location of the pid file (default is C<$t_logs/httpd.pid>)

=head2 -t_state

the state/ test directory (default is C<$t_dir/state>)

=head2 -target

name of server binary (default is C<apxs -q TARGET>)

=head2 -thread_module_name

thread module name

=head2 -threadsperchild

number of threads per child when using threaded MPMs (default is C<10>)

=head2 -top_dir

top-level directory (default is C<$PWD>)

=head2 -user

User to run test server as (default is C<$USER>)

=cut

README  view on Meta::CPAN


    "-t_pid_file"
        location of the pid file (default is "$t_logs/httpd.pid")

    "-t_state"
        the state/ test directory (default is "$t_dir/state")

    "-target"
        name of server binary (default is "apxs -q TARGET")

    "-thread_module_name"
        thread module name

    "-threadsperchild"
        number of threads per child when using threaded MPMs (default is 10)

    "-top_dir"
        top-level directory (default is $PWD)

    "-user"
        User to run test server as (default is $USER)

    See also Apache::TestMM for available parameters or you can type on the
    command line:

README.md  view on Meta::CPAN

    location of the pid file (default is `$t_logs/httpd.pid`)

- `-t_state`

    the state/ test directory (default is `$t_dir/state`)

- `-target`

    name of server binary (default is `apxs -q TARGET`)

- `-thread_module_name`

    thread module name

- `-threadsperchild`

    number of threads per child when using threaded MPMs (default is `10`)

- `-top_dir`

    top-level directory (default is `$PWD`)

- `-user`

    User to run test server as (default is `$USER`)

See also [Apache::TestMM](https://metacpan.org/pod/Apache%3A%3ATestMM) for available parameters or you can type on the command line:

lib/Apache2/API.pm  view on Meta::CPAN

location of the pid file (default is C<$t_logs/httpd.pid>)

=item C<-t_state>

the state/ test directory (default is C<$t_dir/state>)

=item C<-target>

name of server binary (default is C<apxs -q TARGET>)

=item C<-thread_module_name>

thread module name

=item C<-threadsperchild>

number of threads per child when using threaded MPMs (default is C<10>)

=item C<-top_dir>

top-level directory (default is C<$PWD>)

=item C<-user>

User to run test server as (default is C<$USER>)

=back

lib/Apache2/API/Headers/AcceptCommon.pm  view on Meta::CPAN

=item * Legacy C<0.01> style: set the package variable C<Apache2::API::Headers::Accept::MATCH_PRIORITY_0_01_STYLE = 1> or C<Apache2::API::Headers::AcceptLanguage::MATCH_PRIORITY_0_01_STYLE = 1>. At each equal-C<q> bucket, the choice follows the I<ser...

=back

=head1 DIAGNOSTICS

This module registers warnings in category C<Apache2::API>. With debugging enabled (via L<Module::Generic>), you will see trace messages such as parsing steps and why a candidate was chosen.

=head1 THREAD SAFETY

All state is per object; no shared mutable globals. Thus, this module is safe to use in threads.

=head1 AUTHOR

Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>

=head1 SEE ALSO

L<Apache2::API::Headers::Accept>, L<Apache2::API::Headers::AcceptLanguage>, L<Module::Generic::HeaderValue>, RFC 7231, RFC 9110.

L<Apache2::API::DateTime>, L<Apache2::API::Query>, L<Apache2::API::Request>, L<Apache2::API::Request::Params>, L<Apache2::API::Request::Upload>, L<Apache2::API::Response>, L<Apache2::API::Status>

lib/Apache2/API/Password.pod  view on Meta::CPAN


    my $stored = '$apr1$hfT7jp2q$DcU1Hf5w2Q/9G8yqv1hbl.';
    my $ht     = Apache2::API::Password->new( $stored );
    if( $ht->matches( $input_password ) )
    {
        # ok
    }

=head1 THREAD SAFETY

This module keeps per-object state only (C<algo>, C<salt>, C<bcrypt_cost>, C<sha_rounds>, C<hash>) and uses no mutable global variables except precompiled regex constants. As such, it is I<re-entrant> and safe to use from multiple Perl L<ithreads|per...

For bcrypt/SHA-crypt, verification/generation prefers the system C<crypt(3)>; on modern libcs this is thread-safe. When the system lacks support, fallbacks are used:

=over 4

=item * L<Authen::Passphrase::BlowfishCrypt>, L<Crypt::Bcrypt>, L<Crypt::Eksblowfish::Bcrypt> (bcrypt)

=item * L<Crypt::Passwd::XS> (bcrypt and SHA-crypt)

=back

These libraries are widely used and do not expose shared mutable globals for the operations performed here; there are no known thread-safety issues in typical Perl ithread usage. If your deployment uses C<fork> rather than ithreads, objects are indep...

=head1 COMPATIBILITY

=over 4

=item * APR1 output is identical to C<htpasswd -m> and L<Crypt::PasswdMD5/apache_md5_crypt>.

=item * bcrypt output is compatible with C<htpasswd -B> (C<$2y$...>).

=item * SHA-crypt output is compatible with C<htpasswd -2> (C<$5$>) and C<-5> (C<$6$>).

lib/Apache2/API/Request.pm  view on Meta::CPAN

This is also an object initialisation property.

If true, this will discard the normal processing of incoming HTTP request under modperl.

This is useful and intended when testing this module offline.

=head2 child_terminate

Terminate the current worker process as soon as the current request is over, by calling L<Apache2::RequestRec/child_terminate>

This is not supported in threaded MPMs.

See L<Apache2::RequestUtil> for more information.

=head2 client_api_version

Returns the client api version requested, if provided. This is set during the object initialisation phase.

An example header to require api version C<1.0> would be:

    Accept: application/json; version=1.0; charset=utf-8

t/07.accept.t  view on Meta::CPAN

        local $Apache2::API::Headers::AcceptCommon::MATCH_PRIORITY_0_01_STYLE = 1;
        my $ac = Apache2::API::Headers::Accept->new( '*/*;q=0.8, application/json;q=0.8', debug => $DEBUG );
        is(
            $ac->match( [ 'application/json', 'text/html' ] ),
            'application/json',
            'Legacy mode: equal q with wildcard present still allows specific to win'
        );
    }
};

subtest 'threads' => sub
{
    SKIP:
    {
        if( !HAS_THREADS )
        {
            skip( 'Threads not available', 3 );
        }
        require threads;
        my @threads = map
        {
            threads->create(sub
            {
                my $tid = threads->tid();
                diag( "Thread $tid parsing 'Accept' header value" ) if( $DEBUG );
                my $accept = Apache2::API::Headers::Accept->new( 'text/html;q=0.9', debug => $DEBUG );
                if( !defined( $accept ) )
                {
                    diag( "Thread $tid failed to parse header: ", Apache2::API::Headers::Accept->error ) if( $DEBUG );
                    return(0);
                }
                return( is( $accept->match( ['text/html'] ), 'text/html', "Thread $_: match" ) ? 1 : 0 );
            });
        } 1..5;
        my $success = 1;
        for my $thr ( @threads )
        {
            $success &&= $thr->join;
        }
        ok( $success, 'All threads tests passed successfully' );
    };
};

done_testing();

__END__



( run in 0.874 second using v1.01-cache-2.11-cpan-39bf76dae61 )