Git Product home page Git Product logo

lwp-protocol-https's Introduction

NAME

LWP::UserAgent - Web user agent class

SYNOPSIS

use strict;
use warnings;

use LWP::UserAgent ();

my $ua = LWP::UserAgent->new(timeout => 10);
$ua->env_proxy;

my $response = $ua->get('http://example.com');

if ($response->is_success) {
    print $response->decoded_content;
}
else {
    die $response->status_line;
}

Extra layers of security (note the cookie_jar and protocols_allowed):

use strict;
use warnings;

use HTTP::CookieJar::LWP ();
use LWP::UserAgent       ();

my $jar = HTTP::CookieJar::LWP->new;
my $ua  = LWP::UserAgent->new(
    cookie_jar        => $jar,
    protocols_allowed => ['http', 'https'],
    timeout           => 10,
);

$ua->env_proxy;

my $response = $ua->get('http://example.com');

if ($response->is_success) {
    print $response->decoded_content;
}
else {
    die $response->status_line;
}

DESCRIPTION

The LWP::UserAgent is a class implementing a web user agent. LWP::UserAgent objects can be used to dispatch web requests.

In normal use the application creates an LWP::UserAgent object, and then configures it with values for timeouts, proxies, name, etc. It then creates an instance of HTTP::Request for the request that needs to be performed. This request is then passed to one of the request method the UserAgent, which dispatches it using the relevant protocol, and returns a HTTP::Response object. There are convenience methods for sending the most common request types: "get" in LWP::UserAgent, "head" in LWP::UserAgent, "post" in LWP::UserAgent, "put" in LWP::UserAgent and "delete" in LWP::UserAgent. When using these methods, the creation of the request object is hidden as shown in the synopsis above.

The basic approach of the library is to use HTTP-style communication for all protocol schemes. This means that you will construct HTTP::Request objects and receive HTTP::Response objects even for non-HTTP resources like gopher and ftp. In order to achieve even more similarity to HTTP-style communications, gopher menus and file directories are converted to HTML documents.

CONSTRUCTOR METHODS

The following constructor methods are available:

clone

my $ua2 = $ua->clone;

Returns a copy of the LWP::UserAgent object.

CAVEAT: Please be aware that the clone method does not copy or clone your cookie_jar attribute. Due to the limited restrictions on what can be used for your cookie jar, there is no way to clone the attribute. The cookie_jar attribute will be undef in the new object instance.

new

my $ua = LWP::UserAgent->new( %options )

This method constructs a new LWP::UserAgent object and returns it. Key/value pair arguments may be provided to set up the initial state. The following options correspond to attribute methods described below:

KEY                     DEFAULT
-----------             --------------------
agent                   "libwww-perl/#.###"
conn_cache              undef
cookie_jar              undef
cookie_jar_class        HTTP::Cookies
default_headers         HTTP::Headers->new
from                    undef
local_address           undef
max_redirect            7
max_size                undef
no_proxy                []
parse_head              1
protocols_allowed       undef
protocols_forbidden     undef
proxy                   {}
requests_redirectable   ['GET', 'HEAD']
send_te                 1
show_progress           undef
ssl_opts                { verify_hostname => 1 }
timeout                 180

The following additional options are also accepted: If the env_proxy option is passed in with a true value, then proxy settings are read from environment variables (see "env_proxy" in LWP::UserAgent). If env_proxy isn't provided, the PERL_LWP_ENV_PROXY environment variable controls if "env_proxy" in LWP::UserAgent is called during initialization. If the keep_alive option value is defined and non-zero, then an LWP::ConnCache is set up (see "conn_cache" in LWP::UserAgent). The keep_alive value is passed on as the total_capacity for the connection cache.

proxy must be set as an arrayref of key/value pairs. no_proxy takes an arrayref of domains.

ATTRIBUTES

The settings of the configuration attributes modify the behaviour of the LWP::UserAgent when it dispatches requests. Most of these can also be initialized by options passed to the constructor method.

The following attribute methods are provided. The attribute value is left unchanged if no argument is given. The return value from each method is the old attribute value.

agent

my $agent = $ua->agent;
$ua->agent('Checkbot/0.4 ');    # append the default to the end
$ua->agent('Mozilla/5.0');
$ua->agent("");                 # don't identify

Get/set the product token that is used to identify the user agent on the network. The agent value is sent as the User-Agent header in the requests.

The default is a string of the form libwww-perl/#.###, where #.### is substituted with the version number of this library.

If the provided string ends with space, the default libwww-perl/#.### string is appended to it.

The user agent string should be one or more simple product identifiers with an optional version number separated by the / character.

conn_cache

my $cache_obj = $ua->conn_cache;
$ua->conn_cache( $cache_obj );

Get/set the LWP::ConnCache object to use. See LWP::ConnCache for details.

cookie_jar

my $jar = $ua->cookie_jar;
$ua->cookie_jar( $cookie_jar_obj );

Get/set the cookie jar object to use. The only requirement is that the cookie jar object must implement the extract_cookies($response) and add_cookie_header($request) methods. These methods will then be invoked by the user agent as requests are sent and responses are received. Normally this will be a HTTP::Cookies object or some subclass. You are, however, encouraged to use HTTP::CookieJar::LWP instead. See "BEST PRACTICES" for more information.

use HTTP::CookieJar::LWP ();

my $jar = HTTP::CookieJar::LWP->new;
my $ua = LWP::UserAgent->new( cookie_jar => $jar );

# or after object creation
$ua->cookie_jar( $cookie_jar );

The default is to have no cookie jar, i.e. never automatically add Cookie headers to the requests.

If $jar contains an unblessed hash reference, a new cookie jar object is created for you automatically. The object is of the class set with the cookie_jar_class constructor argument, which defaults to HTTP::Cookies.

$ua->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" });

is really just a shortcut for:

require HTTP::Cookies;
$ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt"));

As described above and in "BEST PRACTICES", you should set cookie_jar_class to "HTTP::CookieJar::LWP" to get a safer cookie jar.

my $ua = LWP::UserAgent->new( cookie_jar_class => 'HTTP::CookieJar::LWP' );
$ua->cookie_jar({}); # HTTP::CookieJar::LWP takes no args

These can also be combined into the constructor, so a jar is created at instantiation.

my $ua = LWP::UserAgent->new(
  cookie_jar_class => 'HTTP::CookieJar::LWP',
  cookie_jar       =>  {},
);

credentials

my $creds = $ua->credentials();
$ua->credentials( $netloc, $realm );
$ua->credentials( $netloc, $realm, $uname, $pass );
$ua->credentials("www.example.com:80", "Some Realm", "foo", "secret");

Get/set the user name and password to be used for a realm.

The $netloc is a string of the form <host>:<port>. The username and password will only be passed to this server.

default_header

$ua->default_header( $field );
$ua->default_header( $field => $value );
$ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodable());
$ua->default_header('Accept-Language' => "no, en");

This is just a shortcut for $ua->default_headers->header( $field => $value ).

default_headers

my $headers = $ua->default_headers;
$ua->default_headers( $headers_obj );

Get/set the headers object that will provide default header values for any requests sent. By default this will be an empty HTTP::Headers object.

from

my $from = $ua->from;
$ua->from('[email protected]');

Get/set the email address for the human user who controls the requesting user agent. The address should be machine-usable, as defined in RFC2822. The from value is sent as the From header in the requests.

The default is to not send a From header. See "default_headers" in LWP::UserAgent for the more general interface that allow any header to be defaulted.

local_address

my $address = $ua->local_address;
$ua->local_address( $address );

Get/set the local interface to bind to for network connections. The interface can be specified as a hostname or an IP address. This value is passed as the LocalAddr argument to IO::Socket::INET.

max_redirect

my $max = $ua->max_redirect;
$ua->max_redirect( $n );

This reads or sets the object's limit of how many times it will obey redirection responses in a given request cycle.

By default, the value is 7. This means that if you call "request" in LWP::UserAgent and the response is a redirect elsewhere which is in turn a redirect, and so on seven times, then LWP gives up after that seventh request.

max_size

my $size = $ua->max_size;
$ua->max_size( $bytes );

Get/set the size limit for response content. The default is undef, which means that there is no limit. If the returned response content is only partial, because the size limit was exceeded, then a Client-Aborted header will be added to the response. The content might end up longer than max_size as we abort once appending a chunk of data makes the length exceed the limit. The Content-Length header, if present, will indicate the length of the full content and will normally not be the same as length($res->content).

parse_head

my $bool = $ua->parse_head;
$ua->parse_head( $boolean );

Get/set a value indicating whether we should initialize response headers from the <head> section of HTML documents. The default is true. Do not turn this off unless you know what you are doing.

protocols_allowed

my $aref = $ua->protocols_allowed;      # get allowed protocols
$ua->protocols_allowed( \@protocols );  # allow ONLY these
$ua->protocols_allowed(undef);          # delete the list
$ua->protocols_allowed(['http',]);      # ONLY allow http

By default, an object has neither a protocols_allowed list, nor a "protocols_forbidden" in LWP::UserAgent list.

This reads (or sets) this user agent's list of protocols that the request methods will exclusively allow. The protocol names are case insensitive.

