Apache2-API

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "APR::Base64" : "0",
            "APR::Pool" : "0",
            "APR::Request::Apache2" : "0",
            "APR::Request::Cookie" : "0",
            "APR::Socket" : "0",
            "APR::UUID" : "0",
            "Apache2::Connection" : "0",
            "Apache2::Const" : "0",
            "Apache2::Log" : "0",
            "Apache2::Reload" : "0",
            "Apache2::Request" : "0",
            "Apache2::RequestIO" : "0",
            "Apache2::RequestRec" : "0",
            "Apache2::RequestUtil" : "0",
            "Apache2::Response" : "0",
            "Apache2::ServerUtil" : "0",
            "Apache2::SubRequest" : "0",
            "Apache::Test" : "0",
            "Cookie" : "v0.2.4",
            "DateTime" : "1.57",
            "DateTime::Format::Strptime" : "1.79",
            "DateTime::TimeZone" : "2.51",
            "DateTime::TimeZone::Catalog::Extend" : "v0.3.0",
            "Encode" : "3.01",
            "Exporter" : "5.70",
            "HTTP::AcceptLanguage" : "0.02",
            "JSON" : "4.03",
            "JSON::XS" : "4.03",
            "Module::Generic" : "v0.35.3",

META.yml  view on Meta::CPAN

  version: '1.4'
name: Apache2-API
no_index:
  directory:
    - t
    - inc
requires:
  APR::Base64: '0'
  APR::Pool: '0'
  APR::Request::Apache2: '0'
  APR::Request::Cookie: '0'
  APR::Socket: '0'
  APR::UUID: '0'
  Apache2::Connection: '0'
  Apache2::Const: '0'
  Apache2::Log: '0'
  Apache2::Reload: '0'
  Apache2::Request: '0'
  Apache2::RequestIO: '0'
  Apache2::RequestRec: '0'
  Apache2::RequestUtil: '0'
  Apache2::Response: '0'
  Apache2::ServerUtil: '0'
  Apache2::SubRequest: '0'
  Apache::Test: '0'
  Cookie: v0.2.4
  DateTime: '1.57'
  DateTime::Format::Strptime: '1.79'
  DateTime::TimeZone: '2.51'
  DateTime::TimeZone::Catalog::Extend: v0.3.0
  Encode: '3.01'
  Exporter: '5.70'
  HTTP::AcceptLanguage: '0.02'
  JSON: '4.03'
  JSON::XS: '4.03'
  Module::Generic: v0.35.3

Makefile.PL  view on Meta::CPAN

		'Apache2::Request'		=> 0,
		'Apache2::RequestIO'	=> 0,
		'Apache2::RequestRec'	=> 0,
		'Apache2::RequestUtil'	=> 0,
		'Apache2::Response'		=> 0,
		'Apache2::ServerUtil'	=> 0,
		'Apache2::SubRequest'	=> 0,
		'APR::Base64'			=> 0,
		'APR::Pool'				=> 0,
		'APR::Request::Apache2'	=> 0,
		'APR::Request::Cookie'	=> 0,
		'APR::Socket'			=> 0,
		'APR::UUID'				=> 0,
		'Cookie'                => 'v0.2.4',
        'DateTime'              => '1.57',
        'DateTime::Format::Strptime' => '1.79',
        'DateTime::TimeZone'    => '2.51',
        'DateTime::TimeZone::Catalog::Extend' => 'v0.3.0',
		# 'Devel::Confess'		=> 0,
        'Encode'                => '3.01',
        'Exporter'              => '5.70',
		'HTTP::AcceptLanguage'	=> '0.02',
        'JSON'                  => '4.03',
        'JSON::XS'              => '4.03',

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

    use Apache2::Request;
    use Apache2::RequestRec ();
    use Apache2::RequestUtil ();
    use Apache2::ServerUtil ();
    use Apache2::RequestIO ();
    use Apache2::Log;
    use APR::Pool ();
    use APR::Request ();
    use APR::Socket ();
    use APR::SockAddr ();
    use APR::Request::Cookie;
    use APR::Request::Apache2;
    # For subnet_of() method
    use APR::IpSubnet ();
    use Apache2::API::Request::Params;
    use Apache2::API::Request::Upload;
    use Apache2::API::DateTime;
    use Apache2::API::Query;
    use Apache2::API::Status;
    use Cookie::Jar;
    use DateTime;
    use Encode ();
    use File::Which ();
    use HTTP::AcceptLanguage;
    use JSON ();
    use Module::Generic::HeaderValue;
    use Scalar::Util;
    use URI;
    use URI::Escape;
    use Want;

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


