HTTP-Request-FromCurl

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.05 2018-11-23
    * Fix -XPOST and other option-bundling commands

0.04 2018-11-20
    * Test stability, fix test count when skipping, no need to upgrade

0.03 2018-11-19
    * Fix prerequisite versions, C<< ->getoptionsfromarray() >> was introduced
      in Getopt::Long 2.39
    * Add support for --max-time
    * Add support for (ignored options) --(no-)keepalive and --(no-)buffer
    * Add support for (ignored option) --progress-bar , -#

0.02 2018-11-15
    * Support --compressed option
    * Run output through HTML::Tidy if it is installed
      Suggested by H Merijn Brand
    * Test stability RT #127642, thanks to SREZIC
    * Correct prerequisite versions RT 127644, thanks to SREZIC
    * Test stability against weirdo Curl user agents (CentOS6)
      reported by Slaven Rezic

lib/HTTP/Request/FromCurl.pm  view on Meta::CPAN

    'head|I',
    'header|H=s@',
    'include|i',         # ignored
    'interface=s',
    'insecure|k',
    'json=s@',
    'location|L',        # ignored, we always follow redirects
    'max-filesize=s',
    'max-time|m=s',
    'ntlm',
    'keepalive!',
    'range=s',
    'request|X=s',
    'oauth2-bearer=s',
    'output|o=s',
    'progress-bar|#',    # ignored
    'user|u=s',
    'next',                      # ignored
    'parallel|Z',                # ignored
    'parallel-immediate',        # ignored
    'parallel-max',              # ignored

lib/HTTP/Request/FromCurl.pm  view on Meta::CPAN

        if( defined( my $c = $options->{ cookie })) {
            if( $c =~ /=/ ) {
                $headers{ Cookie } = $options->{ 'cookie' };
            } else {
                $options->{'cookie-jar'} = $c;
                $options->{'cookie-jar-options'}->{ 'read' } = 1;
            };
        };

        # Curl 7.61.0 ignores these:
        #if( $options->{ keepalive }) {
        #    $headers{ 'Keep-Alive' } = 1;
        #} elsif( exists $options->{ keepalive }) {
        #    $headers{ 'Keep-Alive' } = 0;
        #};

        if( $options->{ compressed }) {
            my $compressions = HTTP::Message::decodable();
            $self->_add_header( \%headers, 'Accept-Encoding' => $compressions );
        };

        my $auth;
        for my $kind (qw(basic ntlm negotiate)) {

lib/HTTP/Request/FromWget.pm  view on Meta::CPAN

    'cache!',
    'ca-directory=s',
    'check-certificate!',
    'certificate=s',
    'compression=s',
    'content-disposition=s',
    'cookie|b=s@',
    'cookies!',              # ignored
    'debug',                 # ignored
    'header|H=s@',
    'http-keep-alive!',
    'http-password=s',
    'http-user=s',
    'load-cookies|c=s',
    'method=s',
    'no-verbose|nv',         # ignored
    'output-document|O=s',   # ignored
    'post-data=s',
    'post-file=s',
    'progress!',             # ignored
    'quiet',                 # ignored

lib/HTTP/Request/FromWget.pm  view on Meta::CPAN

            $self->_set_header( \%headers, "User-Agent", $options->{ 'user-agent' } );
        };

        if( exists $options->{ 'cache' }) {
            if(! $options->{ 'cache' } ) {
                $self->_maybe_set_header( \%headers, "Cache-Control" => 'no-cache' );
                $self->_maybe_set_header( \%headers, "Pragma" => 'no-cache' );
            };
        };

        if( exists $options->{ 'http-keep-alive' }) {
            if(! $options->{ 'http-keep-alive' } ) {
                $self->_set_header( \%headers, "Connection" => 'Close' );
            };
        };

        if( defined $options->{ referer }) {
            $self->_set_header( \%headers, "Referer" => $options->{ 'referer' } );
        };

        # We want to compare the headers case-insensitively
        my %headers_lc = map { lc $_ => 1 } keys %headers;

script/curl2perl  view on Meta::CPAN

Include response in output (ignored)

=item B<head|I>

Issue a C<HEAD> request

=item B<max-time>

Set a timeout for the request

=item B<keepalive> / B<no-keepalive>

Don't send a keep-alive header (ignored)

=item B<request|X=s>

Issue a custom request

=item B<oauth2-bearer=s>

Send an OAUTH2 bearer token

=item B<output|o=s>

t/curl-identity-options.t  view on Meta::CPAN

#!perl
use strict;
use HTTP::Request::FromCurl;

use lib 't';
use TestCurlIdentity 'run_curl_tests';

my @tests = (
    { cmd => [ '--verbose', '-g', '-s', '$url', '--max-time', 5 ] },
    { cmd => [ '--verbose', '-g', '-s', '$url', '--keepalive' ] },
    { cmd => [ '--verbose', '-g', '-s', '$url', '--no-keepalive' ] },
    { cmd => [ '--verbose', '-g', '-s', '$url', '--buffer' ] },
    { cmd => [ '--verbose', '-g', '-s', '$url', '--show-error' ] },
    { cmd => [ '--verbose', '-g', '-s', '$url', '-S' ] },
    { cmd => [ '--verbose', '-s', '-g', '--compressed', '$url' ],
      ignore => ['Accept-Encoding'], # this somewhat defeats this test but at least
      # we check we don't crash. Available compressions might differ between
      # Curl and Compress::Zlib, so ...
    },
    { cmd => [ '--verbose', '-Z', '-s', '$url', '-S' ],
      version => '007068000',

t/wget-identity-options.t  view on Meta::CPAN

#!perl
use strict;
use HTTP::Request::FromWget;

use lib 't';
use TestWgetIdentity 'run_wget_tests';

my @tests = (
    #{ cmd => [ '--verbose', '-g', '-s', '$url', '--max-time', 5 ] },
    { cmd => [ '-O', '-', '--debug', '--http-keep-alive', '$url', '--header', 'X-Test: test' ] },
    { cmd => [ '-O', '-', '--debug', '--no-http-keep-alive', '$url', '--header', 'X-Test: test' ] },
    { cmd => [ '-O', '-', '--debug', '--no-check-certificate', '$url' ] },
    #{ cmd => [ '--verbose', '-g', '-s', '$url', '--buffer' ] },
    #{ cmd => [ '--verbose', '-g', '-s', '$url', '--show-error' ] },

    # This is not entirely correct - later releases of wget might be built
    # without zlib and thus not support --compression either
    { cmd => [ '-O', '-', '--debug', '--compression', 'auto', '$url', '--header', 'X-Test: test' ],
        version => 1019003,
        todo => 'Versions of Wget beyond 1.19.3 must be built with zlib to support --compression',
    },



( run in 2.640 seconds using v1.01-cache-2.11-cpan-71847e10f99 )