For example: $ua->protocols_allowed( [ 'http', 'https'] ); means that this user agent will allow only those protocols, and attempts to use this user agent to access URLs with any other schemes (like ftp://...) will result in a 500 error.

Note that having a protocols_allowed list causes any "protocols_forbidden" in LWP::UserAgent list to be ignored.

protocols_forbidden

my $aref = $ua->protocols_forbidden;    # get the forbidden list
$ua->protocols_forbidden(\@protocols);  # do not allow these
$ua->protocols_forbidden(['http',]);    # All http reqs get a 500
$ua->protocols_forbidden(undef);        # delete the list

This reads (or sets) this user agent's list of protocols that the request method will not allow. The protocol names are case insensitive.

For example: $ua->protocols_forbidden( [ 'file', 'mailto'] ); means that this user agent will not allow those protocols, and attempts to use this user agent to access URLs with those schemes will result in a 500 error.

requests_redirectable

my $aref = $ua->requests_redirectable;
$ua->requests_redirectable( \@requests );
$ua->requests_redirectable(['GET', 'HEAD',]); # the default

This reads or sets the object's list of request names that "redirect_ok" in LWP::UserAgent will allow redirection for. By default, this is ['GET', 'HEAD'], as per RFC 2616. To change to include POST, consider:

push @{ $ua->requests_redirectable }, 'POST';

send_te

my $bool = $ua->send_te;
$ua->send_te( $boolean );

If true, will send a TE header along with the request. The default is true. Set it to false to disable the TE header for systems who can't handle it.

show_progress

my $bool = $ua->show_progress;
$ua->show_progress( $boolean );

Get/set a value indicating whether a progress bar should be displayed on the terminal as requests are processed. The default is false.

ssl_opts

my @keys = $ua->ssl_opts;
my $val = $ua->ssl_opts( $key );
$ua->ssl_opts( $key => $value );

Get/set the options for SSL connections. Without argument return the list of options keys currently set. With a single argument return the current value for the given option. With 2 arguments set the option value and return the old. Setting an option to the value undef removes this option.

The options that LWP relates to are:

  • verify_hostname => $bool

    When TRUE LWP will for secure protocol schemes ensure it connects to servers that have a valid certificate matching the expected hostname. If FALSE no checks are made and you can't be sure that you communicate with the expected peer. The no checks behaviour was the default for libwww-perl-5.837 and earlier releases.

    This option is initialized from the PERL_LWP_SSL_VERIFY_HOSTNAME environment variable. If this environment variable isn't set; then verify_hostname defaults to 1.

    Please note that that recently the overall effect of this option with regards to SSL handling has changed. As of version 6.11 of LWP::Protocol::https, which is an external module, SSL certificate verification was harmonized to behave in sync with IO::Socket::SSL. With this change, setting this option no longer disables all SSL certificate verification, only the hostname checks. To disable all verification, use the SSL_verify_mode option in the ssl_opts attribute. For example: $ua-ssl_opts(SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE);>

  • SSL_ca_file => $path

    The path to a file containing Certificate Authority certificates. A default setting for this option is provided by checking the environment variables PERL_LWP_SSL_CA_FILE and HTTPS_CA_FILE in order.

  • SSL_ca_path => $path

    The path to a directory containing files containing Certificate Authority certificates. A default setting for this option is provided by checking the environment variables PERL_LWP_SSL_CA_PATH and HTTPS_CA_DIR in order.

Other options can be set and are processed directly by the SSL Socket implementation in use. See IO::Socket::SSL or Net::SSL for details.

The libwww-perl core no longer bundles protocol plugins for SSL. You will need to install LWP::Protocol::https separately to enable support for processing https-URLs.

timeout

my $secs = $ua->timeout;
$ua->timeout( $secs );

Get/set the timeout value in seconds. The default value is 180 seconds, i.e. 3 minutes.

The request is aborted if no activity on the connection to the server is observed for timeout seconds. This means that the time it takes for the complete transaction and the "request" in LWP::UserAgent method to actually return might be longer.

When a request times out, a response object is still returned. The response will have a standard HTTP Status Code (500). This response will have the "Client-Warning" header set to the value of "Internal response". See the "get" in LWP::UserAgent method description below for further details.

PROXY ATTRIBUTES

The following methods set up when requests should be passed via a proxy server.

env_proxy

$ua->env_proxy;

Load proxy settings from *_proxy environment variables. You might specify proxies like this (sh-syntax):

gopher_proxy=http://proxy.my.place/
wais_proxy=http://proxy.my.place/
no_proxy="localhost,example.com"
export gopher_proxy wais_proxy no_proxy

csh or tcsh users should use the setenv command to define these environment variables.

On systems with case insensitive environment variables there exists a name clash between the CGI environment variables and the HTTP_PROXY environment variable normally picked up by env_proxy. Because of this HTTP_PROXY is not honored for CGI scripts. The CGI_HTTP_PROXY environment variable can be used instead.

no_proxy

$ua->no_proxy( @domains );
$ua->no_proxy('localhost', 'example.com');
$ua->no_proxy(); # clear the list

Do not proxy requests to the given domains, including subdomains. Calling no_proxy without any domains clears the list of domains.

proxy

$ua->proxy(\@schemes, $proxy_url)
$ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');

# For a single scheme:
$ua->proxy($scheme, $proxy_url)
$ua->proxy('gopher', 'http://proxy.sn.no:8001/');

# To set multiple proxies at once:
$ua->proxy([
    ftp => 'http://ftp.example.com:8001/',
    [ 'http', 'https' ] => 'http://http.example.com:8001/',
]);

Set/retrieve proxy URL for a scheme.

The first form specifies that the URL is to be used as a proxy for access methods listed in the list in the first method argument, i.e. http and ftp.

The second form shows a shorthand form for specifying proxy URL for a single access scheme.

The third form demonstrates setting multiple proxies at once. This is also the only form accepted by the constructor.

HANDLERS

Handlers are code that injected at various phases during the processing of requests. The following methods are provided to manage the active handlers:

add_handler

$ua->add_handler( $phase => \&cb, %matchspec )

Add handler to be invoked in the given processing phase. For how to specify %matchspec see "Matching" in HTTP::Config.

The possible values $phase and the corresponding callback signatures are as follows. Note that the handlers are documented in the order in which they will be run, which is:

request_preprepare
request_prepare
request_send
response_header
response_data
response_done
response_redirect
  • request_preprepare => sub { my($request, $ua, $handler) = @_; ... }

    The handler is called before the request_prepare and other standard initialization of the request. This can be used to set up headers and attributes that the request_prepare handler depends on. Proxy initialization should take place here; but in general don't register handlers for this phase.

  • request_prepare => sub { my($request, $ua, $handler) = @_; ... }

    The handler is called before the request is sent and can modify the request any way it see fit. This can for instance be used to add certain headers to specific requests.

    The method can assign a new request object to $_[0] to replace the request that is sent fully.

    The return value from the callback is ignored. If an exception is raised it will abort the request and make the request method return a "400 Bad request" response.

  • request_send => sub { my($request, $ua, $handler) = @_; ... }

    This handler gets a chance of handling requests before they're sent to the protocol handlers. It should return an HTTP::Response object if it wishes to terminate the processing; otherwise it should return nothing.

    The response_header and response_data handlers will not be invoked for this response, but the response_done will be.

  • response_header => sub { my($response, $ua, $handler) = @_; ... }

    This handler is called right after the response headers have been received, but before any content data. The handler might set up handlers for data and might croak to abort the request.

    The handler might set the $response->{default_add_content} value to control if any received data should be added to the response object directly. This will initially be false if the $ua->request() method was called with a $content_file or $content_cb argument; otherwise true.

  • response_data => sub { my($response, $ua, $handler, $data) = @_; ... }

    This handler is called for each chunk of data received for the response. The handler might croak to abort the request.

    This handler needs to return a TRUE value to be called again for subsequent chunks for the same request.

  • response_done => sub { my($response, $ua, $handler) = @_; ... }

    The handler is called after the response has been fully received, but before any redirect handling is attempted. The handler can be used to extract information or modify the response.

  • response_redirect => sub { my($response, $ua, $handler) = @_; ... }

    The handler is called in $ua->request after response_done. If the handler returns an HTTP::Request object we'll start over with processing this request instead.

For all of these, $handler is a code reference to the handler that is currently being run.

get_my_handler

$ua->get_my_handler( $phase, %matchspec );
$ua->get_my_handler( $phase, %matchspec, $init );

Will retrieve the matching handler as hash ref.

If $init is passed as a true value, create and add the handler if it's not found. If $init is a subroutine reference, then it's called with the created handler hash as argument. This sub might populate the hash with extra fields; especially the callback. If $init is a hash reference, merge the hashes.

handlers

$ua->handlers( $phase, $request )
$ua->handlers( $phase, $response )

Returns the handlers that apply to the given request or response at the given processing phase.

remove_handler

$ua->remove_handler( undef, %matchspec );
$ua->remove_handler( $phase, %matchspec );
$ua->remove_handler(); # REMOVE ALL HANDLERS IN ALL PHASES

Remove handlers that match the given %matchspec. If $phase is not provided, remove handlers from all phases.

Be careful as calling this function with %matchspec that is not specific enough can remove handlers not owned by you. It's probably better to use the "set_my_handler" in LWP::UserAgent method instead.

The removed handlers are returned.

set_my_handler

$ua->set_my_handler( $phase, $cb, %matchspec );
$ua->set_my_handler($phase, undef); # remove handler for phase

Set handlers private to the executing subroutine. Works by defaulting an owner field to the %matchspec that holds the name of the called subroutine. You might pass an explicit owner to override this.

If $cb is passed as undef, remove the handler.

REQUEST METHODS

The methods described in this section are used to dispatch requests via the user agent. The following request methods are provided:

delete

my $res = $ua->delete( $url );
my $res = $ua->delete( $url, $field_name => $value, ... );

This method will dispatch a DELETE request on the given URL. Additional headers and content options are the same as for the "get" in LWP::UserAgent method.

This method will use the DELETE() function from HTTP::Request::Common to build the request. See HTTP::Request::Common for a details on how to pass form content and other advanced features.

get

my $res = $ua->get( $url );
my $res = $ua->get( $url , $field_name => $value, ... );

This method will dispatch a GET request on the given URL. Further arguments can be given to initialize the headers of the request. These are given as separate name/value pairs. The return value is a response object. See HTTP::Response for a description of the interface it provides.

There will still be a response object returned when LWP can't connect to the server specified in the URL or when other failures in protocol handlers occur. These internal responses use the standard HTTP status codes, so the responses can't be differentiated by testing the response status code alone. Error responses that LWP generates internally will have the "Client-Warning" header set to the value "Internal response". If you need to differentiate these internal responses from responses that a remote server actually generates, you need to test this header value.

Fields names that start with ":" are special. These will not initialize headers of the request but will determine how the response content is treated. The following special field names are recognized:

':content_file'   => $filename # or $filehandle
':content_cb'     => \&callback
':read_size_hint' => $bytes

If a $filename or $filehandle is provided with the :content_file option, then the response content will be saved here instead of in the response object. The $filehandle may also be an object with an open file descriptor, such as a File::Temp object. If a callback is provided with the :content_cb option then this function will be called for each chunk of the response content as it is received from the server. If neither of these options are given, then the response content will accumulate in the response object itself. This might not be suitable for very large response bodies. Only one of :content_file or :content_cb can be specified. The content of unsuccessful responses will always accumulate in the response object itself, regardless of the :content_file or :content_cb options passed in. Note that errors writing to the content file (for example due to permission denied or the filesystem being full) will be reported via the Client-Aborted or X-Died response headers, and not the is_success method.

The :read_size_hint option is passed to the protocol module which will try to read data from the server in chunks of this size. A smaller value for the :read_size_hint will result in a higher number of callback invocations.

The callback function is called with 3 arguments: a chunk of data, a reference to the response object, and a reference to the protocol object. The callback can abort the request by invoking die(). The exception message will show up as the "X-Died" header field in the response returned by the $ua->get() method.

head

my $res = $ua->head( $url );
my $res = $ua->head( $url , $field_name => $value, ... );

This method will dispatch a HEAD request on the given URL. Otherwise it works like the "get" in LWP::UserAgent method described above.

is_protocol_supported

my $bool = $ua->is_protocol_supported( $scheme );

You can use this method to test whether this user agent object supports the specified scheme. (The scheme might be a string (like http or ftp) or it might be an URI object reference.)

Whether a scheme is supported is determined by the user agent's protocols_allowed or protocols_forbidden lists (if any), and by the capabilities of LWP. I.e., this will return true only if LWP supports this protocol and it's permitted for this particular object.

is_online

my $bool = $ua->is_online;

Tries to determine if you have access to the Internet. Returns 1 (true) if the built-in heuristics determine that the user agent is able to access the Internet (over HTTP) or 0 (false).

See also LWP::Online.

mirror

my $res = $ua->mirror( $url, $filename );

This method will get the document identified by URL and store it in file called $filename. If the file already exists, then the request will contain an If-Modified-Since header matching the modification time of the file. If the document on the server has not changed since this time, then nothing happens. If the document has been updated, it will be downloaded again. The modification time of the file will be forced to match that of the server.

Uses "move" in File::Copy to attempt to atomically replace the $filename.

The return value is an HTTP::Response object.

patch

# Any version of HTTP::Message works with this form:
my $res = $ua->patch( $url, $field_name => $value, Content => $content );

# Using hash or array references requires HTTP::Message >= 6.12
use HTTP::Request 6.12;
my $res = $ua->patch( $url, \%form );
my $res = $ua->patch( $url, \@form );
my $res = $ua->patch( $url, \%form, $field_name => $value, ... );
my $res = $ua->patch( $url, $field_name => $value, Content => \%form );
my $res = $ua->patch( $url, $field_name => $value, Content => \@form );

This method will dispatch a PATCH request on the given URL, with %form or @form providing the key/value pairs for the fill-in form content. Additional headers and content options are the same as for the "get" in LWP::UserAgent method.

CAVEAT:

This method can only accept content that is in key-value pairs when using HTTP::Request::Common prior to version 6.12. Any use of hash or array references will result in an error prior to version 6.12.

This method will use the PATCH function from HTTP::Request::Common to build the request. See HTTP::Request::Common for a details on how to pass form content and other advanced features.

post

my $res = $ua->post( $url, \%form );
my $res = $ua->post( $url, \@form );
my $res = $ua->post( $url, \%form, $field_name => $value, ... );
my $res = $ua->post( $url, $field_name => $value, Content => \%form );
my $res = $ua->post( $url, $field_name => $value, Content => \@form );
my $res = $ua->post( $url, $field_name => $value, Content => $content );

This method will dispatch a POST request on the given URL, with %form or @form providing the key/value pairs for the fill-in form content. Additional headers and content options are the same as for the "get" in LWP::UserAgent method.

This method will use the POST function from HTTP::Request::Common to build the request. See HTTP::Request::Common for a details on how to pass form content and other advanced features.

put

# Any version of HTTP::Message works with this form:
my $res = $ua->put( $url, $field_name => $value, Content => $content );

# Using hash or array references requires HTTP::Message >= 6.07
use HTTP::Request 6.07;
my $res = $ua->put( $url, \%form );
my $res = $ua->put( $url, \@form );
my $res = $ua->put( $url, \%form, $field_name => $value, ... );
my $res = $ua->put( $url, $field_name => $value, Content => \%form );
my $res = $ua->put( $url, $field_name => $value, Content => \@form );

This method will dispatch a PUT request on the given URL, with %form or @form providing the key/value pairs for the fill-in form content. Additional headers and content options are the same as for the "get" in LWP::UserAgent method.

CAVEAT:

This method can only accept content that is in key-value pairs when using HTTP::Request::Common prior to version 6.07. Any use of hash or array references will result in an error prior to version 6.07.

This method will use the PUT function from HTTP::Request::Common to build the request. See HTTP::Request::Common for a details on how to pass form content and other advanced features.

request

my $res = $ua->request( $request );
my $res = $ua->request( $request, $content_file );
my $res = $ua->request( $request, $content_cb );
my $res = $ua->request( $request, $content_cb, $read_size_hint );

This method will dispatch the given $request object. Normally this will be an instance of the HTTP::Request class, but any object with a similar interface will do. The return value is an HTTP::Response object.

The request method will process redirects and authentication responses transparently. This means that it may actually send several simple requests via the "simple_request" in LWP::UserAgent method described below.

The request methods described above; "get" in LWP::UserAgent, "head" in LWP::UserAgent, "post" in LWP::UserAgent and "mirror" in LWP::UserAgent will all dispatch the request they build via this method. They are convenience methods that simply hide the creation of the request object for you.

The $content_file, $content_cb and $read_size_hint all correspond to options described with the "get" in LWP::UserAgent method above. Note that errors writing to the content file (for example due to permission denied or the filesystem being full) will be reported via the Client-Aborted or X-Died response headers, and not the is_success method.

You are allowed to use a CODE reference as content in the request object passed in. The content function should return the content when called. The content can be returned in chunks. The content function will be invoked repeatedly until it return an empty string to signal that there is no more content.

simple_request

my $request = HTTP::Request->new( ... );
my $res = $ua->simple_request( $request );
my $res = $ua->simple_request( $request, $content_file );
my $res = $ua->simple_request( $request, $content_cb );
my $res = $ua->simple_request( $request, $content_cb, $read_size_hint );

This method dispatches a single request and returns the response received. Arguments are the same as for the "request" in LWP::UserAgent described above.

The difference from "request" in LWP::UserAgent is that simple_request will not try to handle redirects or authentication responses. The "request" in LWP::UserAgent method will, in fact, invoke this method for each simple request it sends.

CALLBACK METHODS

The following methods will be invoked as requests are processed. These methods are documented here because subclasses of LWP::UserAgent might want to override their behaviour.

get_basic_credentials

# This checks wantarray and can either return an array:
my ($user, $pass) = $ua->get_basic_credentials( $realm, $uri, $isproxy );
# or a string that looks like "user:pass"
my $creds = $ua->get_basic_credentials($realm, $uri, $isproxy);

This is called by "request" in LWP::UserAgent to retrieve credentials for documents protected by Basic or Digest Authentication. The arguments passed in is the $realm provided by the server, the $uri requested and a boolean flag to indicate if this is authentication against a proxy server.

The method should return a username and password. It should return an empty list to abort the authentication resolution attempt. Subclasses can override this method to prompt the user for the information. An example of this can be found in lwp-request program distributed with this library.

The base implementation simply checks a set of pre-stored member variables, set up with the "credentials" in LWP::UserAgent method.

prepare_request

$request = $ua->prepare_request( $request );

This method is invoked by "simple_request" in LWP::UserAgent. Its task is to modify the given $request object by setting up various headers based on the attributes of the user agent. The return value should normally be the $request object passed in. If a different request object is returned it will be the one actually processed.

The headers affected by the base implementation are; User-Agent, From, Range and Cookie.

progress

my $prog = $ua->progress( $status, $request_or_response );

This is called frequently as the response is received regardless of how the content is processed. The method is called with $status "begin" at the start of processing the request and with $state "end" before the request method returns. In between these $status will be the fraction of the response currently received or the string "tick" if the fraction can't be calculated.

When $status is "begin" the second argument is the HTTP::Request object, otherwise it is the HTTP::Response object.

redirect_ok

my $bool = $ua->redirect_ok( $prospective_request, $response );

This method is called by "request" in LWP::UserAgent before it tries to follow a redirection to the request in $response. This should return a true value if this redirection is permissible. The $prospective_request will be the request to be sent if this method returns true.

The base implementation will return false unless the method is in the object's requests_redirectable list, false if the proposed redirection is to a file://... URL, and true otherwise.

BEST PRACTICES

The default settings can get you up and running quickly, but there are settings you can change in order to make your life easier.

Handling Cookies

You are encouraged to install Mozilla::PublicSuffix and use HTTP::CookieJar::LWP as your cookie jar. HTTP::CookieJar::LWP provides a better security model matching that of current Web browsers when Mozilla::PublicSuffix is installed.

use HTTP::CookieJar::LWP ();

my $jar = HTTP::CookieJar::LWP->new;
my $ua = LWP::UserAgent->new( cookie_jar => $jar );

See "cookie_jar" for more information.

Managing Protocols

protocols_allowed gives you the ability to allow arbitrary protocols.

my $ua = LWP::UserAgent->new(
    protocols_allowed => [ 'http', 'https' ]
);

This will prevent you from inadvertently following URLs like file:///etc/passwd. See "protocols_allowed".

protocols_forbidden gives you the ability to deny arbitrary protocols.

my $ua = LWP::UserAgent->new(
    protocols_forbidden => [ 'file', 'mailto', 'ssh', ]
);

This can also prevent you from inadvertently following URLs like file:///etc/passwd. See "protocols_forbidden".

SEE ALSO

See LWP for a complete overview of libwww-perl5. See lwpcook and the scripts lwp-request and lwp-download for examples of usage.

See HTTP::Request and HTTP::Response for a description of the message objects dispatched and received. See HTTP::Request::Common and HTML::Form for other ways to build request objects.

See WWW::Mechanize and WWW::Search for examples of more specialized user agents based on LWP::UserAgent.

COPYRIGHT AND LICENSE

Copyright 1995-2009 Gisle Aas.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

lwp-protocol-https's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lwp-protocol-https's Issues

Old Bug, Revisited: Peer certificate not verified [rt.cpan.org #61340]

Migrated from rt.cpan.org#61340 (status was 'open')

Requestors:

Attachments:

From [email protected] on 2010-09-14 23:50:38:

I am using LWP with https protocol.  The message "Peer certificate not
verified" appears for me even with the patch from 2003 below.  However, with
a little tweak, the intent of the original bug fix can be extended to cover
Net::SSLeay ... works for me anyway.  With Net::SSLeay configured to do peer
verification and a successful verification the message is turned off
analogous to Crypt::SSLeay.

The original code in LWP/Protocol/https.pm is:
if(! eval { $sock->get_peer_verify }) {
  $res->header("Client-SSL-Warning" => "Peer certificate not verified");
}
Revised code:
if ((! eval { $sock->get_peer_verify }) && (! eval
{Net::SSLeay::get_verify_mode($sock)})) {
  $res->header("Client-SSL-Warning" => "Peer certificate not verified");
}

Original fix:
Re: PATCH: Peer certificate not verified for https Crypt::SSLeay
Gisle Aas
Wed, 15 Oct 2003 03:37:04 -0700

Another year old patch eventually applied.
Regards,
Gisle

Joshua Chamas <[EMAIL PROTECTED]> writes:
> Hey,
>
> Here is a patch against libwww-perl-5.64 that turns off the
> "Client-SSL-Warning" => "Peer certificate not verified"
> when Crypt::SSLeay has been configured to do peer certificate
> verification.  By wrapping the call in an eval {}, this patch
> should also be compatible with other SSL implementations that
> do not support this sock->get_peer_verify API.
>
> [EMAIL PROTECTED] libwww-perl-5.64]# diff -u lib/LWP/Protocol/https.pm.old

> lib/LWP/Protocol/https.pm
> --- lib/LWP/Protocol/https.pm.old     Fri Nov 16 18:10:28 2001
> +++ lib/LWP/Protocol/https.pm Mon Mar 18 12:38:37 2002
> @@ -34,7 +34,9 @@
>       $res->header("Client-SSL-Cert-Subject" => $cert->subject_name);
>       $res->header("Client-SSL-Cert-Issuer" => $cert->issuer_name);
>      }
> -    $res->header("Client-SSL-Warning" => "Peer certificate not
verified");
> +    if(! eval { $sock->get_peer_verify }) {
> +     $res->header("Client-SSL-Warning" => "Peer certificate not
verified");
> +    }
>  }
>
> Thanks,
>
> Josh

One thing I notices is there is a LWP/Protocol/https10.pm that is also
installed on my system and it does not have this conditional in it, but
perhaps it should.

Thanks,

Steve...

-- 
Steve Kneizys
Senior Business Process Engineer
Ferrilli Information Group
Voice: (610) 256-1396
web: http://www.figsolutions.com/

For Emergency Service (888)864-3282

From [email protected] on 2010-09-15 14:55:48:

I spoke too soon ... turns out my additional code does not work!  But the
problem does seem to exist, whether I pre-load IO::Socket::SSL (and I verify
it is being used),  then call IO::Socket::SSL to set the ctx_defaults to
verify the peer,  LWP::UserAgent  ends up giving me the message "Peer
certificate not verified" even when it has been.  I'll just ignore the
warning in my code :-)

