GRAYBYTE WORDPRESS FILE MANAGER7002

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib/python2.7/site-packages/pip/_vendor/urllib3/util/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib/python2.7/site-packages/pip/_vendor/urllib3/util//connection.py
from __future__ import absolute_import
import socket
from .wait import wait_for_read
from .selectors import HAS_SELECT, SelectorError


def is_connection_dropped(conn):  # Platform-specific
    """
    Returns True if the connection is dropped and should be closed.

    :param conn:
        :class:`httplib.HTTPConnection` object.

    Note: For platforms like AppEngine, this will always return ``False`` to
    let the platform handle connection recycling transparently for us.
    """
    sock = getattr(conn, 'sock', False)
    if sock is False:  # Platform-specific: AppEngine
        return False
    if sock is None:  # Connection already closed (such as by httplib).
        return True

    if not HAS_SELECT:
        return False

    try:
        return bool(wait_for_read(sock, timeout=0.0))
    except SelectorError:
        return True


# This function is copied from socket.py in the Python 2.7 standard
# library test suite. Added to its signature is only `socket_options`.
# One additional modification is that we avoid binding to IPv6 servers
# discovered in DNS if the system doesn't have IPv6 functionality.
def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
                      source_address=None, socket_options=None):
    """Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    An host of '' or port 0 tells the OS to use the default.
    """

    host, port = address
    if host.startswith('['):
        host = host.strip('[]')
    err = None

    # Using the value from allowed_gai_family() in the context of getaddrinfo lets
    # us select whether to work with IPv4 DNS records, IPv6 records, or both.
    # The original create_connection function always returns all records.
    family = allowed_gai_family()

    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
        af, socktype, proto, canonname, sa = res
        sock = None
        try:
            sock = socket.socket(af, socktype, proto)

            # If provided, set socket level options before connecting.
            _set_socket_options(sock, socket_options)

            if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
                sock.settimeout(timeout)
            if source_address:
                sock.bind(source_address)
            sock.connect(sa)
            return sock

        except socket.error as e:
            err = e
            if sock is not None:
                sock.close()
                sock = None

    if err is not None:
        raise err

    raise socket.error("getaddrinfo returns an empty list")


def _set_socket_options(sock, options):
    if options is None:
        return

    for opt in options:
        sock.setsockopt(*opt)


def allowed_gai_family():
    """This function is designed to work in the context of
    getaddrinfo, where family=socket.AF_UNSPEC is the default and
    will perform a DNS search for both IPv6 and IPv4 records."""

    family = socket.AF_INET
    if HAS_IPV6:
        family = socket.AF_UNSPEC
    return family


def _has_ipv6(host):
    """ Returns True if the system can bind an IPv6 address. """
    sock = None
    has_ipv6 = False

    if socket.has_ipv6:
        # has_ipv6 returns true if cPython was compiled with IPv6 support.
        # It does not tell us if the system has IPv6 support enabled. To
        # determine that we must bind to an IPv6 address.
        # https://github.com/shazow/urllib3/pull/611
        # https://bugs.python.org/issue658327
        try:
            sock = socket.socket(socket.AF_INET6)
            sock.bind((host, 0))
            has_ipv6 = True
        except Exception:
            pass

    if sock:
        sock.close()
    return has_ipv6


HAS_IPV6 = _has_ipv6('::1')

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 03 2024 20:23:47
root / root
0755
__init__.py
1.02 KB
April 21 2022 18:08:21
root / root
0644
__init__.pyc
1.247 KB
April 21 2022 18:08:35
root / root
0644
__init__.pyo
1.247 KB
April 21 2022 18:08:35
root / root
0644
connection.py
4.138 KB
April 21 2022 18:08:21
root / root
0644
connection.pyc
3.78 KB
April 21 2022 18:08:35
root / root
0644
connection.pyo
3.78 KB
April 21 2022 18:08:35
root / root
0644
request.py
3.618 KB
April 21 2022 18:08:21
root / root
0644
request.pyc
3.669 KB
April 21 2022 18:08:35
root / root
0644
request.pyo
3.669 KB
April 21 2022 18:08:35
root / root
0644
response.py
2.288 KB
April 21 2022 18:08:21
root / root
0644
response.pyc
2.243 KB
April 21 2022 18:08:35
root / root
0644
response.pyo
2.243 KB
April 21 2022 18:08:35
root / root
0644
retry.py
14.75 KB
April 21 2022 18:08:21
root / root
0644
retry.pyc
14.383 KB
April 21 2022 18:08:35
root / root
0644
retry.pyo
14.383 KB
April 21 2022 18:08:35
root / root
0644
selectors.py
20.651 KB
April 21 2022 18:08:21
root / root
0644
selectors.pyc
20.493 KB
April 21 2022 18:08:35
root / root
0644
selectors.pyo
20.493 KB
April 21 2022 18:08:35
root / root
0644
ssl_.py
11.928 KB
April 21 2022 18:08:21
root / root
0644
ssl_.pyc
10.356 KB
April 21 2022 18:08:35
root / root
0644
ssl_.pyo
10.356 KB
April 21 2022 18:08:35
root / root
0644
timeout.py
9.528 KB
April 21 2022 18:08:21
root / root
0644
timeout.pyc
9.488 KB
April 21 2022 18:08:35
root / root
0644
timeout.pyo
9.488 KB
April 21 2022 18:08:35
root / root
0644
url.py
6.639 KB
April 21 2022 18:08:21
root / root
0644
url.pyc
6.614 KB
April 21 2022 18:08:35
root / root
0644
url.pyo
6.614 KB
April 21 2022 18:08:35
root / root
0644
wait.py
1.417 KB
April 21 2022 18:08:21
root / root
0644
wait.pyc
1.799 KB
April 21 2022 18:08:35
root / root
0644
wait.pyo
1.799 KB
April 21 2022 18:08:35
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF