App-PureProxy

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

script/pureproxy.pl
t/010_version.t
xt/check_changes.t
xt/consistent_version_numbers.t
xt/copyright.t
xt/cover.pl
xt/cpan_changes.t
xt/cpan_meta.t
xt/dist_manifest.t
xt/distribution.t
xt/eol.t
xt/kwalitee.t
xt/minimumversion.t
xt/no_tabs.t
xt/perlcritic.t
xt/pod_spell.t
xt/pod_spellrc
xt/pod_syntax.t
xt/portability_files.t
xt/signature.t
Makefile.PL

README  view on Meta::CPAN

NAME

    pureproxy - Pure Perl HTTP proxy server

SYNOPSIS

        pureproxy --host=0.0.0.0 --port=5000 --workers=10 --server Starlight
    
        pureproxy --traffic-log=traffic.log --traffic-log-body-eol='|'
    
        pureproxy --access-log=access.log
    
        pureproxy --other-plackup-options
    
        pureproxy -v
    
        http_proxy=http://localhost:5000/ lwp-request -m get http://www.perl.org/
    
        https_proxy=http://localhost:5000/ lwp-request -m get https://metacpan.org/

README  view on Meta::CPAN

    Seconds until timeout. (default: 300)

 --traffic-log

    Enables Plack::Middleware::TrafficLog middleware that logs detailed
    information about headers and the body.

    If the filename is providen then middleware writes to this file.
    Standard output is used otherwise.

 --traffic-log-body-eol

    Sets the line separator for message's body for log generated by
    Plack::Middleware::TrafficLog middleware.

 --umask

    Changes file mode creation mask. The "umask" in perlfunc is an octal
    number representing disabled permissions bits for newly created files.
    It is usually 022 when a group shouldn't have permission to write or
    002 when a group should have permission to write. (default: none)

README.md  view on Meta::CPAN

## NAME

pureproxy - Pure Perl HTTP proxy server

## SYNOPSIS

```sh

    pureproxy --host=0.0.0.0 --port=5000 --workers=10 --server Starlight

    pureproxy --traffic-log=traffic.log --traffic-log-body-eol='|'

    pureproxy --access-log=access.log

    pureproxy --other-plackup-options

    pureproxy -v

    http_proxy=http://localhost:5000/ lwp-request -m get http://www.perl.org/

    https_proxy=http://localhost:5000/ lwp-request -m get https://metacpan.org/

README.md  view on Meta::CPAN

Seconds until timeout. (default: 300)

## --traffic-log

Enables [Plack::Middleware::TrafficLog](https://metacpan.org/pod/Plack%3A%3AMiddleware%3A%3ATrafficLog) middleware that logs detailed
information about headers and the body.

If the filename is providen then middleware writes to this file. Standard
output is used otherwise.

## --traffic-log-body-eol

Sets the line separator for message's body for log generated by
[Plack::Middleware::TrafficLog](https://metacpan.org/pod/Plack%3A%3AMiddleware%3A%3ATrafficLog) middleware.

## --umask

Changes file mode creation mask. The ["umask" in perlfunc](https://metacpan.org/pod/perlfunc#umask) is an octal number
representing disabled permissions bits for newly created files. It is usually
`022` when a group shouldn't have permission to write or `002` when a group
should have permission to write. (default: none)

lib/App/PureProxy.pm  view on Meta::CPAN

=head1 NAME

App::PureProxy - Pure Perl HTTP proxy server

=head1 SYNOPSIS

=for markdown ```sh

    pureproxy --host=0.0.0.0 --port=5000 --workers=10 --server Starlight

    pureproxy --traffic-log=traffic.log --traffic-log-body-eol='|'

    pureproxy --access-log=access.log

    pureproxy --other-plackup-options

    pureproxy -v

    http_proxy=http://localhost:5000/ lwp-request http://www.perl.org/

    https_proxy=http://localhost:5000/ lwp-request https://metacpan.org/

script/pureproxy.pl  view on Meta::CPAN

$runner->parse_options('--max-workers=50', @ARGV);

if ($runner->{help}) {
    require Pod::Usage;
    Pod::Usage::pod2usage(-verbose => 99, -sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS", -input => \*DATA);
}

my %options = @{ $runner->{options} };

if ($options{traffic_log}) {
    my $body_eol = $options{traffic_log_body_eol};
    if ($options{traffic_log} ne '1') {
        open my $logfh, ">>", $options{traffic_log} or die "open($options{traffic_log}): $!";
        $logfh->autoflush(1);
        $app = builder {
            enable 'TrafficLog',
                logger    => sub { $logfh->print(@_) },
                body_eol  => $body_eol,
                with_body => !!$body_eol;
            $app;
        };
    } else {
        $app = builder { enable 'TrafficLog', body_eol => $body_eol, with_body => !!$body_eol; $app; };
    }
}

if (not defined $runner->{access_log} or $runner->{access_log} eq '1') {
    $runner->{access_log} = undef;
    $app = builder { enable 'AccessLog'; $app; };
}

push @{ $runner->{options} }, 'server_software', _version();

script/pureproxy.pl  view on Meta::CPAN

=head1 NAME

pureproxy - Pure Perl HTTP proxy server

=head1 SYNOPSIS

=for markdown ```sh

    pureproxy --host=0.0.0.0 --port=5000 --workers=10 --server Starlight

    pureproxy --traffic-log=traffic.log --traffic-log-body-eol='|'

    pureproxy --access-log=access.log

    pureproxy --other-plackup-options

    pureproxy -v

    http_proxy=http://localhost:5000/ lwp-request -m get http://www.perl.org/

    https_proxy=http://localhost:5000/ lwp-request -m get https://metacpan.org/

script/pureproxy.pl  view on Meta::CPAN

Seconds until timeout. (default: 300)

=head2 --traffic-log

Enables L<Plack::Middleware::TrafficLog> middleware that logs detailed
information about headers and the body.

If the filename is providen then middleware writes to this file. Standard
output is used otherwise.

=head2 --traffic-log-body-eol

Sets the line separator for message's body for log generated by
L<Plack::Middleware::TrafficLog> middleware.

=head2 --umask

Changes file mode creation mask. The L<perlfunc/umask> is an octal number
representing disabled permissions bits for newly created files. It is usually
C<022> when a group shouldn't have permission to write or C<002> when a group
should have permission to write. (default: none)

xt/eol.t  view on Meta::CPAN


open my $fh, '<', 'MANIFEST' or die $!;
while ($_ = <$fh>) {
    chomp;
    s/\t.*//s;
    open my $fh2, '<', $_ or next;
    my $line = <$fh2>;
    close $fh2;
    next unless /\.(c|cc|cpp|md|pl|pm|psgi|sh|t|txt)$/i or $line =~ m{^#!.*\bperl};
    next if $_ eq 'fatpack/pureproxy';
    eol_unix_ok $_, "No incorrect line endings in '$_'", { trailing_whitespace => 1, all_reasons => 1 };
}
close $fh;

done_testing();



( run in 3.938 seconds using v1.01-cache-2.11-cpan-98e64b0badf )