Thanks,

Steve...
Original message:

>
> I am using LWP with https protocol.  The message "Peer certificate not
> verified" appears for me even with the patch from 2003 below.  However,
> with
> a little tweak, the intent of the original bug fix can be extended to cover
> Net::SSLeay ... works for me anyway.  With Net::SSLeay configured to do
> peer
> verification and a successful verification the message is turned off
> analogous to Crypt::SSLeay.
>
> The original code in LWP/Protocol/https.pm is:
> if(! eval { $sock->get_peer_verify }) {
>  $res->header("Client-SSL-Warning" => "Peer certificate not verified");
> }
> Revised code:
> if ((! eval { $sock->get_peer_verify }) && (! eval
> {Net::SSLeay::get_verify_mode($sock)})) {
>  $res->header("Client-SSL-Warning" => "Peer certificate not verified");
> }
>
> Original fix:
> Re: PATCH: Peer certificate not verified for https Crypt::SSLeay
> Gisle Aas
> Wed, 15 Oct 2003 03:37:04 -0700
>
> Another year old patch eventually applied.
> Regards,
> Gisle
>
> Joshua Chamas <[EMAIL PROTECTED]> writes:
> > Hey,
> >
> > Here is a patch against libwww-perl-5.64 that turns off the
> > "Client-SSL-Warning" => "Peer certificate not verified"
> > when Crypt::SSLeay has been configured to do peer certificate
> > verification.  By wrapping the call in an eval {}, this patch
> > should also be compatible with other SSL implementations that
> > do not support this sock->get_peer_verify API.
> >
> > [EMAIL PROTECTED] libwww-perl-5.64]# diff -u
> lib/LWP/Protocol/https.pm.old
>
> > lib/LWP/Protocol/https.pm
> > --- lib/LWP/Protocol/https.pm.old     Fri Nov 16 18:10:28 2001
> > +++ lib/LWP/Protocol/https.pm Mon Mar 18 12:38:37 2002
> > @@ -34,7 +34,9 @@
> >       $res->header("Client-SSL-Cert-Subject" => $cert->subject_name);
> >       $res->header("Client-SSL-Cert-Issuer" => $cert->issuer_name);
> >      }
> > -    $res->header("Client-SSL-Warning" => "Peer certificate not
> verified");
> > +    if(! eval { $sock->get_peer_verify }) {
> > +     $res->header("Client-SSL-Warning" => "Peer certificate not
> verified");
> > +    }
> >  }
> >
> > Thanks,
> >
> > Josh
>
> One thing I notices is there is a LWP/Protocol/https10.pm that is also
> installed on my system and it does not have this conditional in it, but
> perhaps it should.
>
> Thanks,
>
> Steve...
>
> --
> Steve Kneizys
> Senior Business Process Engineer
> Ferrilli Information Group
> Voice: (610) 256-1396
> web: http://www.figsolutions.com/
>
> For Emergency Service (888)864-3282
>
>

From [email protected] on 2010-10-02 13:17:36:

This Debian bug report seems relevant.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503440

From [email protected] on 2010-12-20 20:39:44:

http://bugs.debian.org/503440 is marked as forwarded upstream to

   https://rt.cpan.org/Public/Bug/Display.html?id=61340

But i don't think these are the same issue at all.

the CPAN bug has nothing to do with using a proxy.

the debian bug is about LWP failing to make proper use of the HTTP
proxy, as noted here:


http://www.annocpan.org/~GAAS/libwww-perl-5.834/lib/LWP/UserAgent.pm#note_751

I think the appropriate CPAN bug to reference is actually:

  https://rt.cpan.org/Public/Bug/Display.html?id=1894

	--dkg

From [email protected] on 2017-01-25 21:41:12:

migrated queues: libwww-perl -> LWP-Protocol-https

Crypt::SSLeay should work transparently with Mozilla::CA [rt.cpan.org #66561]

Migrated from rt.cpan.org#66561 (status was 'open')

Requestors:

From [email protected] on 2011-03-12 03:37:41:

Currently a user will get this if they have Crypt::SSLeay installed, but
not IO::Socket::SSL:

$ perl -MLWP::UserAgent -MMozilla::CA -E
'LWP::UserAgent->new->get("https://encrypted.google.com/")->dump'500
Can't connect to encrypted.google.com:443 (Crypt-SSLeay can't verify
hostnames)
...

Would it be possible for LWP to set the HTTPS_CA_FILE environment
variable for Crypt::SSLeay? Then as long as Mozilla::CA is installed,
either SSL backend module would work without the user having to tweak
settings.

$ perl -MLWP::UserAgent -MMozilla::CA -E
'$ENV{HTTPS_CA_FILE}=Mozilla::CA::SSL_ca_file();
LWP::UserAgent->new->get("https://encrypted.google.com/")->dump'
HTTP/1.1 200 OK
...

From [email protected] on 2011-03-12 15:23:18:

Net::HTTPS will already set up $ENV{HTTPS_CA_FILE} based on Mozilla::CA's file.  The issue is 
that Crypt::SSLeay don't implement what corresponds to the SSL_verifycn_scheme option for 
IO::Socket::SSL and this option is implied by the 'verify_hostname' option.

If you disable 'verify_hostname' and set SSL_verify_mode => 1 then Net::SSL will verify that the 
certificate is legal, but only by setting various Client-* headers in the response.

From [email protected] on 2011-03-12 18:16:00:

On Sat Mar 12 10:23:18 2011, GAAS wrote:
> Net::HTTPS will already set up $ENV{HTTPS_CA_FILE} based on
> Mozilla::CA's file.  The issue is
> that Crypt::SSLeay don't implement what corresponds to the
> SSL_verifycn_scheme option for
> IO::Socket::SSL and this option is implied by the 'verify_hostname'
> option.
> 
> If you disable 'verify_hostname' and set SSL_verify_mode => 1 then
> Net::SSL will verify that the
> certificate is legal, but only by setting various Client-* headers in
> the response.

As many, many modules have libwww-perl as a dependency, I was hoping
this could be handled at the highest common level, instead of having
each dependent module author trying to solve this themselves. Maybe make
a note that this is on the todo wishlist, and some japh might submit a
patch :) Until that happens, how about adding a method to test if the
user needs to disable verify_hostname?

