RepNddlmZddlZddlZddlZddlZddlZddlZddlmZ 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)ddl*m+Z+m,Z,m-Z-ddl.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4ej5e6Z7dddZ8ej9dddZ:ej;dZ<Gddee=ZGddeZ>d Z?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/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/urllib3/connection.pyr r  rr ceZdZdS)ConnectionErrorNr rrrrr!rrrceZdZdS)BrokenPipeErrorNr rrrrr*rrr)HTTPHeaderDict __version__)ConnectTimeoutErrorNewConnectionErrorSubjectAltNameWarningSystemTimeWarning)CertificateErrormatch_hostname) SKIP_HEADERSKIPPABLE_HEADERS connection)assert_fingerprintcreate_urllib3_context is_ipaddressresolve_cert_reqsresolve_ssl_versionssl_wrap_socketPi)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) rPY2popgetr2default_socket_optionsr3r4r5_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)rA)r<values rrDzHTTPConnection.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. r2r3zConnection to z timed out. (connect timeout=)z(Failed to establish a new connection: %sN) r2r3r$create_connectionrAportr SocketTimeoutrrD SocketErrorr)r<extra_kwconnes r _new_connzHTTPConnection._new_conns    =)-)z+HTTPConnection.putheader..s6KKq:a%%:!{*:KKKKKKrz(urllib3.util.SKIP_HEADER only supports 'z', ''N) anyr: putheaderr ensure_strlowerr#rbjoinmaprltitlesorted)r<headervaluess rrrzHTTPConnection.putheadersKKFKKKKK   %dF .s4KKaqwwyy 9 9KKKKKKr User-Agent)bodyheaders)copy_get_default_user_agentsuperrrequest)r<rerfrr __class__s rrzHTTPConnection.requestsu ?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~rs r z2HTTPConnection.request_chunked..s*FFF3>!''))44FFFrzaccept-encodingrD)skip_accept_encoding skip_hostr|rztransfer-encodingzTransfer-EncodingchunkedNutf8s s0 )setrdrrritems endheadersr string_typesbytesrkencodehexlen bytearraysend)r<rerfrr header_keysrrryrFstringish_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_NODELAYr9 is_verifiedproxy_is_verifiedr;propertyrDsetterrPrTrZr]rdrrrr __classcell__)rs@rrrLs82"&)L &163EqIJK444"**X*$ [[>333!!! N N NUUUUUU% % % % % % % % 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)r1rr-)rr;key_file cert_file key_password ssl_contextserver_hostname _protocol) r<rDrJrrrr1rrrr>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_certCs"  + ,8 -d33   ""(."4 ARW%7%7%A%A &J27+=+=k+J+J(rc h|}|j}d}|rH|jr|||}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.))/rPrDrTtls_in_tls_required_connect_tls_proxyrVrWrXrRrdatetimedatetoday RECENT_DATEwarningswarnformatrrr&r)rr(rrrrrhasattrrr*rrrrDeprecationWarningr% getpeercertssl CERT_NONErSrr8r_match_hostname CERT_REQUIREDr) r<rNhostnamerr is_time_offdefault_ssl_contextcontextcerts rr]zHTTPSConnection.connectdsr~~9  " " )' "..x>>! DI 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. )rVrr)rVrrrrrrFrrr)r5rr*r rrrrrrrrrSrr8rrrrrrr)r<rrNr5rrrs rrz"HTTPSConnection._connect_tls_proxysB( ".  # ('  /   N M       !](*$#      "cm 3 3G )5= = 3 &6%''D88,b11  ()/x(8(8) D( + + +!,!8Crs&&&&&& ''''''++++++MMMMMM999999000000 JJJ