8fLOddlmZddlZddlZddlZddlZddlZddlZddlmZ ddlm Z ddl m Z ddlmZddlmZdd lmZ ddlZejZn#eef$rdZGd d eZYnwxYw eZn#e$rGd d eZYnwxYw eZn#e$rGddeZYnwxYwddlmZddl m!Z!ddl"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(m)Z)m*Z*ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1ddl2m3Z3m4Z4ej5e6Z7dddZ8ej9dddZ:ej;dZ<Gddee=ZGddeZ>dZ?d Z@Gd!d"e=ZAeseAZ>e>ZBdS)#)absolute_importN)error)timeout)six)HTTPConnection) HTTPException)create_proxy_ssl_contextceZdZdS) BaseSSLErrorN__name__ __module__ __qualname__~/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/urllib3/connection.pyr r  rr ceZdZdS)ConnectionErrorNr rrrrr!rrrceZdZdS)BrokenPipeErrorNr rrrrr*rrr)HTTPHeaderDict __version__)ConnectTimeoutErrorNewConnectionErrorSubjectAltNameWarningSystemTimeWarning) SKIP_HEADERSKIPPABLE_HEADERS connection)assert_fingerprintcreate_urllib3_context is_ipaddressresolve_cert_reqsresolve_ssl_versionssl_wrap_socket)CertificateErrormatch_hostnamePi)httphttpsiz[^-!#$%&'*+.^_`|~0-9a-zA-Z]ceZdZdZedZejejdfgZ dZ dZ dZ e dZejdZd Zd Zd Zd Zd ZdZdfd ZddZxZS)ra5 Based on :class:`http.client.HTTPConnection` but provides an extra constructor backwards-compatibility layer between older and newer Pythons. Additional keyword parameters are used to configure attributes of the connection. Accepted parameters include: - ``strict``: See the documentation on :class:`urllib3.connectionpool.HTTPConnectionPool` - ``source_address``: Set the source address for the current connection. - ``socket_options``: Set specific options on the underlying socket. If not specified, then defaults are loaded from ``HTTPConnection.default_socket_options`` which includes disabling Nagle's algorithm (sets TCP_NODELAY to 1) unless the connection is behind a proxy. For example, if you wish to enable TCP Keep Alive in addition to the defaults, you might pass: .. code-block:: python HTTPConnection.default_socket_options + [ (socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1), ] Or you may want to disable the defaults by passing an empty list (e.g., ``[]``). r,rFNcTtjs|dd|d|_|d|j|_|dd|_|dd|_tj |g|Ri|dS)Nstrictsource_addresssocket_optionsproxy proxy_config) rPY2popgetr1default_socket_optionsr2r3r4_HTTPConnection__init__)selfargskws rr:zHTTPConnection.__init__ssw # FF8T " " "!ff%566!ff%5t7RSSVVGT** FF>488 333333333rc6|jdS)a Getter method to remove any trailing dots that indicate the hostname is an FQDN. In general, SSL certificates don't include the trailing dot indicating a fully-qualified domain name, and thus, they don't validate properly when checked against a domain name that includes the dot. In addition, some servers may not expect to receive the trailing dot when provided. However, the hostname with trailing dot is critical to DNS resolution; doing a lookup with the trailing dot will properly only resolve the appropriate FQDN, whereas a lookup without a trailing dot will search the system's search domain list. Thus, it's important to keep the original host around for use only in those cases where it's appropriate (i.e., when doing DNS lookup to establish the actual TCP connection across which we're going to send HTTP requests). .) _dns_hostrstripr;s rhostzHTTPConnection.hosts"~$$S)))rc||_dS)z Setter for the `host` property. We assume that only urllib3 uses the _dns_host attribute; httplib itself only uses `host`, and it seems reasonable that other libraries follow suit. N)r@)r;values rrCzHTTPConnection.hostsrc 8i}|jr |j|d<|jr |j|d< tj|j|jf|jfi|}nO#t$r"t|d|j d|jdt$r}t|d|zd}~wwxYw|S)zoEstablish a socket connection and set nodelay settings on it. :return: New socket connection. r1r2zConnection to z timed out. (connect timeout=)z(Failed to establish a new connection: %sN) r1r2r"create_connectionr@portr SocketTimeoutrrC SocketErrorr)r;extra_kwconnes r _new_connzHTTPConnection._new_conns    =)-)z+HTTPConnection.putheader..s6KKq:a%%:!{*:KKKKKKrz(urllib3.util.SKIP_HEADER only supports 'z', ''N) anyr9 putheaderr ensure_strlowerr!rajoinmaprktitlesorted)r;headervaluess rrqzHTTPConnection.putheadersKKFKKKKK   %dF .s4KKaqwwyy 9 9KKKKKKr User-Agent)bodyheaders) rRrU settimeoutrcopy_get_default_user_agentsuperrrequest)r;rdrerr __class__s rrzHTTPConnection.requests 4 & & 2 I  . . . ?GGllnnG KK7KKK K K$;$=$=GL ! nd##++FCdG+TTTTTrc>|pi}td|D}d|v}d|v}|||||d|vr"|dt|D]\}} ||| d|vr|dd ||t jtfz} t|| r|f}|D]} | st| ts| d } tt| d d } t| } | d z } | | z } | d z } || |dd S)z Alternative to the common request method, which sends the body with chunked encoding and not as one block cZg|](}tj|)Srr}r~s r z2HTTPConnection.request_chunked..s*FFF3>!''))44FFFrzaccept-encodingrC)skip_accept_encoding skip_hostr{rztransfer-encodingzTransfer-EncodingchunkedNutf8s s0 )setrcrqritems endheadersr string_typesbytesrjencodehexlen bytearraysend)r;rdrerr header_keysrrrxrEstringish_typeschunklen_strto_sends rrequest_chunkedzHTTPConnection.request_chunkeds -RFFgFFFGG 0K?k)   C.Bi     { * * NN<)@)B)B C C C$]]__ * *MFE NN65 ) ) ) ) k 1 1 NN. : : :   !.%9O$00 w # #!%//1!LL00Ec%jj//!""-#GNN$4$4557"5 7" '"""" ,r)NN)rrr__doc__port_by_scheme default_portsocket IPPROTO_TCP TCP_NODELAYr8 is_verifiedproxy_is_verifiedr:propertyrCsetterrOrSrYr\rcrqrr __classcell__)rs@rrrLs82"&)L &163EqIJK444"**X*$ [[>333!!! N N N U U U U U U% % % % % % % % rrceZdZdZedZdZdZdZdZ dZ dZ dZ ddddde jddfdZ d dZdZdZdS) HTTPSConnectionz Many of the parameters to this constructor are passed to the underlying SSL socket by means of :py:func:`urllib3.util.ssl_wrap_socket`. r-NFc  tj|||f||d| ||_||_||_||_| |_d|_dS)N)r0rr-)rr:key_file cert_file key_password ssl_contextserver_hostname _protocol) r;rCrIrrrr0rrrr=s rr:zHTTPSConnection.__init__.s\ dDWWWTVWWW  "(&.!rc J|#|j |jj}ntd}||_||_||_||_||_||_|otj ||_ |otj ||_ | |_dS)zX This method should only be called once, before the connection is used. N)r verify_moder&rr cert_reqsrassert_hostnamer#ospath expanduserca_certs ca_cert_dir ca_cert_data) r;rrrrrrr#rrs rset_certzHTTPSConnection.set_certHs"  + ,8 -d33   ""(."4 ARW%7%7%A%A &J27+=+=k+J+J(rc v|x|_}|j}d}|rH|jr|||x|_}d}|d|_|j}|}|j |j }tj tk}|r2tjdtt"d}|jTLSv1.1TLSv1zjNegotiating TLSv1/TLSv1.1 by default is deprecated and will be disabled in urllib3 v2.0.0. Connecting to 'z' with 'z;' can be enabled by explicitly opting-in with 'ssl_version') binary_formcheck_hostnamesubjectAltNamerCertificate for {0} has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/urllib3/urllib3/issues/497 for details.))/rOrUrCrStls_in_tls_required_connect_tls_proxyrVrWrQrdatetimedatetoday RECENT_DATEwarningswarnformatrrr$r'rr&rrrrrhasattrrr(rrrrDeprecationWarningr# getpeercertssl CERT_NONErRrr7r_match_hostname CERT_REQUIREDr) r;rMhostnamerr is_time_offdefault_ssl_contextcontextcerts rr\zHTTPSConnection.connectisy>>+++ D9  " " )' "#'#:#:8T#J#JJ D!  LLNNNDN(H"   +"2Om))++k9   M6&%%!    $   #"& 5/0@AA+DN;;   D  "/??   )$ )% )$  ) !566  )  & & ( ( (#M^*](*+!     "   ( 9--) !!##';;; MM)- 493D3D3F3F3F3FH#      " K  %%$%779P      3= 0 0G%5u== 1$E11 9((**D88,b11  ()/x(8(8) D$"6"I/ J J J  3#4 4 3&d2 rc.|j}|j}|rt|||St|j|j|j|j|j}t||j|j|j||}|j tj krst|ddsb|j }|dds-tjd|t$t'|||j tjk|_|S)zY Establish a TLS connection to the proxy using the provided SSL context. )rUrr)rUrrrrrrFrrr)r4rr(r rrrrrrrrrRrr7rrrrrrr)r;rrMr4rrrs rrz"HTTPSConnection._connect_tls_proxysB( ".  # ('  /   N M       !](*$#      "cm 3 3G )5= = 3 &6%''D88,b11  ()/x(8(8) D( + + +!,!8Crs&&&&&& ''''''++++++MMMMMM999999000000 JJJ