8fkdZddlZddlZddlZddlZddlmZmZddlm Z ddlm Z ddlm Z mZmZmZddlmZddlmZmZdd lmZdd lmZmZdd lmZdd lmZdd lmZddl m!Z!ddl"m#Z#ddl$m%Z%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m Z m,Z,m-Z-m.Z.mZm/Z/m0Z0mZddl1m2Z2ddl3m4Z4ddl5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>n#e?$rdZ>YnwxYwej@rddl1mAZAdZBdZCdZDdZE ddlFZFe!ZGeGHe7e6n #e?$rdZGYnwxYw d+d&ZIGd'd(ZJGd)d*eJZKdS),z requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. N)ClosedPoolErrorConnectTimeoutError) HTTPError) InvalidHeader)LocationValueError MaxRetryErrorNewConnectionError ProtocolError) ProxyError)ReadTimeoutError ResponseError)SSLError) PoolManagerproxy_from_url)Timeout) parse_url)Retry)create_urllib3_context)_basic_auth_str) basestringurlparse)extract_cookies_to_jar) ConnectionErrorConnectTimeoutrInvalidProxyURL InvalidSchema InvalidURLr ReadTimeout RetryErrorr)Response)CaseInsensitiveDict)DEFAULT_CA_BUNDLE_PATHextract_zipped_pathsget_auth_from_urlget_encoding_from_headersprepend_scheme_if_needed select_proxy urldefragauth)SOCKSProxyManagerc td)Nz'Missing dependencies for SOCKS support.)r)argskwargss }/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/requests/adapters.pyr*r*?sEFFF)PreparedRequestF requestr0verifybool | str | None client_cert#typing.Tuple[str, str] | str | None poolmanagerrreturn<(typing.Dict[str, typing.Any], typing.Dict[str, typing.Any])c<i}i}t|j}|j}|j}t |di} | d} tduo| } d} |durd} nP|dur | r t|d<n?t|tr*tj |s||d<n||d<| |d <|Dt|tr*t|d kr|d |d <|d |d<n||d <||j|d}||fS)Nconnection_pool_kw ssl_context CERT_REQUIREDF CERT_NONETca_certs ca_cert_dir cert_reqsr cert_filerkey_file)schemehostport)rurlrElowerrGgetattrget_preloaded_ssl_context isinstancestrospathisdirtuplelenhostname) r2r3r5r7 host_params pool_kwargsparsed_request_urlrErGpoolmanager_kwargshas_poolmanager_ssl_contextshould_use_default_ssl_contextrAs r._urllib3_request_contextr[Zsn KK!'+..  & , , . .F  "D!.BBGG"4"8"8"G"Gd*N3N/N# I  4:%; M"" FC 0w}}V$$ 0&,K # #)/K &(K  k5 ) ) 3c+.>.>!.C.C'21~K $&1!nK # #(3K $"+K  ##r/c2eZdZdZfdZ ddZdZxZS) BaseAdapterzThe Base Transport AdaptercHtdSN)super__init__)self __class__s r.razBaseAdapter.__init__s r/FNTct)aCSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. NotImplementedError)rbr2streamtimeoutr3certproxiess r.sendzBaseAdapter.sends ""!r/ct)z!Cleans up adapter specific items.rerbs r.closezBaseAdapter.closes!!r/FNTNN)__name__ __module__ __qualname____doc__rarkrn __classcell__rcs@r.r]r]sh$$TX""""&"""""""r/r]ceZdZdZgdZeeeeffd ZdZ dZ efdZ dZ dZ d Zdd Zdd Zdd ZdZdZdZdZ ddZxZS) HTTPAdapteraThe built-in HTTP Adapter for urllib3. Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the :class:`Session ` class under the covers. :param pool_connections: The number of urllib3 connection pools to cache. :param pool_maxsize: The maximum number of connections to save in the pool. :param max_retries: The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3's ``Retry`` class and pass that instead. :param pool_block: Whether the connection pool should block for connections. Usage:: >>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a) ) max_retriesconfig_pool_connections _pool_maxsize _pool_blockc4|tkrtdd|_ntj||_i|_i|_t ||_||_ ||_ | |||dS)NrF)readblock) DEFAULT_RETRIESrrxfrom_intry proxy_managerr`rarzr{r|init_poolmanager)rbpool_connections pool_maxsizerx pool_blockrcs r.razHTTPAdapter.__init__s / ) )$QU333D  $~k::D   !1)% . JOOOOOr/c*fdjDS)Nc4i|]}|t|dSr_)rJ).0attrrbs r. z,HTTPAdapter.__getstate__..s'KKKDgdD$//KKKr/) __attrs__rms`r. __getstate__zHTTPAdapter.__getstate__sKKKKDNKKKKr/ci|_i|_|D]\}}t|||||j|j|jdS)Nr)rryitemssetattrrrzr{r|)rbstatervalues r. __setstate__zHTTPAdapter.__setstate__sz   ;;== ' 'KD% D$ & & & &   "D$6d>N      r/c Z||_||_||_td|||d||_dS)aInitializes a urllib3 PoolManager. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param connections: The number of urllib3 connection pools to cache. :param maxsize: The maximum number of connections to save in the pool. :param block: Block when no free connections are available. :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. ) num_poolsmaxsizerN)rzr{r|rr7)rb connectionsrrrVs r.rzHTTPAdapter.init_poolmanagersQ"-$ & !     r/c ||jvr|j|}n|dr?t|\}}t |f|||j|j|jd|x}|j|<n@||}t|f||j|j|jd|x}|j|<|S)aReturn urllib3 ProxyManager for the given proxy. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The proxy to return a urllib3 ProxyManager for. :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. :returns: ProxyManager :rtype: urllib3.ProxyManager socks)usernamepasswordrrr) proxy_headersrrr) rrI startswithr%r*rzr{r|rr)rbproxy proxy_kwargsmanagerrrrs r.proxy_manager_forzHTTPAdapter.proxy_manager_for s D& & &(/GG [[]] % %g . . !25!9!9 Hh2C3!!0*& 3333 Gd(//!..u55M2@3+0*& 33  33 Gd(/r/c|dro|rmd|_|dura|}tj|st d|tj|s||_n||_ nd|_d|_d|_ |rt|ts|d|_ |d|_ n||_ d|_ |j r;tj|j st d |j |j r=tj|j st d |j dSdSdS) aAVerify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: The SSL certificate to verify. httpsr=TzCCould not find a suitable TLS CA certificate bundle, invalid path: r>Nrrz7Could not find the TLS certificate file, invalid path: z/Could not find the TLS key file, invalid path: )rIrrArOrPexistsOSErrorrQr?r@rMrrCrD)rbconnrHr3ricert_locs r. cert_verifyzHTTPAdapter.cert_verify0s 99;; ! !' * * $v $,DN T!!!w~~h//!4)144 w}}X..0$,DMM'/D$(DN DM#D   dJ// %!%a $Q !% $ ~ bgnnT^&D&D 6%)^66} RW^^DM%B%B UdmUU      r/ct}t|dd|_tt|di|_t |j|_||_|jj|_t|j tr |j d|_ n |j |_ t|j||||_||_|S)aBuilds a :class:`Response ` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter ` :param req: The :class:`PreparedRequest ` used to generate the response. :param resp: The urllib3 response object. :rtype: requests.Response statusNheaderszutf-8)r!rJ status_coder"rr&encodingrawreasonrMrHbytesdecodercookiesr2 connection)rbreqrespresponses r.build_responsezHTTPAdapter.build_responsegs:: 'tXt<</wtY/K/KLL6h6FGG ",- cgu % % #7>>'22HLL7HL x/d;;;"r/Nc0t||||jS)a Build the PoolKey attributes used by urllib3 to return a connection. This looks at the PreparedRequest, the user-specified verify value, and the value of the cert parameter to determine what PoolKey values to use to select a connection from a given urllib3 Connection Pool. The SSL related pool key arguments are not consistently set. As of this writing, use the following to determine what keys may be in that dictionary: * If ``verify`` is ``True``, ``"ssl_context"`` will be set and will be the default Requests SSL Context * If ``verify`` is ``False``, ``"ssl_context"`` will not be set but ``"cert_reqs"`` will be set * If ``verify`` is a string, (i.e., it is a user-specified trust bundle) ``"ca_certs"`` will be set if the string is not a directory recognized by :py:func:`os.path.isdir`, otherwise ``"ca_certs_dir"`` will be set. * If ``"cert"`` is specified, ``"cert_file"`` will always be set. If ``"cert"`` is a tuple with a second item, ``"key_file"`` will also be present To override these settings, one may subclass this class, call this method and use the above logic to change parameters as desired. For example, if one wishes to use a custom :py:class:`ssl.SSLContext` one must both set ``"ssl_context"`` and based on what else they require, alter the other keys to ensure the desired behaviour. :param request: The PreparedReqest being sent over the connection. :type request: :class:`~requests.models.PreparedRequest` :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param cert: (optional) Any user-provided SSL certificate for client authentication (a.k.a., mTLS). This may be a string (i.e., just the path to a file which holds both certificate and key) or a tuple of length 2 with the certificate file path and key file path. :returns: A tuple of two dictionaries. The first is the "host parameters" portion of the Pool Key including scheme, hostname, and port. The second is a dictionary of SSLContext related parameters. )r[r7)rbr2r3ris r.$build_connection_pool_key_attributesz0HTTPAdapter.build_connection_pool_key_attributess`(t?OPPPr/ct|j|} ||||\}}n##t$r}t ||d}~wwxYw|r\t |d}t |} | jstd| |} | j di|d|i} n|j j di|d|i} | S)aqReturns a urllib3 connection for the given request and TLS settings. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` object to be sent over the connection. :param verify: Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. :param proxies: (optional) The proxies dictionary to apply to the request. :param cert: (optional) Any user-provided SSL certificate to be used for client authentication (a.k.a., mTLS). :rtype: urllib3.ConnectionPool r2NhttpFPlease check proxy URL. It is malformed and could be missing the host.rVr) r(rHr ValueErrorrr'rrFrrconnection_from_hostr7) rbr2r3rjrirrUrVe proxy_urlrrs r.get_connection_with_tls_contextz+HTTPAdapter.get_connection_with_tls_contextsA(W['22 1'+'P'P(( $K  1 1 1Q000 0 1  ,UF;;E!%((I> %5!22599M5=5+6DD 94#8+6D s2 AA  Actjdtt||}|r`t |d}t |}|jstd||}| |}n=t|}| }|j |}|S)aDEPRECATED: Users should move to `get_connection_with_tls_context` for all subclasses of HTTPAdapter using Requests>=2.32.2. Returns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param url: The URL to connect to. :param proxies: (optional) A Requests-style dictionary of proxies used on this request. :rtype: urllib3.ConnectionPool z`get_connection` has been deprecated in favor of `get_connection_with_tls_context`. Custom HTTPAdapter subclasses will need to migrate for Requests>=2.32.2. Please see https://github.com/psf/requests/pull/6710 for more details.rr) warningswarnDeprecationWarningr(r'rrFrrconnection_from_urlrgeturlr7)rbrHrjrrrrparseds r.get_connectionzHTTPAdapter.get_connections  N    S'**  =,UF;;E!%((I> %5!22599M 44S99DDc]]F--//C#77<`. :param request: The :class:`PreparedRequest ` being sent. :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. :rtype: str rFrz///) r(rHrrErIrpath_urllstripr)) rbr2rjrrEis_proxied_http_requestusing_socks_proxy proxy_schemerHs r. request_urlzHTTPAdapter.request_url"sW['22'+&&-"'"=Fg,=!  A#E??17799L , 7 7 @ @  >>$   ('cjjoo''C " -+< - ,,C r/c dS)a"Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the :class:`HTTPAdapter `. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` to add headers to. :param kwargs: The keyword arguments from the call to send(). Nr)rbr2r-s r. add_headerszHTTPAdapter.add_headersBs  r/cXi}t|\}}|rt|||d<|S)aReturns a dictionary of the headers to add to any request sent through a proxy. This works with urllib3 magic to ensure that they are correctly sent to the proxy, rather than in a tunnelled request if CONNECT is being used. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param proxy: The url of the proxy being used for this request. :rtype: dict zProxy-Authorization)r%r)rbrrrrs r.rzHTTPAdapter.proxy_headersPs>.u55(  Q-f$rx}t|t8rt;||t|t@rtC||t|tDrtG||d}~wwxYw|$|| S) aSends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple or urllib3 Timeout object :param verify: (optional) Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. :rtype: requests.Response )rjrirN)rgrhr3rirjzContent-Length)connectr~zInvalid timeout za. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same value.F) methodrHbodyrredirectassert_same_hostpreload_contentdecode_contentretriesrhchunked)%rrrrrHrrrrrMrR TimeoutSaucerurlopenrrxr rrrrrr rr r _ProxyErrorr _SSLErrorrr _HTTPErrorr r_InvalidHeaderrr)rbr2rgrhr3rirjrrrHrrr~rerrs r.rkzHTTPAdapter.sendes& 177t8DD" 1 1 1Q000 0 1 w{FD999w00      |t+R/?7?/RS gu % % B  ' &wTBBB    QwQQQ   . . B "7AAAG3 <<~\!& %$(  DDw' 8 8 8!#w777 7 6 6 6!($788 =!!(,>??=(G<<<<!(M22 5 G4444!(K00 5 G4444!(I.. 3q'2222!!W555 5 6 6 6!!W555 5   Q-- :&   !Y'' q'2222A/00 !!W5555A~.. #Aw7777 ""7D111sf <7<6C C+4E LE.. L;CI LI00 L=J  L A3LLr_)NNro)rprqrrrsrDEFAULT_POOLSIZErDEFAULT_POOLBLOCKrarrrrrrrrrrnrrrrkrtrus@r.rwrwsy4I*%#$ PPPPPP,LLL    +<    4$$$L555n###J0Q0Q0Q0Qd////b''''R@    ,TXj2j2j2j2j2j2j2j2r/rw) r2r0r3r4r5r6r7rr8r9)Lrsos.pathrOsockettypingrpip._vendor.urllib3.exceptionsrrrrrrrrr r r rr r rrpip._vendor.urllib3.poolmanagerrrpip._vendor.urllib3.utilrrrpip._vendor.urllib3.util.retryrpip._vendor.urllib3.util.ssl_rauthrcompatrrrr exceptionsrrrrrrr modelsr! structuresr"utilsr#r$r%r&r'r(r)!pip._vendor.urllib3.contrib.socksr* ImportError TYPE_CHECKINGr0rrrDEFAULT_POOL_TIMEOUTsslrLload_verify_locationsr[r]rwrr/r.rs. OOOOOOOOBBBBBBJJJJJJ EDDDDDJJJJJJJJ@@@@@@GGGGGGGG<<<<<<......000000@@@@@@!!!!!!((((((((++++++                        ++++++GCCCCCCCGGGGGGGGG  ('''''' "JJJ335500344""""" ,$ ,$ ,$7,$ ,$ D ,$,$,$,$^""""""""