From [email protected] on 2017-01-25 21:41:23:

migrated queues: libwww-perl -> LWP-Protocol-https

Dependency not mentioned in META [rt.cpan.org #83004]

Migrated from rt.cpan.org#83004 (status was 'new')

Requestors:

From [email protected] on 2013-01-28 16:47:33:

Reproduce:

On clean CentOS 5.x (which is supported till Y2017 btw):
install perl-Net-SSLeay OS package.
then

cpan -i LWP::Protocol::https

it will fail, with

t/apache....NOK 1                                                      
     
#   Failed test at t/apache.t line 14.
t/apache....NOK 2                                                      
     
#   Failed test at t/apache.t line 15.
#                   'you need at least Net::SSLeay version 1.33 for
getting subjectAltNames at
/usr/lib/perl5/site_perl/5.8.8/IO/Socket/SSL.pm line 1702
# '
#     doesn't match '(?-xism:Apache Software Foundation)'
# Looks like you failed 2 tests of 2.


because we have older Net::SSLeay version, and minimal version 1.33 is
not mentioned in META.yml


https_proxy.t hangs on perl 5.27.8, Windows

Windows XP SP3 Russian
Strawberry perl 5.27.8 built with "gcc (i686-posix-dwarf, Built by strawberryperl.com project) 7.1.0"
Did not hang on 5.27.6, 5.27.1, 5.26.0.

All tests of https_proxy.t pass, it just does not exit.

LWP::Protocol::https discards 0 value for SSL_VERIFY_mode [rt.cpan.org #111517]

Migrated from rt.cpan.org#111517 (status was 'open')

Requestors:

From [email protected] on 2016-01-28 16:53:08:

Hello,

If you want to disable ssl cert verification, you need to use
SSL_VERIFY_NONE, which resolves to 0. LWP::Protocol::https transforms this
value to 1:

$ssl_opts{SSL_verify_mode} ||= 1;
Patch:

--- https_old.pm        2016-01-28 16:51:38.970331004 +0000
+++ https.pm    2016-01-28 16:42:22.410331004 +0000
@@ -17,7 +17,8 @@
     my $self = shift;
     my %ssl_opts = %{$self->{ua}{ssl_opts} || {}};
     if (delete $ssl_opts{verify_hostname}) {
-       $ssl_opts{SSL_verify_mode} ||= 1;
+       $ssl_opts{SSL_verify_mode} = defined $ssl_opts{SSL_verify_mode} ?
$ssl_opts{SSL_verify_mode} : 1;
+
        $ssl_opts{SSL_verifycn_scheme} = 'www';
     }
     else {
-- 
Errietta Kostala
<[email protected]>

From [email protected] on 2016-01-28 16:54:36:

Versions:
LWP::Protocol::https 6.06
This is perl 5, version 22, subversion 1 (v5.22.1) built for
x86_64-linux-gnu-thread-multi


On Thu, Jan 28, 2016 at 4:53 PM Bugs in LWP-Protocol-https via RT <
[email protected]> wrote:

>
> Greetings,
>
> This message has been automatically generated in response to the
> creation of a trouble ticket regarding:
>         "LWP::Protocol::https discards 0 value for SSL_VERIFY_mode",
> a summary of which appears below.
>
> There is no need to reply to this message right now.  Your ticket has been
> assigned an ID of [rt.cpan.org #111517].  Your ticket is accessible
> on the web at:
>
>     https://rt.cpan.org/Ticket/Display.html?id=111517
>
> Please include the string:
>
>          [rt.cpan.org #111517]
>
> in the subject line of all future correspondence about this issue. To do
> so,
> you may reply to this message.
>
>                         Thank you,
>                         [email protected]
>
> -------------------------------------------------------------------------
> Hello,
>
> If you want to disable ssl cert verification, you need to use
> SSL_VERIFY_NONE, which resolves to 0. LWP::Protocol::https transforms this
> value to 1:
>
> $ssl_opts{SSL_verify_mode} ||= 1;
> Patch:
>
> --- https_old.pm        2016-01-28 16:51:38.970331004 +0000
> +++ https.pm    2016-01-28 16:42:22.410331004 +0000
> @@ -17,7 +17,8 @@
>      my $self = shift;
>      my %ssl_opts = %{$self->{ua}{ssl_opts} || {}};
>      if (delete $ssl_opts{verify_hostname}) {
> -       $ssl_opts{SSL_verify_mode} ||= 1;
> +       $ssl_opts{SSL_verify_mode} = defined $ssl_opts{SSL_verify_mode} ?
> $ssl_opts{SSL_verify_mode} : 1;
> +
>         $ssl_opts{SSL_verifycn_scheme} = 'www';
>      }
>      else {
> --
> Errietta Kostala
> <[email protected]>
>
-- 
Errietta Kostala
<[email protected]>

From [email protected] on 2016-05-15 21:25:35:

I can confirm this bug. In general it is of course not a good thing to turn off SSL verification but there are legitimate cases for this. This bug in combination with changed behavior in IO::Socket::SSL makes it impossible to turn off SSL verification (it used to be possible to pass a non-numerical value to IO::Socket::SSL and that would do the trick).

Fixing this would be highly appreciated!

/Sune

--
Sune Karlsson
Professor of Statistics
Handelshögskolan/�rebro University School of Business
�rebro University, SE-70182 �rebro, Sweden
Phone +46 19 301257
http://www.oru.se/hh/sune_karlsson
http://econpapers.repec.org/RAS/pka1.htm


From [email protected] on 2016-07-06 23:24:15:

Please also change

$ssl_opts{SSL_verifycn_scheme} = 'www';
to
$ssl_opts{SSL_verifycn_scheme} ||= 'www';

That way we can pass along our own verification scheme.
 For example if we want to verify a portion of the hostname or something like:
 LWP::UserAgent->new( ssl_opts => {
   SSL_verifycn_scheme => {
    callback => sub {
     if ($_[1] =~ m/^$_[0]:.*/) {
         return 1;
     }
      return 0;
     }
  }});

From [email protected] on 2016-07-06 23:38:07:

Also in the same method, shouldn't the return be

return ($self->SUPER::_extra_sock_opts, %ssl_opts);
not
return (%ssl_opts, $self->SUPER::_extra_sock_opts);

Otherwise your base class would be overriding your subclasses options.

On Wed Jul 06 19:24:15 2016, [email protected] wrote:
> Please also change
> 
> $ssl_opts{SSL_verifycn_scheme} = 'www';
> to
> $ssl_opts{SSL_verifycn_scheme} ||= 'www';
> 
> That way we can pass along our own verification scheme.
>  For example if we want to verify a portion of the hostname or
> something like:
>  LWP::UserAgent->new( ssl_opts => {
>    SSL_verifycn_scheme => {
>     callback => sub {
>      if ($_[1] =~ m/^$_[0]:.*/) {
>          return 1;
>      }
>       return 0;
>      }
>   }});


cpan does not pick up release 6.06, stays with 6.04

The latest version of LWP::Protocol::https inside 02packages.details.txt.gz is 6.04 from GAAS, instead of 6.06 from MSCHILLI. Thus a default install of this module with cpan installs version 6.04 which is missing important fixes like support for https proxy. I don't know what need to be done to fix this, but the same maintainer change for libwww-perl worked, while for lwp-protocol-https not.

Make test consistently fails

Basically I always get

 Can't connect to www.apache.org:443 (No route to host)
 LWP::Protocol::https::Socket: connect: No route to host at /Library/Perl/5.10.0/LWP/Protocol/http.pm line 51.

I've tried switching out apache.org for other things but that unfortunately doesn't help.

I seemed to have narrowed it down to LWP::Protocol::http::Socket - if I remove LWP::Protocol::http::SocketMethods from @isa then the socket gets created.

I'm not entirely sure what's going to be honest. Everything works fine on an Ubuntu VM on the same machine.

This is all on

perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
  Platform:
    osname=darwin, osvers=10.0, archname=darwin-thread-multi-2level
    uname='darwin pizzly.apple.com 10.0 darwin kernel version 10.0.0: fri jul 31 22:46:25 pdt 2009; root:xnu-1456.1.25~1release_x86_64 x86_64 '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags= -Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none -Dcc=gcc-4.2'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc-4.2', ccflags ='-arch x86_64 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include',
    optimize='-Os',
    cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc-4.2 -mmacosx-version-min=10.6.3', ldflags ='-arch x86_64 -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib
    libs=-ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-arch x86_64 -bundle -undefined dynamic_lookup -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_PERLIO USE_REENTRANT_API
  Locally applied patches:
    /Library/Perl/Updates/<version> comes before system perl directories
    installprivlib and installarchlib points to the Updates directory
  Built under darwin
  Compiled at Jan 26 2010 17:48:53
  @INC:
    /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level
    /Library/Perl/Updates/5.10.0
    /System/Library/Perl/5.10.0/darwin-thread-multi-2level
    /System/Library/Perl/5.10.0
    /Library/Perl/5.10.0/darwin-thread-multi-2level
    /Library/Perl/5.10.0
    /Network/Library/Perl/5.10.0/darwin-thread-multi-2level
    /Network/Library/Perl/5.10.0
    /Network/Library/Perl
    /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.10.0

LWP::Protocol::https/_check_sock() has insufficient certificate checking [rt.cpan.org #43733]

Migrated from rt.cpan.org#43733 (status was 'open')

Requestors:

From [email protected] on 2009-02-28 12:30:17:

Forwarding from http://bugs.debian.org/507402
---

Forwarded from Ubuntu #198874 
(https://bugs.launchpad.net/ubuntu/+source/libwww-perl/+bug/198874):

The reporter states:
"See LWP::Protocol::https class, the _check_sock function:

we don't execute $sock->get_peer_verify before checking the cert's 
subject against $req->header("If-SSL-Cert-Subject").

$sock->get_peer_verify gets called only *after* we have pushed all of 
our request to the server (possibly containing critical data including 
passwords) -- that is BAAAAD. Basically, all of that renders SSL support 
in LWP::UserAgent not only meaningless, but also gives the user 
impression of security, which is not only bad, but almost a malicious 
thing to do.

More experimentation has shown that this only happens when doing "use 
IO::Socket::SSL". Otherwise, Crypt::SSLeay is used and that one shows 
the opposite behaviour: unverified server certs are NEVER accepted. I 
don't even know how to set the verification level und neither seems to 
be documented what exactly gets verified.... (server name at least?? How 
about redirects?....)

Please fix this and/or report it upstream because I consider it a major 
issue."

From [email protected] on 2017-01-25 21:41:06:

migrated queues: libwww-perl -> LWP-Protocol-https

From [email protected] on 2017-01-25 22:16:28:

Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian Perl Group <[email protected]>

If you wish to submit further information on this problem, please
send it to [email protected].

Please do not send mail to [email protected] unless you wish
to report a problem with the Bug-tracking system.

-- 
507402: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=507402
Debian Bug Tracking System
Contact [email protected] with problems

X-Died header appears in apache.t [rt.cpan.org #91653]

Migrated from rt.cpan.org#91653 (status was 'open')

Requestors:

From [email protected] on 2013-12-25 15:13:57:

But only in first request, second request is ok. Does not depend on presence of IO::Socket::INET6.
Strawberry perl 5.16.0
Mozilla::CA 20120309
IO::Socket::INET6 2.71
IO::Socket::SSL 1.962

with diagnostic patch https://github.com/libwww-perl/lwp-protocol-https/pull/9

not ok 2
#   Failed test at t/apache.t line 22.
#                   ''
#     doesn't match '(?^:Apache Software Foundation)'
not ok 3 - no X-Died header
#   Failed test 'no X-Died header'
#   at t/apache.t line 24.
#          got: 'read failed: No such file or directory at C:/strawberry160/perl
/site/lib/LWP/Protocol/http.pm line 414.'
#     expected: undef

-- 
Alexandr Ciornii, http://chorny.net

From [email protected] on 2015-06-10 18:40:59:

On Wed Dec 25 10:13:57 2013, CHORNY wrote:
> not ok 2
> #   Failed test at t/apache.t line 22.
> #                   ''
> #     doesn't match '(?^:Apache Software Foundation)'
> not ok 3 - no X-Died header
> #   Failed test 'no X-Died header'
> #   at t/apache.t line 24.
> #          got: 'read failed: No such file or directory at

I used to see this error too, but it is now gone.  I suspect it was fixed by updating Net::HTTP with the fix for RT#104122.

You may want to update to Net-HTTP-6.09  and check if you can still reproduce this issue.

Cheers,
-Jan

From [email protected] on 2015-06-10 21:15:48:

On Wed Jun 10 14:40:59 2015, JDB wrote:
> On Wed Dec 25 10:13:57 2013, CHORNY wrote:
> > not ok 2
> > #   Failed test at t/apache.t line 22.
> > #                   ''
> > #     doesn't match '(?^:Apache Software Foundation)'
> > not ok 3 - no X-Died header
> > #   Failed test 'no X-Died header'
> > #   at t/apache.t line 24.
> > #          got: 'read failed: No such file or directory at
> 
> I used to see this error too, but it is now gone.  I suspect it was
> fixed by updating Net::HTTP with the fix for RT#104122.
> 
> You may want to update to Net-HTTP-6.09  and check if you can still
> reproduce this issue.

Checked, same error.


-- 
Alexandr Ciornii, http://chorny.net

debian squeeze - perl update - error cpan LWP::Protocol::https [rt.cpan.org #105889]

Migrated from rt.cpan.org#105889 (status was 'open')

Requestors:

From [email protected] on 2015-07-16 06:02:26:

hello ,

i would like to use youtube-viewer on debian squeeze. it comes only with 
perl -v 5.10 so i updated systemwide via perlbrew

the program gives after compiling error
[501 Protocol scheme 'https' is not supported (LWP::Protocol::https not 
installed)]

LWP::Protocol::https is not available on squeeze


so i do

cpan LWP::Protocol::https


but this does not work out with the perlbrew version


#   Failed test at t/apache.t line 25.
# Looks like you failed 3 tests of 5.
t/apache.t ....... Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/5 subtests
t/https_proxy.t .. Can't locate IO/Socket/SSL.pm in @INC (you may need 
to install the IO::Socket::SSL module)) at 
/home/ricci/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/Net/HTTPS.pm 
line 27.
Can't locate Net/SSL.pm in @INC (you may need to install the Net::SSL 
module) (@INC contains: 
/home/ricci/.cpan/build/LWP-Protocol-https-6.06-nAuSue/blib/lib 
/home/ricci/.cpan/build/LWP-Protocol-https-6.06-nAuSue/blib/arch 
/home/ricci/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/x86_64-linux 
/home/ricci/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1 
/home/ricci/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1/x86_64-linux 
/home/ricci/perl5/perlbrew/perls/perl-5.20.1/lib/5.20.1 .) at 
/home/ricci/perl5/perlbrew/perls/perl-5.20.1/lib/site_perl/5.20.1/Net/HTTPS.pm 
line 31.
Compilation failed in require at 
/home/ricci/.cpan/build/LWP-Protocol-https-6.06-nAuSue/blib/lib/LWP/Protocol/https.pm 
line 8.
Compilation failed in require at t/https_proxy.t line 14.
BEGIN failed--compilation aborted at t/https_proxy.t line 14.
t/https_proxy.t .. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run

Test Summary Report
-------------------
t/apache.t     (Wstat: 768 Tests: 5 Failed: 3)
   Failed tests:  1, 3-4
   Non-zero exit status: 3
t/https_proxy.t (Wstat: 512 Tests: 0 Failed: 0)
   Non-zero exit status: 2
   Parse errors: No plan found in TAP output
Files=2, Tests=5,  0 wallclock secs ( 0.04 usr  0.00 sys +  0.16 cusr 
0.00 csys =  0.20 CPU)
Result: FAIL
Failed 2/2 test programs. 3/5 subtests failed.
make: *** [test_dynamic] Fehler 2
   MSCHILLI/LWP-Protocol-https-6.06.tar.gz
one dependency not OK (IO::Socket::SSL); additionally test harness failed
   /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
   reports MSCHILLI/LWP-Protocol-https-6.06.tar.gz




what i can do ? reinstall and use another method for updating perl? how 
can i overcome and install LWP-Protocol-https on Debian Squeeze?


Thanks - Danke - Grazie - Multumesq

From [email protected] on 2015-07-16 12:42:37:

You have problem installing IO::Socket::SSL. Check that you have libssl-dev package installed and try installing IO::Socket::SSL. If you still have problems, report it to IO::Socket::SSL bug tracker.

-- 
Alexandr Ciornii, http://chorny.net

Proxy test failures

Using perl 5.22.3 on Linux I am consistently getting the following failures ...

# creating cert for direct.ssl.access
# creating cert for direct.ssl.access
# creating cert for foo
# creating cert for foo

#   Failed test 'proxy https://foo/bar -> C.9.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: '6.2.Tauth@foo'
#     expected: 'C.9.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: close
# Content-Length: 85
# Content-Type: text/plain
# Client-Date: Fri, 21 Apr 2017 12:17:47 GMT
# Client-Peer: 127.0.0.1:58862
# Client-Response-Num: 1
# 
# ID: 6.2.Tauth@foo
# ---------
# GET /bar HTTP/
# Host: foo
# User-Agent: libwww-perl/6.26
# creating cert for bar
# creating cert for bar

#   Failed test 'proxy https://bar/bar -> F.3.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: '8.2.Tauth@bar'
#     expected: 'F.3.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: close
# Content-Length: 85
# Content-Type: text/plain
# Client-Date: Fri, 21 Apr 2017 12:17:47 GMT
# Client-Peer: 127.0.0.1:58862
# Client-Response-Num: 1
# 
# ID: 8.2.Tauth@bar
# ---------
# GET /bar HTTP/
# Host: bar
# User-Agent: libwww-perl/6.26
# creating cert for foo

#   Failed test 'proxy https://foo/tor -> C.10.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: '9.2.Tauth@foo'
#     expected: 'C.10.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: close
# Content-Length: 85
# Content-Type: text/plain
# Client-Date: Fri, 21 Apr 2017 12:17:47 GMT
# Client-Peer: 127.0.0.1:58862
# Client-Response-Num: 1
# 
# ID: 9.2.Tauth@foo
# ---------
# GET /tor HTTP/
# Host: foo
# User-Agent: libwww-perl/6.26
# creating cert for bar

#   Failed test 'proxy https://bar/tor -> F.4.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: '10.2.Tauth@bar'
#     expected: 'F.4.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: close
# Content-Length: 86
# Content-Type: text/plain
# Client-Date: Fri, 21 Apr 2017 12:17:47 GMT
# Client-Peer: 127.0.0.1:58862
# Client-Response-Num: 1
# 
# ID: 10.2.Tauth@bar
# ---------
# GET /tor HTTP/
# Host: bar
# User-Agent: libwww-perl/6.26
# creating cert for foo
# creating cert for foo
# creating cert for bar
# creating cert for bar
# Looks like you failed 4 tests of 56.
t/https_proxy.t .. 
Dubious, test returned 4 (wstat 1024, 0x400)
Failed 4/56 subtests 

In case it matters I have dependencies ...

Checking if you have IO::Socket::SSL 1.54 ... Yes (2.046)
Checking if you have Mozilla::CA 20110101 ... Yes (20130114)
Checking if you have Net::HTTPS 6 ... Yes (6.09)
Checking if you have Test::More 0 ... Yes (1.302075)
Checking if you have LWP::UserAgent 6.06 ... Yes (6.26)
Checking if you have Test::RequiresInternet 0 ... Yes (0.05)

LWP over HTTPS eats up to 100% of CPU on either slow connection or server [rt.cpan.org #80444]

Migrated from rt.cpan.org#80444 (status was 'new')

Requestors:

From [email protected] on 2012-10-28 04:13:45:

Hello there,

The reason why it happens (subject) is because it calls read/sysread millions of
times without waiting for read event. It fails with EAGAIN. I was
looking at the code and here is what i saw:

== lib / LWP / Protocol / https.pm ==
our @ISA = qw(Net::HTTPS LWP::Protocol::http::SocketMethods);
== lib / LWP / Protocol / https.pm ==

The parents order. Because Net::HTTPS goes first, it handles the sysread call.
That means sysread/can_read/select/sysread sequence from SocketMethods
never happens.
Looks it easy to fix, but it is not. You can't just change the order.
In this case sysread would not reach IO::Socket::SSL.

What i could do and it actually worked for me is copy/paste
sysread/can_read from SocketMethods and call IO::Socket::SSL::sysread
at the end. I guess there should be better way.

Thank you!

No warning or indication is given when the server is using RC4 protocol

Now that the RC4 cipher has been deprecated, this module should at minimum give some kind of warning when a connection is made to a server that uses this cipher.

Even better would be to refuse any connection using this cipher by default. An option could be added to ssl_options, something like { allow_rc4 => 1 } for people who absolutely insist on continuing to use it.

tests failed on install with cpanm

I initially reported this bug over on rt.cpan.org before finding a note in the Changes file that this is the recommended bug location. The metacpan.org page for this module links to rt so I thought it was the recommended location.

Hi,

I'm trying to install the module version 6.09 in perl on a newly setup centos 7 server. I get tests failed on install:

[root@cloud1 LWP-Protocol-https-6.09]# ls
blib  Changes  CONTRIBUTING.md  cpanfile  dist.ini  Install  lib  LICENSE  Makefile  Makefile.PL  MANIFEST  META.json  META.yml  MYMETA.json  MYMETA.yml  perlcriticrc  perltidyrc  pm_to_blib  t  tidyall.ini  xt
[root@cloud1 LWP-Protocol-https-6.09]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-report-prereqs.t .. #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 6.68
#
# === Configure Suggests ===
#
#     Module      Want Have
#     -------- ------- ----
#     JSON::PP 2.27300 4.05
#
# === Build Requires ===
#
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 6.68
#
# === Test Requires ===
#
#     Module                 Want     Have
#     ---------------------- ---- --------
#     ExtUtils::MakeMaker     any     6.68
#     File::Spec              any     3.40
#     File::Temp              any   0.2301
#     IO::Select              any     1.21
#     IO::Socket::INET        any     1.33
#     IO::Socket::SSL        1.54     1.94
#     IO::Socket::SSL::Utils  any     0.01
#     LWP::UserAgent         6.06     6.49
#     Socket                  any    2.030
#     Test::More              any 1.302183
#     Test::RequiresInternet  any     0.05
#     warnings                any     1.13
#
# === Test Recommends ===
#
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.150010
#
# === Runtime Requires ===
#
#     Module                  Want     Have
#     ------------------- -------- --------
#     IO::Socket::SSL         1.54     1.94
#     LWP::Protocol::http      any     6.49
#     LWP::UserAgent          6.06     6.49
#     Mozilla::CA         20180117 20200520
#     Net::HTTPS                 6     6.19
#     base                     any     2.18
#     strict                   any     1.07
#
t/00-report-prereqs.t .. ok
t/apache.t .............
    #   Failed test 'have header Client-SSL-Version'
    #   at t/apache.t line 39.
    # Looks like you failed 1 test of 6.
t/apache.t ............. 1/2
#   Failed test 'Request GET https://www.apache.org'
#   at t/apache.t line 47.
# Looks like you failed 1 test of 2.
t/apache.t ............. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests
t/https_proxy.t ........ skipped: no recent version of IO::Socket::SSL::Utils
t/method_in_san.t ...... ok

Test Summary Report
-------------------
t/apache.t           (Wstat: 256 Tests: 2 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=4, Tests=20,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.57 cusr  0.10 csys =  0.71 CPU)
Result: FAIL
Failed 1/4 test programs. 1/20 subtests failed.
make: *** [test_dynamic] Error 255

Perl is:

[root@cloud1 LWP-Protocol-https-6.09]# perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

  Platform:
    osname=linux, osvers=3.10.0-957.1.3.el7.x86_64, archname=x86_64-linux-thread-multi
    uname='linux x86-02.bsys.centos.org 3.10.0-957.1.3.el7.x86_64 #1 smp thu nov 29 14:49:43 utc 2018 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Dccdlflags=-Wl,--enable-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -Wl,-z,relro  -DDEBUGGING=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.8.5 20150623 (Red Hat 4.8.5-39)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -fstack-protector'
    libpth=/usr/local/lib64 /lib64 /usr/lib64
    libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
    perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro '


Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
                        USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API USE_SITECUSTOMIZE
  Locally applied patches:
        Fedora Patch1: Removes date check, Fedora/RHEL specific
        Fedora Patch3: support for libdir64
        Fedora Patch4: use libresolv instead of libbind
        Fedora Patch5: USE_MM_LD_RUN_PATH
        Fedora Patch6: Skip hostname tests, due to builders not being network capable
        Fedora Patch7: Dont run one io test due to random builder failures
        Fedora Patch9: Fix find2perl to translate ? glob properly (RT#113054)
        Fedora Patch10: Fix broken atof (RT#109318)
        Fedora Patch13: Clear $@ before "do" I/O error (RT#113730)
        Fedora Patch14: Do not truncate syscall() return value to 32 bits (RT#113980)
        Fedora Patch15: Override the Pod::Simple::parse_file (CPANRT#77530)
        Fedora Patch16: Do not leak with attribute on my variable (RT#114764)
        Fedora Patch17: Allow operator after numeric keyword argument (RT#105924)
        Fedora Patch18: Extend stack in File::Glob::glob, (RT#114984)
        Fedora Patch19: Do not crash when vivifying $|
        Fedora Patch20: Fix misparsing of maketext strings (CVE-2012-6329)
        Fedora Patch21: Add NAME headings to CPAN modules (CPANRT#73396)
        Fedora Patch22: Fix leaking tied hashes (RT#107000) [1]
        Fedora Patch23: Fix leaking tied hashes (RT#107000) [2]
        Fedora Patch24: Fix leaking tied hashes (RT#107000) [3]
        Fedora Patch25: Fix dead lock in PerlIO after fork from thread (RT#106212)
        Fedora Patch26: Make regexp safe in a signal handler (RT#114878)
        Fedora Patch27: Update h2ph(1) documentation (RT#117647)
        Fedora Patch28: Update pod2html(1) documentation (RT#117623)
        Fedora Patch29: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)
        RHEL Patch30: Use stronger algorithm needed for FIPS in t/op/crypt.t (RT#121591)
        RHEL Patch31: Make *DBM_File desctructors thread-safe (RT#61912)
        RHEL Patch32: Use stronger algorithm needed for FIPS in t/op/taint.t (RT#123338)
        RHEL Patch33: Remove CPU-speed-sensitive test in Benchmark test
        RHEL Patch34: Make File::Glob work with threads again
        RHEL Patch35: Fix CRLF conversion in ASCII FTP upload (CPAN RT#41642)
        RHEL Patch36: Do not leak the temp utf8 copy of namepv (CPAN RT#123786)
        RHEL Patch37: Fix duplicating PerlIO::encoding when spawning threads (RT#31923)
        RHEL Patch38: Add SSL support to Net::SMTP (CPAN RT#93823) [1]
        RHEL Patch39: Add SSL support to Net::SMTP (CPAN RT#93823) [2]
        RHEL Patch40: Add SSL support to Net::SMTP (CPAN RT#93823) [3]
        RHEL Patch41: Add SSL support to Net::SMTP (CPAN RT#93823) [4]
        RHEL Patch42: Do not overload ".." in Math::BigInt (CPAN RT#80182)
        RHEL Patch43: Fix CVE-2018-18311 Integer overflow leading to buffer overflow
        RHEL Patch44: Fix a spurious timeout in Net::FTP::close (CPAN RT#18504)
  Built under linux
  Compiled at Apr  2 2020 01:18:37
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5
    .

t/apache.t fails: connection refused [rt.cpan.org #67001]

Migrated from rt.cpan.org#67001 (status was 'open')

Requestors:

From [email protected] on 2011-03-27 16:24:59:

apache.org apparently is refusing connection based on useragent, so the test fails. i swapped 
apache.org with bankofamerica.com and it worked.  it might be a good idea to cycle through a 
randomized list of sites, and pass the test on the first successful site.

also, maybe this should be added as the first test:
ok($ua->is_protocol_supported('https'));

From [email protected] on 2012-02-18 22:53:20:

Seems unlikely that apache.org is denying access based on that.  Must be some other reason.  

From [email protected] on 2012-12-26 21:16:38:

i think this is an ipv6 problem related to:

http://stackoverflow.com/questions/11463748/perl-iosocketssl-connect-network-is-
unreachable

i was [finally] able to re-produce in CentOS6 x64, even with (i think) ipv6 turned off in the 
kernel, the app is trying to leverage the ipv6 nameserver response (for some reason it seems 
like RHEL wants to load up the ipv6 mod, but leave it 'disabled', which might be screwing up 
other code when they get ipv6 records back from NS and then repsond back with a network 
failure)

i tested against apache and google.com, same thing, added the 'inet4' to a fork of t/apache.t 
and it seems to work again.

this doesn't seem to happen on debian or ubuntu.. (fwiw), so i'm guessing it's a RHEL 
derivative thing.

i dunno that it's "safe" to have these sorts of network tests w/o explicit v4 or v6 
assignments... even though it's correct in saying something's wrong, wget and other apps 
seem to work OK, so maybe this is something that needs to be solved further down in the 
stack...(?)

probably a RHEL / IO::Socket::SSL bug (or similar), but for now, would it be safe to implicitly 
put inet4 in the test script?

something like:

use IO::Socket::SSL 'inet4';

From [email protected] on 2012-12-27 11:50:08:

more data:

after drilling down a bit more, i think it's a system call issue with centos and io-socket-inet6..

still something to be aware of with the tests (imo).

From [email protected] on 2012-12-27 12:08:40:

confirmed, bug is in io-socket-inet6 < 2.56 or so. seems to be fixed by 2.69, problem is the 
author of inet6 has some test bugs that need resolving. a straight install works and appears to 
solve the problem. i checked on ubuntu and that version of INET6.pm was > than 2.55, but that 
machine also has full ipv6 routing too...

again, something to be aware of when writing network tests...

From [email protected] on 2014-03-02 19:10:26:

On Thu Dec 27 07:08:40 2012, SAXJAZMAN wrote:
> confirmed, bug is in io-socket-inet6 < 2.56 or so. seems to be fixed
> by 2.69, problem is the
> author of inet6 has some test bugs that need resolving. a straight
> install works and appears to
> solve the problem. i checked on ubuntu and that version of INET6.pm
> was > than 2.55, but that
> machine also has full ipv6 routing too...
> 
> again, something to be aware of when writing network tests...

I ran into this issue trying to install Crypt::SSLeay on Mac OS X 10.6 with perl 5.10.  Crypt::SSLeay was suggesting that libssl-dev was missing but after some digging and finding this I updated IO::Socket::INET6 and Crypt::SSLeay along with LWP::Protocol::https installed properly.

From [email protected] on 2014-03-02 19:25:31:

On Sun Mar 02 14:10:26 2014, [email protected] wrote:

> I updated
> IO::Socket::INET6 and Crypt::SSLeay along with LWP::Protocol::https
> installed properly.

note that it was updated from version 2.56 to 2.72

From [email protected] on 2014-03-04 04:19:03:

On Sun Mar 02 14:25:31 2014, [email protected] wrote:
> On Sun Mar 02 14:10:26 2014, [email protected] wrote:
> 
> > I updated
> > IO::Socket::INET6 and Crypt::SSLeay along with LWP::Protocol::https
> > installed properly.
> 
> note that it was updated from version 2.56 to 2.72

I just tried using 2.57 and it did not allow LWP::Protocol::https to install but 2.58 did.

From [email protected] on 2014-03-07 15:15:24:

On Mon Mar 03 23:19:03 2014, [email protected] wrote:

> I just tried using 2.57 and it did not allow LWP::Protocol::https to
> install but 2.58 did.

Reported this as an issue with IO::Socket::INET6 here:
https://rt.cpan.org/Public/Bug/Display.html?id=93503

The next release should make things happy

[PRC] How may I be of help

Hi,
I have been assigned this module for the May PRC. I have seen a few issues, one of them since 2012. Could I help with any of them? Would you want me to do something completely different?

HTTPS authentication error hangs instead of returning authentication error. Fix included. [rt.cpan.org #66657]

Migrated from rt.cpan.org#66657 (status was 'open')

Requestors:

From [email protected] on 2011-03-16 11:00:24:

Hi,

We are using LWP 5.837, bundled with ActiveState 5.10.1008 on Windows 7 64 bit, but I just took a look at the libwww-perl repository on github and the most recent commit, 93c26dd32aea887331860e7afbc68d34e141ddab, has the same issue I think.

What I was trying to do was doing a POST request on a https url that requires basic authentication, deliberately giving it wrong credentials. Instead of returning an HTTP::response object with a 401 error, the HTTP::UserAgent->request call just hang and never returned. Tracking it down I found out that the actual call that was not returning was in Net::HTTP::Methods::my_read, calling $self->sysread.

Turns out that in our case $self->sysread resolves to Net::SSL::read, which I think should have been 
LWP::Protocol::http::SocketMethods::sysread instead.

In our case Net::HTTPS isa Net::SSL and Net::SSL implements a sysread, which gets found earlier than LWP::Protocol::https::SocketMethods' sysread due to the order in which perl looks for methods in superclasses.
The origin of this problem resides in LWP::Protocol::https.pm, in which I think this line:

@ISA = qw(Net::HTTPS LWP::Protocol::http::SocketMethods);

should be:

@ISA = qw(LWP::Protocol::http::SocketMethods Net::HTTPS);

At least in our case this change fixes the problem. The wrongly authenticated request now returns with a HTTP::response object having the 401 status and doesn't hang anymore.

Regards,
Tom Koelman

From [email protected] on 2017-01-25 21:41:28:

migrated queues: libwww-perl -> LWP-Protocol-https

Unable to install on MacOS 12.1 with perl 5.34

Software

  • MacOS 12.1
  • Perl 5.34
  • openssl

To reproduce:

  • Install MacOS 12.1
  • Install Homebrew
  • brew install perl
  • brew install openssl
  • cpan LWP::Protocol::https

See output:

Test Summary Report
-------------------
t/apache.t           (Wstat: 512 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
t/https_proxy.t      (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/method_in_san.t    (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 17 tests but ran 0.
Files=4, Tests=3,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.50 cusr  0.12 csys =  0.65 CPU)
Result: FAIL
Failed 3/4 test programs. 2/3 subtests failed.
make: *** [test_dynamic] Error 22
  OALDERS/LWP-Protocol-https-6.10.tar.gz
2 dependencies missing (IO::Socket::SSL,IO::Socket::SSL::Utils); additionally test harness failed
  /usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports OALDERS/LWP-Protocol-https-6.10.tar.gz

Tried workarounds:

  • linking openssl to from homebrew to /usr/local/include/openssl and /usr/local/bin/openssl

apache.t fails due to firewall [rt.cpan.org #85957]

Migrated from rt.cpan.org#85957 (status was 'new')

Requestors:

  • 'spro^^%^6ut#@&$%*c

From $_ = 'spro^^%^6ut#@&$�>#!^!#&!pan.org'; y/a-z.@//cd; print on 2013-06-07 20:57:54:

If there is no network access, or the firewall is blocking access, I should still be able to install LWP::Protocol::https without having to force it.

Perhaps apache.t should use a short timeout and skip the test.

https_proxy.t fails

Strawberry perl 5.16.0
Mozilla::CA 20120309
IO::Socket::INET6 2.71
IO::Socket::SSL 1.962

1..56
ok 1 - noproxy http://127.0.0.1:2809/foo -> A.1@nossl
ok 2 - URL in request -> /foo
ok 3 - noproxy http://127.0.0.1:2809/bar -> A.2@nossl
ok 4 - URL in request -> /bar
ok 5 - noproxy http://127.0.0.1:2810/foo -> B.1@nossl
ok 6 - URL in request -> /foo
ok 7 - noproxy http://127.0.0.1:2810/bar -> B.2@nossl
ok 8 - URL in request -> /bar
ok 9 - noproxy http://127.0.0.1:2809/tor -> A.3@nossl
ok 10 - URL in request -> /tor
ok 11 - noproxy http://127.0.0.1:2810/tor -> B.3@nossl
ok 12 - URL in request -> /tor
ok 13 - proxy http://foo/foo -> C.1.auth@nossl
ok 14 - URL in request -> http://foo/foo
ok 15 - proxy http://foo/bar -> C.2.auth@nossl
ok 16 - URL in request -> http://foo/bar
ok 17 - proxy http://bar/foo -> C.3.auth@nossl
ok 18 - URL in request -> http://bar/foo
ok 19 - proxy http://bar/bar -> C.4.auth@nossl
ok 20 - URL in request -> http://bar/bar
ok 21 - proxy http://foo/tor -> C.5.auth@nossl
ok 22 - URL in request -> http://foo/tor
ok 23 - proxy http://bar/tor -> C.6.auth@nossl
ok 24 - URL in request -> http://bar/tor
# creating cert for direct.ssl.access
ok 25 - noproxy https://127.0.0.1:2809/foo -> [email protected]
ok 26 - URL in request -> /foo
ok 27 - noproxy https://127.0.0.1:2809/bar -> [email protected]
ok 28 - URL in request -> /bar
# creating cert for direct.ssl.access
ok 29 - noproxy https://127.0.0.1:2810/foo -> [email protected]
ok 30 - URL in request -> /foo
ok 31 - noproxy https://127.0.0.1:2810/bar -> [email protected]
ok 32 - URL in request -> /bar
ok 33 - noproxy https://127.0.0.1:2809/tor -> [email protected]
ok 34 - URL in request -> /tor
ok 35 - noproxy https://127.0.0.1:2810/tor -> [email protected]
ok 36 - URL in request -> /tor
not ok 37 - proxy https://foo/foo -> C.8.Tauth@foo
#   Failed test 'proxy https://foo/foo -> C.8.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: 'C.7.auth@nossl'
#     expected: 'C.8.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 181
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:14 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 7
# 
# ID: 3.7.auth@nossl
# ---------
# GET https://foo/foo HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE

# Host: foo

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 38 - URL in request -> /foo
#   Failed test 'URL in request -> /foo'
#   at t/https_proxy.t line 190.
#          got: 'https://foo/foo'
#     expected: '/foo'
not ok 39 - proxy https://foo/bar -> C.9.Tauth@foo
#   Failed test 'proxy https://foo/bar -> C.9.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: 'C.8.auth@nossl'
#     expected: 'C.9.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 181
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:14 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 8
# 
# ID: 3.8.auth@nossl
# ---------
# GET https://foo/bar HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE

# Host: foo

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 40 - URL in request -> /bar
#   Failed test 'URL in request -> /bar'
#   at t/https_proxy.t line 190.
#          got: 'https://foo/bar'
#     expected: '/bar'
not ok 41 - proxy https://bar/foo -> F.2.Tauth@bar
#   Failed test 'proxy https://bar/foo -> F.2.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: 'C.9.auth@nossl'
#     expected: 'F.2.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 181
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:14 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 9
# 
# ID: 3.9.auth@nossl
# ---------
# GET https://bar/foo HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE

# Host: bar

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 42 - URL in request -> /foo
#   Failed test 'URL in request -> /foo'
#   at t/https_proxy.t line 190.
#          got: 'https://bar/foo'
#     expected: '/foo'
not ok 43 - proxy https://bar/bar -> F.3.Tauth@bar
#   Failed test 'proxy https://bar/bar -> F.3.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: 'C.10.auth@nossl'
#     expected: 'F.3.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 182
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:15 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 10
# 
# ID: 3.10.auth@nossl
# ---------
# GET https://bar/bar HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE

# Host: bar

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 44 - URL in request -> /bar
#   Failed test 'URL in request -> /bar'
#   at t/https_proxy.t line 190.
#          got: 'https://bar/bar'
#     expected: '/bar'
not ok 45 - proxy https://foo/tor -> C.10.Tauth@foo
#   Failed test 'proxy https://foo/tor -> C.10.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: 'C.11.auth@nossl'
#     expected: 'C.10.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 182
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:15 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 11
# 
# ID: 3.11.auth@nossl
# ---------
# GET https://foo/tor HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE

# Host: foo

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 46 - URL in request -> /tor
#   Failed test 'URL in request -> /tor'
#   at t/https_proxy.t line 190.
#          got: 'https://foo/tor'
#     expected: '/tor'
not ok 47 - proxy https://bar/tor -> F.4.Tauth@bar
#   Failed test 'proxy https://bar/tor -> F.4.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: 'C.12.auth@nossl'
#     expected: 'F.4.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 182
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:15 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 12
# 
# ID: 3.12.auth@nossl
# ---------
# GET https://bar/tor HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE

# Host: bar

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 48 - URL in request -> /tor
#   Failed test 'URL in request -> /tor'
#   at t/https_proxy.t line 190.
#          got: 'https://bar/tor'
#     expected: '/tor'
not ok 49 - proxy_nokeepalive https://foo/foo -> H.2.Tauth@foo
#   Failed test 'proxy_nokeepalive https://foo/foo -> H.2.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: 'H.1.auth@nossl'
#     expected: 'H.2.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 188
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:15 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 1
# 
# ID: 6.1.auth@nossl
# ---------
# GET https://foo/foo HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE, close

# Host: foo

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 50 - URL in request -> /foo
#   Failed test 'URL in request -> /foo'
#   at t/https_proxy.t line 190.
#          got: 'https://foo/foo'
#     expected: '/foo'
not ok 51 - proxy_nokeepalive https://foo/bar -> I.2.Tauth@foo
#   Failed test 'proxy_nokeepalive https://foo/bar -> I.2.Tauth@foo'
#   at t/https_proxy.t line 182.
#          got: 'I.1.auth@nossl'
#     expected: 'I.2.Tauth@foo'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 188
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:15 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 1
# 
# ID: 7.1.auth@nossl
# ---------
# GET https://foo/bar HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE, close

# Host: foo

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 52 - URL in request -> /bar
#   Failed test 'URL in request -> /bar'
#   at t/https_proxy.t line 190.
#          got: 'https://foo/bar'
#     expected: '/bar'
not ok 53 - proxy_nokeepalive https://bar/foo -> J.2.Tauth@bar
#   Failed test 'proxy_nokeepalive https://bar/foo -> J.2.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: 'J.1.auth@nossl'
#     expected: 'J.2.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 188
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:16 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 1
# 
# ID: 8.1.auth@nossl
# ---------
# GET https://bar/foo HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE, close

# Host: bar

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 54 - URL in request -> /foo
#   Failed test 'URL in request -> /foo'
#   at t/https_proxy.t line 190.
#          got: 'https://bar/foo'
#     expected: '/foo'
not ok 55 - proxy_nokeepalive https://bar/bar -> K.2.Tauth@bar
#   Failed test 'proxy_nokeepalive https://bar/bar -> K.2.Tauth@bar'
#   at t/https_proxy.t line 182.
#          got: 'K.1.auth@nossl'
#     expected: 'K.2.Tauth@bar'
# HTTP/1.1 200 ok
# Connection: keep-alive
# Content-Length: 188
# Content-Type: text/plain
# Client-Date: Wed, 25 Dec 2013 14:20:16 GMT
# Client-Peer: 127.0.0.1:2809
# Client-Response-Num: 1
# 
# ID: 9.1.auth@nossl
# ---------
# GET https://bar/bar HTTP/1.1

# TE: deflate,gzip;q=0.3

# Connection: TE, close

# Host: bar

# Proxy-Authorization: Basic Zm9vOmJhcg==

# User-Agent: libwww-perl/6.05

not ok 56 - URL in request -> /bar
#   Failed test 'URL in request -> /bar'
#   at t/https_proxy.t line 190.
#          got: 'https://bar/bar'
#     expected: '/bar'
# Looks like you failed 20 tests of 56.

hostname verification against certificate is already done by IO::Socket::SSL - no need to reimplement it (and implement it wrong)

Hi,
checking if a certificate matches the hostname is already done by IO::Socket::SSL and LWP::Protocol::https sets also the necessary SSL_verifycn_scheme to www. So there is no need to reimplement it like done with _cn_match and _in_san.

Apart from that the code is wrong, e.g. it does not check against common name if no subjectAltNames are given, it uses IP in subjectAltNames like host names and the wildcard handling does not match against w*.example.org as required by rfc2818.

Unable to install this in Ubuntu 20.04

It apparently requires a version of several libraries, libssl and libcrypto, which are not in the repositories or are in a different version, namely, 1.1.

When I create a symbolic link from the existing version to the required version, even so, it misses some Net::SSLeay file or some such; essentially, what #62 says. Is there a list of prerequisites needed for this to work somewhere? Together with instructions on how to install it?

The perl I'm using has been installed via perlbrew, so installing the Ubuntu package for this does not seem to install the needed system-level libraries. So I'm really stumped about what to do here.

Test 'https_proxy.t' fails on windows 10

While installing the module through cpan, the 'https_proxy.t' testcase is failing with error - unexpected response: 500 SSL upgrade failed: SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

The error is similar to #58. Since the test case is different and different OS hence creating this ticket. Installing it on personal PC hence no corporate firewall.

Perl version - Strawberry Perl 5.30.1 built for MSWin32-x64-multi-thread
LWP::UserAgent - 6.42

Here is the full installation log -

PS C:\> cpan install LWP::Protocol::https
Loading internal logger. Log::Log4perl recommended for better logging
CPAN: CPAN::SQLite loaded ok (v0.217)
Database was generated on Sun, 22 Nov 2020 20:05:47 GMT
Running install for module 'LWP::Protocol::https'
CPAN: Digest::SHA loaded ok (v6.02)
CPAN: Compress::Zlib loaded ok (v2.09)
Checksum for C:\berrybrew\5.30.1_64\cpan\sources\authors\id\O\OA\OALDERS\LWP-Protocol-https-6.09.tar.gz ok
CPAN: Archive::Tar loaded ok (v2.32)
CPAN: YAML::XS loaded ok (v0.80)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20191120)
Configuring O/OA/OALDERS/LWP-Protocol-https-6.09.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a gmake-style Makefile
Writing Makefile for LWP::Protocol::https
Writing MYMETA.yml and MYMETA.json
  OALDERS/LWP-Protocol-https-6.09.tar.gz
  C:\berrybrew\5.30.1_64\perl\bin\perl.exe Makefile.PL -- OK
Running make for O/OA/OALDERS/LWP-Protocol-https-6.09.tar.gz
cp lib/LWP/Protocol/https.pm blib\lib\LWP\Protocol\https.pm
  OALDERS/LWP-Protocol-https-6.09.tar.gz
  C:\berrybrew\5.30.1_64\c\bin\gmake.exe -- OK
Running make test for OALDERS/LWP-Protocol-https-6.09.tar.gz
"C:\berrybrew\5.30.1_64\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/00-report-prereqs.t .. #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.38
#
# === Configure Suggests ===
#
#     Module      Want Have
#     -------- ------- ----
#     JSON::PP 2.27300 4.04
#
# === Build Requires ===
#
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.38
#
# === Test Requires ===
#
#     Module                 Want     Have
#     ---------------------- ---- --------
#     ExtUtils::MakeMaker     any     7.38
#     File::Spec              any     3.78
#     File::Temp              any   0.2309
#     IO::Select              any     1.40
#     IO::Socket::INET        any     1.40
#     IO::Socket::SSL        1.54    2.066
#     IO::Socket::SSL::Utils  any    2.014
#     LWP::UserAgent         6.06     6.42
#     Socket                  any    2.029
#     Test::More              any 1.302169
#     Test::RequiresInternet  any     0.05
#     warnings                any     1.44
#
# === Test Recommends ===
#
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.150010
#
# === Runtime Requires ===
#
#     Module                  Want     Have
#     ------------------- -------- --------
#     IO::Socket::SSL         1.54    2.066
#     LWP::Protocol::http      any     6.42
#     LWP::UserAgent          6.06     6.42
#     Mozilla::CA         20180117 20180117
#     Net::HTTPS                 6     6.19
#     base                     any     2.27
#     strict                   any     1.11
#
t/00-report-prereqs.t .. ok
t/apache.t ............. ok
t/https_proxy.t ........ 1/56 # creating cert for direct.ssl.access
# creating cert for direct.ssl.access
# creating cert for foo
unexpected response: 500 SSL upgrade failed: SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Content-Type: text/plain
Client-Date: Sun, 22 Nov 2020 20:14:20 GMT
Client-Warning: Internal response

SSL upgrade failed: SSL connect attempt failed error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed at C:/berrybrew/5.30.1_64/perl/vendor/lib/LWP/Protocol/http.pm line 209.
# Looks like your test exited with 9 just after 36.
t/https_proxy.t ........ Dubious, test returned 9 (wstat 2304, 0x900)
Failed 20/56 subtests
t/method_in_san.t ...... ok

Test Summary Report
-------------------
t/https_proxy.t      (Wstat: 2304 Tests: 36 Failed: 0)
  Non-zero exit status: 9
  Parse errors: Bad plan.  You planned 56 tests but ran 36.
Files=4, Tests=56,  6 wallclock secs ( 0.03 usr +  0.03 sys =  0.06 CPU)
Result: FAIL
Failed 1/4 test programs. 0/56 subtests failed.
gmake: *** [Makefile:890: test_dynamic] Error 255
  OALDERS/LWP-Protocol-https-6.09.tar.gz
  C:\berrybrew\5.30.1_64\c\bin\gmake.exe test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
  reports OALDERS/LWP-Protocol-https-6.09.tar.gz
Stopping: 'install' failed for 'LWP::Protocol::https'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.