sub content_type
{
    my $self = shift( @_ );
    my $ct = $self->headers( 'Content-Type' );
    return( $ct ) if( !scalar( @_ ) );
    $self->error( "Warning only: caller is trying to use ", ref( $self ), " to set the content-type. Use Apache2::API::Response for that instead." ) if( @_ );
    return( $self->request->content_type( @_ ) );
}

# To get individual cookie sent. See APR::Request::Cookie
# APR::Request::Cookie
# sub cookie { return( shift->cookies->get( @_ ) ); }
sub cookie
{
    my $self = shift( @_ );
    my $name = shift( @_ );
    # An erro has occurred if this is undef
    my $jar = $self->cookies || return( $self->pass_error );
    # Cookie::Jar might return undef if there was no match
    my $v = $jar->get( $name );
    return( $v ) unless( $v );
    return( $v->value );
}

# To get all cookies; then we can fetch then with $jar->get( 'this_cookie' ) for example
# sub cookies { return( shift->request->jar ); }
# https://grokbase.com/t/modperl/modperl/06c91r49n4/apache2-cookie-apr-request-cookie
# sub cookies { return( APR::Request::Apache2->handle( shift->request->pool )->jar ); }

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

# else {
# warn( "COOKIE ERROR: "
# . $req->jar_status . "\n"
# . Data::Dumper::Dumper( $self->r->headers_in() ) );
# }

sub cookies
{
    my $self = shift( @_ );
    return( $self->{_jar} ) if( $self->{_jar} );
    my $jar = Cookie::Jar->new( request => $self->request, debug => $self->debug ) ||
        return( $self->error( "An error occurred while trying to instantiate a new Cookie::Jar object: ", Cookie::Jar->error ) );
    $jar->fetch;
    $self->{_jar} = $jar;
    return( $jar );
}

