Scroll to navigation

Net::SSL(3pm) User Contributed Perl Documentation Net::SSL(3pm)


Net::SSL - support for Secure Sockets Layer


Creates a new "Net::SSL" object.
Configures a "Net::SSL" socket for operation.
Sets up a certificate file to use for communicating with on the socket.
Walks up the caller stack and looks for something blessed into the "LWP::UserAgent" namespace and returns it. Vaguely deprecated.
Gets the peer certificate from the underlying "Crypt::SSLeay::Conn" object.
Attempts to read up to 32KiB of data from the socket. Returns "undef" if nothing was read, otherwise returns the data as a scalar.
Provides access to OpenSSL's "pending" attribute on the SSL connection object.
Reads one character at a time until a newline is encountered, and returns the line, including the newline. Grossly inefficient.
Concatenates the input parameters and writes them to the socket. Does not honour $, nor $/. Returns the number of bytes written.
Performs a "sprintf" of the input parameters (thus, the first parameter must be the format), and writes the result to the socket. Returns the number of bytes written.
Returns the hostname of an https proxy server, as specified by the "HTTPS_PROXY" environment variable.
Helps set up a connection through a proxy.
Performs a read on the socket and returns the result.
Is an alias of "read".
Returns the timeout value of the socket as defined by the implementing class or 60 seconds by default.
Returns a boolean indicating whether the underlying socket is in blocking mode. By default, Net::SSL sockets are in blocking mode.

    $sock->blocking(0); # set to non-blocking mode

This method simply calls the underlying "blocking" method of the IO::Socket object.

Writes the parameters passed in (thus, a list) to the socket. Returns the number of bytes written.
Is an alias of "write".
Not yet implemented. Will die if called.
Not yet implemented. Will die if called.
Not yet implemented. Will die if called.
Not yet implemented. Will die if called.
By default (as of version 2.80 of "Net::SSL" in the 0.54 distribution of Crypt::SSLeay), the user agent string is no longer sent to the proxy (but will continue to be sent to the remote host).

The previous behaviour was of marginal benefit, and could cause fatal errors in certain scenarios (see CPAN bug #4759) and so no longer happens by default.

To reinstate the old behaviour, call "Net::SSL::send_useragent_to_proxy" with a true value (usually 1).


  "no port given for proxy server <proxy>"

A proxy was specified for configuring a socket, but no port number was given. Ensure that the proxy is specified as a host:port pair, such as "".

  "configure certs failed: <contents of $@>; <contents of $!>"
  "proxy connect failed: <contents of $@>; <contents of $!>"
  "Connect failed: <contents of $@>; <contents of $!>"

During connect().


"Net::SSL" is implemented by subclassing "IO::Socket::INET", hence methods not specifically overridden are defined by that package.
A package that provides a Perl-level interface to the "openssl" secure sockets layer library.
2020-11-09 perl v5.32.0