<commit_before>package TestVhost::config;

# Test whether under threaded mpms (and not) a vhost with 'PerlOptions
# +Parent', can run <Perl> sections, which call into config again via
# add_config().

use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;

use Apache::RequestUtil ();
use APR::Table ();

use File::Spec::Functions qw(canonpath catdir);

use Apache::Const -compile => 'OK';

# initialized in t/htdocs/vhost/post_config.pl
our $restart_count;

# using a different from 'handler' name on purpose, to make sure
# that the module is preloaded at the server startup
sub my_handler {
    my $r = shift;

    plan $r, tests => 2;

    {
        my $expected = $r->document_root;
        my $received = $r->dir_config->get('DocumentRootCheck');
        ok t_cmp(canonpath($received), canonpath($expected), "DocumentRoot");
    }
    
    {
        ok t_cmp($restart_count, 2, "PerlPostConfigRequire");
    }
    
    Apache::OK;
}

1;
__END__
<NoAutoConfig>
<VirtualHost TestVhost::config>
    DocumentRoot @documentroot@/vhost

    <IfDefine PERL_USEITHREADS>
        # a new interpreter pool
        PerlOptions +Parent
        PerlInterpStart         1
        PerlInterpMax           1
        PerlInterpMinSpare      1
        PerlInterpMaxSpare      1
    </IfDefine>

    # use test system's @INC
    PerlSwitches -I@serverroot@

    # mp2 modules
    PerlRequire "@serverroot@/conf/modperl_inc.pl"

    # private to this vhost stuff<commit_msg>whitespace--<commit_after>package TestVhost::config;

# Test whether under threaded mpms (and not) a vhost with 'PerlOptions
# +Parent', can run <Perl> sections, which call into config again via
# add_config().

use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;

use Apache::RequestUtil ();
use APR::Table ();

use File::Spec::Functions qw(canonpath catdir);

use Apache::Const -compile => 'OK';

# initialized in t/htdocs/vhost/post_config.pl
our $restart_count;

# using a different from 'handler' name on purpose, to make sure
# that the module is preloaded at the server startup
sub my_handler {
    my $r = shift;

    plan $r, tests => 2;

    {
        my $expected = $r->document_root;
        my $received = $r->dir_config->get('DocumentRootCheck');
        ok t_cmp(canonpath($received), canonpath($expected), "DocumentRoot");
    }

    {
        ok t_cmp($restart_count, 2, "PerlPostConfigRequire");
    }

    Apache::OK;
}

1;
__END__
<NoAutoConfig>
<VirtualHost TestVhost::config>
    DocumentRoot @documentroot@/vhost

    <IfDefine PERL_USEITHREADS>
        # a new interpreter pool
        PerlOptions +Parent
        PerlInterpStart         1
        PerlInterpMax           1
        PerlInterpMinSpare      1
        PerlInterpMaxSpare      1
    </IfDefine>

    # use test system's @INC
    PerlSwitches -I@serverroot@

    # mp2 modules
    PerlRequire "@serverroot@/conf/modperl_inc.pl"

    # private to this vhost stuff
{'fraction_non_alphanumeric': 0.10725126475548061, 'fraction_numerical': 0.005396290050590219, 'mean_word_length': 3.0797799174690508, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5875979', 'n_tokens_mistral': 986, 'n_tokens_neox': 947, 'n_words': 269}