sub data
{
    my $self = shift( @_ );
    return( $self->{data} ) if( $self->{_data_processed} );
    my $opts = $self->_get_args_as_hash( @_ );

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

    
    my $encoding = $req->content_encoding;
    
    my $langs_array_ref = $req->content_languages;
    
    my $len = $req->content_length;
    
    # text/plain
    my $ct = $req->content_type;
    
    # Get a Cookie object
    my $cookie = $req->cookie( $name );
    # Cookie::Jar object
    my $jar = $req->cookies;
    
    # get data string sent by client
    my $data = $req->data;
    
    my $formatter = $req->datetime;
    my $decoded = $req->decode( $string );
    
    my $do_not_track = $req->dnt;
    

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

See also L</type> to retrieve only the content type, i.e without other information such as charset.

See also L</client_api_version> which would contain the requested api version, if any.

See also L<charset> for the charset provided, if any. For example C<utf-8>

=head2 cookie

Returns the current value for the given cookie name, which may be C<undef> if nothing is found.

This works by calling the L</cookies> method, which returns a L<cookie jar object|Cookie::Jar>.

=head2 cookies

Returns a L<Cookie::Jar> object acting as a jar with various methods to access, manipulate and create cookies.

=head2 data

This method reads the data sent by the client. It takes an optional hash or hash reference of the following options:

=over 4

=item * C<max_size>

The maximum size of the data that can be transmitted to us over HTTP. By default, there is no limit.

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

=head2 err_headers_out

Get or sets HTTP response headers, which are printed out even on errors and persist across internal redirects.

According to the L<Apache2::RequestRec> documentation:

The difference between L</headers_out> (L<Apache2::RequestRec/headers_out>) and L</err_headers_out> (L<Apache2::RequestRec/err_headers_out>), is that the latter are printed even on error, and persist across internal redirects (so the headers printed ...

For example, if a handler wants to return a C<404> response, but nevertheless to set a cookie, it has to be:

    $req->err_headers_out->add( 'Set-Cookie' => $cookie );
    return( Apache2::Const::NOT_FOUND );

If the handler does:

    $req->headers_out->add( 'Set-Cookie' => $cookie );
    return( Apache2::Const::NOT_FOUND );

the C<Set-Cookie> header will not be sent.

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

=head2 filename

Get or sets the filename (full file path) on disk corresponding to this request or response, by calling L<Apache2::RequestRec/filename>

See L<Apache2::RequestRec/filename> for more information.

=head2 finfo

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

=head2 headers_as_json

Returns the list of headers as a json data, by retrieving the hash from L</headers_as_hashref> and encode it with L<JSON>

=head2 headers_in

Returns the list of the headers as special hash, which is actually an L<APR::Table> object.

If a header name is provided, you can retrieve its value like so:

    my $cookie = $req->headers_in->{Cookie} || '';

=head2 headers_out

This is identical to L</headers_in>, as it returns a L<APR::Table> object.

Returns or sets the key => value pairs of outgoing HTTP headers, only on 2xx responses.

See also L</err_headers_out>, which allows to set headers for non-2xx responses and persist across internal redirects.

More information at L<Apache2::RequestRec/headers_out>

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

    my @names = $req->body;
    my @vals = $req->body( 'field' );
    my $status = $req->body_status;

    $req->brigade_limit( 1024 );
    my $bucket = $req->bucket_alloc;

    # No upload please
    $req->disable_uploads( 1 );

    # Returns a APR::Request::Cookie::Table object
    my $jar = $req->jar;
    my $cookie = $req->jar( 'cookie_name' );
    my @all = $req->jar( 'cookie_name' );
    my $status = $req->jar_status;

    # Returns a APR::Request::Param::Table object
    my $object = $req->param;
    my $val = $req->param( 'first_name' );
    my @multi_choice_values = $req->param( 'multi_choice_field' );
    # Note that $self->request->param( 'multi_choice_field' ) would return an array reference

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

Returns the L<APR::BucketAlloc> object associated to this L<Apache2::RequestRec> handle.

=head2 disable_uploads boolean

Engage the disable_uploads hook for this request.

=for Pod::Coverage error

=head2 jar

With no arguments, this method returns a tied L<APR::Request::Cookie::Table> object (or undef if the "Cookie" header is absent) in scalar context, or the names (in order, with repetitions) of all the parsed cookies.

With the C<$key> argument, in scalar context this method fetches the first matching cookie. In list context it returns all matching cookies. The returned cookies are the values as they appeared in the incoming Cookie header.

This will trigger an L<APR::Request::Error> if L</jar_status> returned value is not zero.

    my $jar = $req->jar;
    my @cookie_names = $req->jar;
    if( $jar->isa( 'APR::Request::Cookie::Table' ) )
    {
        # ok then
    }
    ok shift( @cookie_names ) eq $_ for( keys( %$jar ) );

    my $cookie = $req->jar('apache');
    my @cookies = $req->jar('apache');

=head2 jar_status

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

    use parent qw( Module::Generic );
    use vars qw( $VERSION );
    use Apache2::Request;
    use Apache2::Const -compile => qw( :common :http );
    use Apache2::Log ();
    use Apache2::Response ();
    use Apache2::RequestIO ();
    use Apache2::RequestRec ();
    use Apache2::SubRequest ();
    use APR::Request ();
    # use APR::Request::Cookie;
    use Apache2::API::Status;
    use Cookie::Jar;
    use Scalar::Util;
    use URI::Escape ();
    our $VERSION = 'v0.1.2';
};

use strict;
use warnings;

sub init
{

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

sub content_security_policy_report_only { return( shift->_set_get_one( 'Content-Security-Policy-Report-Only', @_ ) ); }

# Apache content_type method is special. It does not just set the content type
sub content_type { return( shift->_try( '_request', 'content_type', @_ ) ); }
# sub content_type { return( shift->headers( 'Content-Type', @_ ) ); }

sub cookie_new
{
    my $self = shift( @_ );
    my $opts = $self->_get_args_as_hash( @_ );
    return( $self->error( "Cookie name was not provided." ) ) if( !$opts->{name} );
    # No value is ok to remove a cookie, but it needs to be an empty string, not undef
    # return( $self->error( "No value was provided for cookie \"$opts->{name}\"." ) ) if( !length( $opts->{value} ) && !defined( $opts->{value} ) );
    my $c = $self->request->cookies->make( $opts ) || return( $self->pass_error( $self->request->cookies->error ) );
    return( $c );
}

# Add or replace a cookie, but because the headers function of Apache2 is based on APR::Table
# there is no replace method, AND because the value of the headers is a string and not an object
# we have to crawl each already set cookie, parse them, compare them en replace them or add them
sub cookie_replace
{
    my $self = shift( @_ );
    my $cookie = shift( @_ ) || return( $self->error( "No cookie to add to outgoing headers was provided." ) );
    # Expecting an APR::Request::Cookie object
    return( $self->error( "Cookie provided (", ref( $cookie ), ") is not an object." ) ) if( !Scalar::Util::blessed( $cookie ) );
    return( $self->error( "Cookie object provided (", ref( $cookie ), ") does not seem to have an \"as_string\" method." ) ) if( !$cookie->can( 'as_string' ) );
    # We use err_headers_out() which makes it also possible to set cookies upon error (regular headers_out method cannot)
    my( @cookie_headers ) = $self->err_headers->get( 'Set-Cookie' );
    if( !scalar( @cookie_headers ) )
    {
        $self->err_headers->set( 'Set-Cookie' => $cookie->as_string );
    }
    else
    {
        my $jar = Cookie::Jar->new;
        # Check each cookie header set to see if ours is one of them
        my $found = 0;
        for( my $i = 0; $i < scalar( @cookie_headers ); $i++ )
        {
            my $c = $jar->extract_one( $cookie_headers[ $i ] ) || do
            {
                warn( "Error parsing cookie string '", $cookie_headers[ $i ], "': ", $jar->error, "\n" ) if( $self->_is_warnings_enabled( 'Apache2::API' ) );
                next;
            };
            
            if( $c->name eq $cookie->name )
            {
                $cookie_headers[ $i ] = $cookie->as_string;
                $found = 1;
            }
        }
        if( !$found )
        {
            $self->err_headers->add( 'Set-Cookie' => $cookie->as_string );
        }
        else
        {
            # Remove all Set-Cookie headers
            $self->err_headers->unset( 'Set-Cookie' );
            # Now, re-add our updated set
            foreach my $cookie_str ( @cookie_headers )
            {
                $self->err_headers->add( 'Set-Cookie' => $cookie_str );
            }
        }
    }
    return( $cookie );
}

sub cookie_set
{
    my $self = shift( @_ );
    my $cookie = shift( @_ ) || return( $self->error( "No cookie to add to outgoing headers was provided." ) );
    # Expecting an APR::Request::Cookie object
    return( $self->error( "Cookie provided (", ref( $cookie ), ") is not an object." ) ) if( !Scalar::Util::blessed( $cookie ) );
    return( $self->error( "Cookie object provided (", ref( $cookie ), ") does not seem to have an \"as_string\" method." ) ) if( !$cookie->can( 'as_string' ) );
    $self->err_headers->set( 'Set-Cookie' => $cookie->as_string );
    return( $cookie );
}

# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy>
sub cross_origin_embedder_policy { return( shift->_set_get_one( 'Cross-Origin-Embedder-Policy', @_ ) ); }

# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy>
sub cross_origin_opener_policy { return( shift->_set_get_one( 'Cross-Origin-Opener-Policy', @_ ) ); }

# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy>

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


# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server>
sub server { return( shift->_set_get_one( 'Server', @_ ) ); }

# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing>
sub server_timing { return( shift->_set_get_one( 'Server-Timing', @_ ) ); }

# e.g set_content_length( 1024 )
sub set_content_length { return( shift->_try( '_request', 'set_content_length', @_ ) ); }

# <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie>
sub set_cookie { return( shift->_set_get_one( 'Set-Cookie', @_ ) ); }

sub set_etag { return( shift->_try( '_request', 'set_etag', @_ ) ); }

sub set_keepalive { return( shift->_try( '_request', 'set_keepalive', @_ ) ); }

# <https://perl.apache.org/docs/2.0/api/Apache2/Response.html#toc_C_set_last_modified_>
sub set_last_modified { return( shift->_try( '_request', 'set_last_modified', @_ ) ); }

# Returns a APR::Socket
# See Apache2::Connection manual page

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

    # Retry-After
    my $retry_after = $resp->retry_after;
    $resp->rflush;
    $resp->send_cgi_header;
    $resp->sendfile( $filename, $offset, $len );
    $resp->sendfile( $filename );
    # Server
    my $server = $resp->server;
    my $server_timing = $resp->server_timing;
    $resp->set_content_length(1024);
    # Set-Cookie
    $resp->set_cookie( $cookie );
    $resp->set_last_modified;
    $resp->set_keepalive(1);
    my $socket = $resp->socket;
    my $sourcemap = $resp->sourcemap;
    my $status = $resp->status;
    my $status_line = $resp->status_line;
    # Strict-Transport-Security
    my $policy = $resp->strict_transport_security;
    # APR::Table object

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

For example, set the C<Content-type> header to C<text/plain>.

     $resp->content_type('text/plain');

If you set this header via the C<headers_out> table directly, it will be ignored by Apache. So do not do that.

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

=head2 cookie_new

Given a hash reference with the following properties, this will create a L<Cookie> object that can be stringified and aded into a C<Set-Cookie> HTTP header.

=over 4

=item C<name>

=item C<value>

=item C<domain>

=item C<expires>

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

=item C<max_age>

=item C<path>

=item C<secure>

=item C<same_site>

=back

See L<Cookie::Jar/make> and L<Cookie> for more information on those parameters.

=head2 cookie_replace

Given a cookie object, this either sets the given cookie in a C<Set-Cookie> header or replace the existing one with the same cookie name, if any.

It returns the cookie object provided.

=head2 cookie_set

Given a cookie object, this set the C<Set-Cookie> HTTP header for this cookie.

However, it does not check if another C<Set-Cookie> header exists for this cookie.

=head2 cross_origin_embedder_policy

Sets or gets the HTTP header field C<Cross-Origin-Embedder-Policy>

See L<https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy>

=head2 cross_origin_opener_policy

Sets or gets the HTTP header field C<Cross-Origin-Opener-Policy>

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

=head2 err_headers_out

Get or sets HTTP response headers, which are printed out even on errors and persist across internal redirects.

According to the L<Apache2::RequestRec> documentation:

The difference between L</headers_out> (L<Apache2::RequestRec/headers_out>) and L</err_headers_out> (L<Apache2::RequestRec/err_headers_out>), is that the latter are printed even on error, and persist across internal redirects (so the headers printed ...

For example, if a handler wants to return a C<404> response, but nevertheless to set a cookie, it has to be:

    $resp->err_headers_out->add( 'Set-Cookie' => $cookie );
    return( Apache2::Const::NOT_FOUND );

If the handler does:

    $resp->headers_out->add( 'Set-Cookie' => $cookie );
    return( Apache2::Const::NOT_FOUND );

the C<Set-Cookie> header will not be sent.

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

=head2 escape

Provided with a value and this will return it uri escaped by calling L<URI::Escape/uri_escape>.

=head2 etag

Sets or gets the HTTP header field C<Etag>

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

=head2 set_content_length

Set the content length for this request, by calling L<Apache2::Response/set_content_length>

    $resp->set_content_length( $length );

It does not return any value.

=head2 set_cookie

Sets or gets the HTTP header field C<Set-Cookie>

See L<https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie>

=head2 set_etag

    $resp->set_etag;

Set automatically the C<E-tag> outgoing header.

It does not return any value.

=head2 set_keepalive

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

    Connection: keep-alive
    Cache-Control: s-maxage=300, public, max-age=0
    Content-Language: en-US
    Date: Mon, 18 Apr 2022 17:37:18 GMT
    ETag: "2e77ad1dc6ab0b53a2996dfd4653c1c3"
    Server: Apache/2.4
    Strict-Transport-Security: max-age=63072000
    X-Content-Type-Options: nosniff
    X-Frame-Options: DENY
    X-XSS-Protection: 1; mode=block
    Vary: Accept-Encoding,Cookie
    Age: 7

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>A simple webpage</title>
    </head>
    <body>
      <h1>Simple HTML5 webpage</h1>

t/01.api.t  view on Meta::CPAN

        &simple_test({ target => 'request', name => $test, code => Apache2::Const::HTTP_OK });
    }
    
    my( $req, $resp );
    &simple_test({ target => 'request', name => 'args', code => Apache2::Const::HTTP_OK, query => 'foo=1&foo=2&bar=3&lang=ja_JP' });

    &simple_test({ target => 'request', name => 'auth', code => Apache2::Const::HTTP_OK, headers => [Authorization => "Bearer: $jwt"] });

    &simple_test({ target => 'request', name => 'body', code => Apache2::Const::HTTP_OK, headers => [Content_Type => "application/x-www-form-urlencoded"], body => q{a=a1&b=b1&b=b2&c=foo+&tengu=%E5%A4%A9%E7%8B%97}, http_method => 'post' });

    &simple_test({ target => 'request', name => 'cookie', code => Apache2::Const::HTTP_OK, headers => [Cookie => "my_session=foo"] });

my $data_body = <<EOT;
{
    "id": 123,
    "client_id": "37c58138-e259-44aa-9eee-baf3cbecca75"
}
EOT
    &simple_test({ target => 'request', name => 'data', code => Apache2::Const::HTTP_OK, headers => [Content_Type => 'application/json; charset=utf-8'], body => $data_body, http_method => 'post' });

    &simple_test({ target => 'request', name => 'param', code => Apache2::Const::HTTP_OK, query => 'foo=bar&lang=ja_JP' });

t/conf/extra.conf.in  view on Meta::CPAN

    SSLCertificateFile    @ServerRoot@/server.crt
    SSLCertificateKeyFile @ServerRoot@/server.key
</IfModule>
# See <https://httpd.apache.org/docs/2.4/en/mod/core.html#loglevel>
LogLevel debug
# where Apache2::API can be found
PerlSwitches -I@ServerRoot@/lib
PerlSwitches -I@ServerRoot@/../lib
PerlSwitches -I@ServerRoot@/..
# preload the module
PerlModule Cookie::Jar
PerlOptions +GlobalRequest
PerlSetupEnv On
PerlSetVar API_DEBUG 4
PerlPassEnv MOD_PERL
PerlPassEnv HOME
PerlPassEnv SERVER_NAME
PerlPassEnv HTTP_HOST
PerlPassEnv REMOTE_ADDR
PerlPassEnv REMOTE_HOST
PerlPassEnv PATH_INFO

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

sub auto_header { return( shift->_test({ method => 'auto_header', expect => 0, type => 'boolean' }) ); }

sub body { return( shift->_test({ method => 'body', expect => 'APR::Request::Param::Table', type => 'isa' }) ); }

sub charset { return( shift->_test({ method => 'charset', expect => 'utf-8' }) ); }

sub client_api_version { return( shift->_test({ method => 'client_api_version', expect => '1.0' }) ); }

sub connection { return( shift->_test({ method => 'connection', expect => 'Apache2::Connection', type => 'isa' }) ); }

# sub cookie { return( shift->_test({ method => 'cookie', expect => 'Cookie', type => 'isa', args => ['my_session'] }) ); }
sub cookie { return( shift->_test({ method => 'cookie', expect => 'foo', args => ['my_session'] }) ); }

my $sample_data = <<EOT;
{
    "id": 123,
    "client_id": "37c58138-e259-44aa-9eee-baf3cbecca75"
}
EOT
sub data { return( shift->_test({ method => 'data', expect => $sample_data }) ); }



( run in 0.457 second using v1.01-cache-2.11-cpan-e9199f4ba4c )