Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::https::nb(3pm) [debian man page]

Net::HTTPS::NB(3pm)					User Contributed Perl Documentation				       Net::HTTPS::NB(3pm)

NAME
Net::HTTPS::NB - Non-blocking HTTPS client SYNOPSIS
Example from Net::HTTP::NB use Net::HTTPS::NB; use IO::Select; use strict; my $s = Net::HTTPS::NB->new(Host => "pause.perl.org") || die $@; $s->write_request(GET => "/"); my $sel = IO::Select->new($s); READ_HEADER: { die "Header timeout" unless $sel->can_read(10); my($code, $mess, %h) = $s->read_response_headers; redo READ_HEADER unless $code; } while(1) { die "Body timeout" unless $sel->can_read(10); my $buf; my $n = $s->read_entity_body($buf, 1024); last unless $n; print $buf; } Example of non-blocking connect use strict; use Net::HTTPS::NB; use IO::Select; my $sock = Net::HTTPS::NB->new(Host => 'encrypted.google.com', Blocking => 0); my $sele = IO::Select->new($sock); until ($sock->connected) { if ($HTTPS_ERROR == HTTPS_WANT_READ) { $sele->can_read(); } elsif($HTTPS_ERROR == HTTPS_WANT_WRITE) { $sele->can_write(); } else { die 'Unknown error: ', $HTTPS_ERROR; } } See `examples' subdirectory for more examples. DESCRIPTION
Same interface as Net::HTTPS but it will never try multiple reads when the read_response_headers() or read_entity_body() methods are invoked. In addition allows non-blocking connect. If read_response_headers() did not see enough data to complete the headers an empty list is returned. If read_entity_body() did not see new entity data in its read the value -1 is returned. PACKAGE CONSTANTS
Imported by default HTTPS_WANT_READ HTTPS_WANT_WRITE PACKAGE VARIABLES
Imported by default $HTTPS_ERROR METHODS
new(%cfg) Same as Net::HTTPS::new, but in addition allows `Blocking' parameter. By setting this parameter to 0 you can perform non-blocking connect. See connected() to determine when connection completed. connected() Returns true value when connection completed (https handshake done). Otherwise returns false. In this case you can check $HTTPS_ERROR to determine what handshake need for, read or write. $HTTPS_ERROR could be HTTPS_NEED_READ or HTTPS_NEED_WRITE respectively. See "SYNOPSIS". blocking($flag) As opposed to Net::HTTPS where blocking method consciously broken you can set socket blocking. For example you can return socket to blocking state after non-blocking connect. SEE ALSO
Net::HTTP, Net::HTTP::NB COPYRIGHT
Copyright 2011 Oleg G <oleg@cpan.org>. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-06-07 Net::HTTPS::NB(3pm)

Check Out this Related Man Page

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

NAME
Net::SSL - support for Secure Sockets Layer METHODS
new Creates a new "Net::SSL" object. configure Configures a "Net::SSL" socket for operation. configure_certs Sets up a certificate file to use for communicating with on the socket. connect die_with_error get_cipher get_lwp_object Walks up the caller stack and looks for something blessed into the "LWP::UserAgent" namespace and returns it. Vaguely deprecated. get_peer_certificate Gets the peer certificate from the underlying "Crypt::SSLeay::Conn" object. get_peer_verify get_shared_ciphers getchunk Attempts to read up to 32KiB of data from the socket. Returns "undef" if nothing was read, otherwise returns the data as a scalar. getline Reads one character at a time until a newline is encountered, and returns the line, including the newline. Grossly inefficient. print Concatenates the input parameters and writes them to the socket. Does not honour $, nor $/. Returns the number of bytes written. printf 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. proxy Returns the hostname of an https proxy server, as specified by the "HTTPS_PROXY" environment variable. proxy_connect_helper Helps set up a connection through a proxy. read Performs a read on the socket and returns the result. ssl_context sysread Is an alias of "read". timeout Returns the timeout value of the socket as defined by the implementing class or 60 seconds by default. blocking 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. write Writes the parameters passed in (thus, a list) to the socket. Returns the number of bytes written. syswrite Is an alias of "write". accept Not yet implemented. Will die if called. getc Not yet implemented. Will die if called. getlines Not yet implemented. Will die if called. ungetc Not yet implemented. Will die if called. send_useragent_to_proxy 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). DIAGNOSTICS
"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 "proxy.example.com:8086". "configure certs failed: <contents of $@>; <contents of $!>" "proxy connect failed: <contents of $@>; <contents of $!>" "Connect failed: <contents of $@>; <contents of $!>" During connect(). SEE ALSO IO::Socket::INET "Net::SSL" is implemented by subclassing "IO::Socket::INET", hence methods not specifically overridden are defined by that package. Net::SSLeay A package that provides a Perl-level interface to the "openssl" secure sockets layer library. perl v5.14.2 2010-08-24 Net::SSL(3pm)
Man Page