File-RsyBak
view release on metacpan or search on metacpan
script/rsybak view on Meta::CPAN
# while ( my ($key, $value) = each %{$args->{headers} || {}} ) {
# $headers->{lc $key} = $value;
# }
# delete $args->{headers};
#
# return $self->request('POST', $url, {
# %$args,
# content => $self->www_form_urlencode($data),
# headers => {
# %$headers,
# 'content-type' => 'application/x-www-form-urlencoded'
# },
# }
# );
#}
#
#
#sub mirror {
# my ($self, $url, $file, $args) = @_;
# @_ == 3 || (@_ == 4 && ref $args eq 'HASH')
# or _croak(q/Usage: $http->mirror(URL, FILE, [HASHREF])/ . "\n");
script/rsybak view on Meta::CPAN
# }
#
# $e = "$e";
# $response = {
# url => $url,
# success => q{},
# status => 599,
# reason => 'Internal Exception',
# content => $e,
# headers => {
# 'content-type' => 'text/plain',
# 'content-length' => length $e,
# },
# ( @{$args->{_redirects} || []} ? (redirects => delete $args->{_redirects}) : () ),
# };
# }
# return $response;
#}
#
#
#sub www_form_urlencode {
script/rsybak view on Meta::CPAN
# 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} ) {
# my $content = $args->{content};
# if ( $] ge '5.008' ) {
# utf8::downgrade($content, 1)
# or die(qq/Wide character in request message body\n/);
# }
# $request->{headers}{'content-type'} ||= "application/octet-stream";
# $request->{headers}{'content-length'} = length $content
# unless $request->{headers}{'content-length'}
# || $request->{headers}{'transfer-encoding'};
# $request->{cb} = sub { substr $content, 0, length $content, '' };
# }
# $request->{trailer_cb} = $args->{trailer_callback}
# if ref $args->{trailer_callback} eq 'CODE';
# }
#
# if ( $self->{cookie_jar} ) {
script/rsybak view on Meta::CPAN
# require HTTP::Tiny::UNIX;
# $ht = HTTP::Tiny::UNIX->new;
# } else {
# require HTTP::Tiny;
# $ht = HTTP::Tiny->new;
# }
# my %headers = (
# "x-riap-v" => $self->{riap_version},
# "x-riap-action" => $action,
# "x-riap-fmt" => "json",
# "content-type" => "application/json",
# );
# my $args = $extra->{args} // {};
# for (keys %$extra) {
# next if /\Aargs\z/;
# $headers{"x-riap-$_"} = $extra->{$_};
# }
# my $htres = $ht->post(
# $url, {
# headers => \%headers,
# content => $json->encode($args),
# });
# return [500, "Network error: $htres->{status} - $htres->{reason}"]
# if $htres->{status} != 200;
# return [500, "Server error: didn't return JSON (".$htres->{headers}{'content-type'}.")"]
# unless $htres->{headers}{'content-type'} eq 'application/json';
# return [500, "Server error: didn't return Riap 1.1 response (".$htres->{headers}{'x-riap-v'}.")"]
# unless $htres->{headers}{'x-riap-v'} =~ /\A1\.1(\.\d+)?\z/;
# $res = $json->decode($htres->{content});
# } else {
# return [501, "Unsupported scheme or bad URL '$url'"];
# }
#
# strip_riap_stuffs_from_res($res);
#}
#
( run in 1.376 second using v1.01-cache-2.11-cpan-524268b4103 )