App-TLSMe

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        --daemonize       daemonize (--log_file is required)
        --pid_file        PID file

    When option "cert_file" is omitted default testing certificate is used.

DESCRIPTION
    TLS/SSL proxy in front of the application creates a transparent
    encryption tunnel.

HEADERS
    When using "http" protocol HTTP headers "X-Forwarded-For" and
    "X-Forwarded-Proto" are added to the requests with corresponding values.

bin/tlsme  view on Meta::CPAN


When option C<cert_file> is omitted default testing certificate is used.

=head1 DESCRIPTION

TLS/SSL proxy in front of the application creates a transparent encryption
tunnel.

=head1 HEADERS

When using C<http> protocol HTTP headers C<X-Forwarded-For> and
C<X-Forwarded-Proto> are added to the requests with corresponding values.

=cut

lib/App/TLSMe/Connection/http.pm  view on Meta::CPAN

package App::TLSMe::Connection::http;

use strict;
use warnings;

use base 'App::TLSMe::Connection';

sub _on_send_handler {
    my $self = shift;

    my $x_forwarded_for   = "X-Forwarded-For: $self->{peer_host}\x0d\x0a";
    my $x_forwarded_proto = "X-Forwarded-Proto: https\x0d\x0a";

    my $headers;
    return sub {
        my $handle = shift;

        if ($headers) {
            $self->{backend_handle}->push_write($handle->rbuf);
            $handle->{rbuf} = '';
        }

tlive/http-headers.t  view on Meta::CPAN


$handle->push_write(<<"EOF");
GET / HTTP/1.1

EOF

$tlsme->run;

$request =~ s/\r|\n//g;
is($request,
    'GET / HTTP/1.1X-Forwarded-For: 127.0.0.1X-Forwarded-Proto: https');

done_testing;



( run in 0.400 second using v1.01-cache-2.11-cpan-26ccb49234f )