File-RsyBak
view release on metacpan or search on metacpan
script/rsybak view on Meta::CPAN
#use warnings;
#
#our $VERSION = '0.070';
#
#sub _croak { require Carp; Carp::croak(@_) }
#
#
#my @attributes;
#BEGIN {
# @attributes = qw(
# cookie_jar default_headers http_proxy https_proxy keep_alive
# local_address max_redirect max_size proxy no_proxy
# SSL_options verify_SSL
# );
# my %persist_ok = map {; $_ => 1 } qw(
# cookie_jar default_headers max_redirect max_size
# );
# no strict 'refs';
# no warnings 'uninitialized';
# for my $accessor ( @attributes ) {
# *{$accessor} = sub {
script/rsybak view on Meta::CPAN
# }
# return $self->{timeout};
#}
#
#sub new {
# my($class, %args) = @_;
#
# my $self = {
# max_redirect => 5,
# timeout => defined $args{timeout} ? $args{timeout} : 60,
# keep_alive => 1,
# verify_SSL => $args{verify_SSL} || $args{verify_ssl} || 0,
# no_proxy => $ENV{no_proxy},
# };
#
# bless $self, $class;
#
# $class->_validate_cookie_jar( $args{cookie_jar} ) if $args{cookie_jar};
#
# for my $key ( @attributes ) {
# $self->{$key} = $args{$key} if exists $args{$key}
script/rsybak view on Meta::CPAN
# my $known_message_length;
# if ($method eq 'HEAD' || $response->{status} =~ /^[23]04/) {
# $known_message_length = 1;
# }
# else {
# my $cb_args = @redir_args ? +{} : $args;
# my $data_cb = $self->_prepare_data_cb($response, $cb_args);
# $known_message_length = $handle->read_body($data_cb, $response);
# }
#
# if ( $self->{keep_alive}
# && $known_message_length
# && $response->{protocol} eq 'HTTP/1.1'
# && ($response->{headers}{connection} || '') ne 'close'
# ) {
# $self->{handle} = $handle;
# }
# else {
# $handle->close;
# }
#
script/rsybak view on Meta::CPAN
#}
#
#sub _open_handle {
# my ($self, $request, $scheme, $host, $port, $peer) = @_;
#
# my $handle = HTTP::Tiny::Handle->new(
# timeout => $self->{timeout},
# SSL_options => $self->{SSL_options},
# verify_SSL => $self->{verify_SSL},
# local_address => $self->{local_address},
# keep_alive => $self->{keep_alive}
# );
#
# if ($self->{_has_proxy}{$scheme} && ! grep { $host =~ /\Q$_\E$/ } @{$self->{no_proxy}}) {
# return $self->_proxy_connect( $request, $handle );
# }
# else {
# return $handle->connect($scheme, $host, $port, $peer);
# }
#}
#
script/rsybak view on Meta::CPAN
# }
# }
#
# if (exists $request->{headers}{'host'}) {
# die(qq/The 'Host' header must not be provided as header option\n/);
# }
#
# $request->{headers}{'host'} = $request->{host_port};
# $request->{headers}{'user-agent'} ||= $self->{agent};
# $request->{headers}{'connection'} = "close"
# unless $self->{keep_alive};
#
# if ( defined $args->{content} ) {
# if (ref $args->{content} eq 'CODE') {
# $request->{headers}{'content-type'} ||= "application/octet-stream";
# $request->{headers}{'transfer-encoding'} = 'chunked'
# unless $request->{headers}{'content-length'}
# || $request->{headers}{'transfer-encoding'};
# $request->{cb} = $args->{content};
# }
# elsif ( length $args->{content} ) {
script/rsybak view on Meta::CPAN
# $self->{local_address} ?
# ( LocalAddr => $self->{local_address} ) : (),
# Proto => 'tcp',
# Type => SOCK_STREAM,
# Timeout => $self->{timeout},
# ) or die(qq/Could not connect to '$host:$port': $@\n/);
#
# binmode($self->{fh})
# or die(qq/Could not binmode() socket: '$!'\n/);
#
# if ( $self->{keep_alive} ) {
# unless ( defined( $self->{fh}->setsockopt( SOL_SOCKET, SO_KEEPALIVE, 1 ) ) ) {
# CORE::close($self->{fh});
# die(qq/Could not set SO_KEEPALIVE on socket: '$!'\n/);
# }
# }
#
# $self->start_ssl($host) if $scheme eq 'https';
#
# $self->{scheme} = $scheme;
# $self->{host} = $host;
( run in 1.380 second using v1.01-cache-2.11-cpan-14f38c9f855 )