
    Mhh                        d dl Z d dlmZ d dlZd dlmZ d dlZd dlZd dlm	Z	 d dl
Z
d dlZd dlZd dlmZmZmZmZmZmZmZmZ d dlmZ d dlmZmZmZ d dlmZmZmZm Z m!Z!m"Z" d d	l#m$Z$m%Z%m&Z& d
dl'm(Z' d
dl)m*Z*m+Z+ d
dl,m-Z- d
dl.m/Z/ dZ0dZ1	  G d de           Z2d Z3e+dfde*de4defdZ5 G d de%          Z6 G d de	e&          Z7d Z8	 	 	 dNde9de9d e:d!ee9         d"ee9         d#e4de
j;        fd$Z<d%e+dddde
j=        dfd&e:d'e9de*dee9         dee9         d(ee9         d)ee9         d e:d#e4dee&ej>        f         fd*Z?e?Z@e+fde*deAfd+ZBd,e9deee*geAf         e9f         fd-ZCd.e9de4fd/ZD G d0 d1e          ZEd2e9de*ddfd3ZFd4e9d5e9d6eeG         d7eee9e9f                  d8eAd9eeeHf         deg df         fd:ZId4e9d5e9d6eeG         d7eee9e9f                  d8eAdeg df         fd;ZJd4e9d5e9d6eeG         d7eee9e9f                  d8eAdeg df         fd<ZK	 	 dOd4e9d5e9d6eeG         d7eee9e9f                  d8eAd=ee9         d>ee9         deg df         fd?ZLde
jM        dfd4e9d5e9d6eeG         d7eee9e9f                  d8eAde9de9d!ee9         d e:d@e4deg df         fdAZNddBeJfdCe9dDe9de*dEeee9ef                  d6eeG         dFeddfdGZOddBeJfdCe9dDe9dee*         dEeee9ef                  d6eeG         dFeddfdHZPddBeJfdCe9dDe9dEeee9ef                  d6eeG         dFeddfdIZQd5e9dCe9dDe9dee*         dEeee9ef                  d6eeG         dFeddfdJZRdK ZSdee9ef         fdLZTd
dMlUmVZV dS )P    N)closing)BaseHTTPRequestHandler)ThreadingMixIn)AnyCallableDictListOptionalSequenceTupleUnion)	HTTPError)parse_qs
quote_plusurlparse)BaseHandlerbuild_openerHTTPHandlerHTTPRedirectHandlerHTTPSHandlerRequest)make_serverWSGIRequestHandler
WSGIServer   )
exposition)CollectorRegistryREGISTRY)floatToGoString)_is_valid_legacy_metric_name)CONTENT_TYPE_LATESTdelete_from_gatewaygenerate_latestinstance_ip_grouping_keymake_asgi_appmake_wsgi_appMetricsHandlerpush_to_gatewaypushadd_to_gatewaystart_http_serverstart_wsgi_serverwrite_to_textfilez(text/plain; version=0.0.4; charset=utf-8c                       e Zd ZdZd ZdS )_PrometheusRedirectHandleraw  
    Allow additional methods (e.g. PUT) and data forwarding in redirects.

    Use of this class constitute a user's explicit agreement to the
    redirect responses the Prometheus client will receive when using it.
    You should only use this class if you control or otherwise trust the
    redirect behavior involved and are certain it is safe to full transfer
    the original request (method and data) to the redirected URL. For
    example, if you know there is a cosmetic URL redirect in front of a
    local deployment of a Prometheus server, and all redirects are safe,
    this is the class to use to handle redirects in that case.

    The standard HTTPRedirectHandler does not forward request data nor
    does it allow redirected PUT requests (which Prometheus uses for some
    operations, for example `push_to_gateway`) because these cannot
    generically guarantee no violations of HTTP RFC 2616 requirements for
    the user to explicitly confirm redirects that could have unexpected
    side effects (such as rendering a PUT request non-idempotent or
    creating multiple resources not named in the original request).
    c                    t          |d|                                          }|dv r|dv s |dv r|dv st          |j        ||||          t	          |                    dd          |j        |j        d|j        	          }||_	        |S )
a  
        Apply redirect logic to a request.

        See parent HTTPRedirectHandler.redirect_request for parameter info.

        If the redirect is disallowed, this raises the corresponding HTTP error.
        If the redirect can't be determined, return None to allow other handlers
        to try. If the redirect is allowed, return the new request.

        This method specialized for the case when (a) the user knows that the
        redirect will not cause unacceptable side effects for any request method,
        and (b) the user knows that any request data should be passed through to
        the redirect. If either condition is not met, this should not be used.
        method)-  .  /  i3  )GETHEAD)r1   r2   r3   )POSTPUT z%20T)headersorigin_req_hostunverifiabledata)
getattr
get_methodr   full_urlr   replacer9   r:   r<   r0   )	selfreqfpcodemsgr9   newurlmnew_requests	            \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/prometheus_client/exposition.pyredirect_requestz+_PrometheusRedirectHandler.redirect_requestB   s    $ C3>>#3#344,,,o1E1E?**qO/C/CCL$WbAAANN3&&K/
 
 
     N)__name__
__module____qualname____doc__rJ    rK   rI   r.   r.   ,   s-         *    rK   r.   c                    t          |          \  }}d|v r|                     |d                   }  ||           }d|fg}|s8t          |          r)t          j        |          }|                    d           d||fS )zBake output for metrics output.zname[]Content-Type)zContent-Encodinggzip200 OK)choose_encoderrestricted_registrygzip_acceptedrS   compressappend)	registryaccept_headeraccept_encoding_headerparamsdisable_compressionencodercontent_typeoutputr9   s	            rI   _bake_outputrb   c   s     +=99G\6//x0@AAWXF-.G 5=1G#H#H 5v&&3444Wf$$rK   FrZ   r^   returnc                       fd}|S )z;Create a WSGI app which serves the metrics from a registry.c                    |                      d          }|                      d          }t          |                      dd                    }| d         }|dk    rd}dg}d	}n^|d
k    r.d}dg}d                    ||                                          }n*| d         dk    rd}g }d	}nt	          
|||	          \  }}} |||           |gS )NHTTP_ACCEPTHTTP_ACCEPT_ENCODINGQUERY_STRING REQUEST_METHODOPTIONSrT   )AllowzOPTIONS,GETrK   r4   z405 Method Not Allowedz"# HTTP {}: {}; use OPTIONS or GET
	PATH_INFOz/favicon.ico)getr   formatencoderb   )environstart_responser[   r\   r]   r0   statusr9   ra   r^   rZ   s            rI   prometheus_appz%make_wsgi_app.<locals>.prometheus_appu   s   M22!(-C!D!D'++nb99::)*YF/0GFFu__-F/0G:AA&&QQXXZZFF[!^33FGFF
 '38]Lbdjl  'A  'A#FGVvw'''xrK   rP   )rZ   r^   rt   s   `` rI   r&   r&   r   s*         : rK   c                       e Zd ZdZd ZdS )_SilentHandlerz(WSGI handler that does not log requests.c                     dS zLog nothing.NrP   rA   ro   argss      rI   log_messagez_SilentHandler.log_message         rK   N)rL   rM   rN   rO   r{   rP   rK   rI   rv   rv      s)        22    rK   rv   c                       e Zd ZdZdZdS )ThreadingWSGIServerzThread per request HTTP server.TN)rL   rM   rN   rO   daemon_threadsrP   rK   rI   r~   r~      s        )) NNNrK   r~   c                     t          j        | |t           j        t           j                  }t	          t          |                    \  }}}}}||d         fS )z8Automatically select address family depending on address)typeflagsr   )socketgetaddrinfoSOCK_STREAM
AI_PASSIVEnextiter)addressportinfosfamily_sockaddrs         rI   _get_best_familyr      sP     w63EVM^___E $T%[[ 1 1FAq!X8A;rK   certfilekeyfileprotocolcafilecapathclient_auth_requiredc           	         t          j        |          }||\	 |                    ||           n# t          $ r7}t	          |          }t          |          }	 |d|d|d|	           d}~ww xY w	 |                    t           j        j                   n># t          $ r1}t	          |          }t          |          }	 |d|	           d}~ww xY w|rt           j	        |_
        	 |                    | |           nD# t          $ r7}t	          |          }t          |          }	 |d	| d
|d|	           d}~ww xY w|S )zLoad context supports SSL.r   Nz+Cannot load CA certificate chain from file z or directory z: )purposez*Cannot load default CA certificate chain: r   r   z$Cannot load server certificate file z or its private key file )ssl
SSLContextload_verify_locationsIOErrorr   strload_default_certsPurposeCLIENT_AUTHCERT_REQUIREDverify_modeload_cert_chain)
r   r   r   r   r   r   ssl_cxtexcexc_typerE   s
             rI   _get_ssl_ctxr      s    nh///GV/	I))&&9999 	I 	I 	ICyyHc((C( H$H H6<H HBEH H I I I	I	O&&s{/F&GGGG 	O 	O 	OCyyHc((C(MMMNNN	O
  0!/C7CCCC C C C99#hhh Bh B B/6B B<?B B C C 	CC NsD   2 
A32A..A37%B 
C',CC/D 
E2EEz0.0.0.0r   addrclient_cafileclient_capathc	                     G d dt                     }	t          ||           \  |	_        }t          |          }
t	          || |
|	t
                    }|r7|r5t          ||||||          }|                    |j        d          |_        t          j
        |j                  }d|_        |                                 ||fS )z?Starts a WSGI server for prometheus metrics as a daemon thread.c                       e Zd ZdZdS )$start_wsgi_server.<locals>.TmpServerz<Copy of ThreadingWSGIServer to update address_family locallyN)rL   rM   rN   rO   rP   rK   rI   	TmpServerr      s        JJJJrK   r   )handler_classT)server_side)target)r~   r   address_familyr&   r   rv   r   wrap_socketr   	threadingThreadserve_foreverdaemonstart)r   r   rZ   r   r   r   r   r   r   r   apphttpdcontextts                 rI   r+   r+      s    K K K K K' K K K &6dD%A%A"Id

!
!CdC.QQQE KG Kx(M=Znoo**5<T*JJ 3444AAHGGIII!8OrK   c                 6   d }g }|                                  D ]W}	 |j        }|j        }|dk    r|dz   }n(|dk    r|dz   }d}n|dk    rd}n|dk    rd	}n|d
k    rd}|                    d                    t          j        |          |j                            dd                              dd                               |                    dt          j        |           d| d           i }|j	        D ]l}dD ]I}|j        |j        |z   k    r4|
                    |g                                ||                      nJ|                     ||                     mn%# t          $ r}	|	j        pd|fz   |	_         d}	~	ww xY wt          |                                          D ]\  }}
|                    d                    t          j        |j        |z             |j                            dd                              dd                               |                    dt          j        |j        |z              d           |                    |
           Yd                    |                              d          S )zHReturns the metrics from the registry in latest text format as a string.c           	      <   | j         rWd                    d                    d t          | j                                                   D                                 }nd}d}| j        (dt          t          | j                  dz            d}t          | j	                  r:|rd                    |          }| j	         | dt          | j                   | d	S d}|rd}d
t          j        | j	                   | | dt          | j                   | d	S )Nz{0},c                     g | ]?\  }}d                      t          j        |          t          j        |                    @S )z{}="{}")ro   openmetricsescape_label_name_escape.0kvs      rI   
<listcomp>z8generate_latest.<locals>.sample_line.<locals>.<listcomp>   s_     @ @ @1 !!1!44k6I!6L6LN N @ @ @rK   ri   r8   i  dz{{{0}}}
{z} )labelsro   joinsorteditems	timestampintfloatr    namer   valuer   escape_metric_name)sampleslabelstrr   maybe_commas       rI   sample_linez$generate_latest.<locals>.sample_line   s{   > 	||CHH@ @ &w~';';'='= > >@ @ @%A %A B BHH
 H	(DCg&7 8 84 ?@@DDDI'55 	] 6$++H55l\H\\w}/M/M\y\\\\ 	K JK27<@@  J+  Jx  J  J\klsly\z\z  J  }F  J  J  J  	JrK   counter_totalinfo_infogaugestatesetgaugehistogram	histogramunknownuntypedz# HELP {} {}
\z\\r   z\nz# TYPE r8   )_created_gsum_gcount)ri   Nz gauge
ri   utf-8)collectr   r   rY   ro   r   r   documentationr@   r   
setdefault	Exceptionrz   r   r   extendr   rp   )rZ   r   ra   metricmnamemtype
om_samplesssuffix	exceptionliness              rI   r#   r#      s   J J J* F""$$ (! (!!	KEKE	!!(&*$$*** $)##!MM*11.u55v7K7S7STXZ_7`7`7h7himot7u7uw w x x xMMUK$B5$I$IUUEUUUVVV/1J^ 2 2> 2 2Fvv!555"--fb99@@QPPP 6
 MM++a..1112  	 	 	'n5&BIN	 $J$4$4$6$677 	! 	!MFEMM*11+2PQWQ\_eQe2f2f282F2N2NtUZ2[2[2c2cdhjo2p2pr r s s sMMbK$B6;QWCW$X$XbbbcccMM%    		!
 776??!!'***s   EE--
F7F

Fr[   c                     | pd} |                      d          D ]M}|                     d          d                                         dk    rt          j        t          j        fc S Nt          t          fS )Nri   r   ;r   zapplication/openmetrics-text)splitstripr   r#   r!   )r[   accepteds     rI   rU   rU   =  s    !'RM!'',, 5 5>>#q!''))-KKK/35 5 5 5 L ///rK   r\   c                     | pd} |                      d          D ]H}|                     d          d                                                                         dk    r dS IdS )Nri   r   r   r   rS   TF)r   r   lower)r\   r   s     rI   rW   rW   F  so    39r*0055  >>#q!''))//11V;;44 <5rK   c                   ^    e Zd ZU dZeZeed<   d
dZde	de
ddfdZededefd	            ZdS )r'   z2HTTP handler that gives metrics from ``REGISTRY``.rZ   rc   Nc                    | j         }| j                            d          }| j                            d          }t          t	          | j                  j                  }t          ||||d          \  }}}|                     t          |
                    d          d                              |D ]} | j        |  |                                  | j                            |           d S )NAcceptzAccept-EncodingFr8   r   )rZ   r9   rn   r   r   pathqueryrb   send_responser   r   send_headerend_headerswfilewrite)	rA   rZ   r[   r\   r]   rs   r9   ra   headers	            rI   do_GETzMetricsHandler.do_GETR  s    =((22!%!1!12C!D!D(49--344".xH^`fhm"n"n3v||C00344555 	& 	&FDf%%%
     rK   ro   rz   c                     dS rx   rP   ry   s      rI   r{   zMetricsHandler.log_messagea  r|   rK   c                 b    t          | j                  }t          || t          fd|i          }|S )zWReturns a dynamic MetricsHandler class tied
           to the passed registry.
        rZ   )r   rL   r   object)clsrZ   cls_nameMyMetricsHandlers       rI   factoryzMetricsHandler.factoryd  s9     s|$$3-!+X 68 8rK   rc   N)rL   rM   rN   rO   r   rZ   r   __annotations__r	  r   r   r{   classmethodr   r  rP   rK   rI   r'   r'   N  s         <<"*H***! ! ! !# c d      0  T       [     rK   r'   r  c                    |  dt          j                     dt          j                    j         }	 t          |d          5 }|                    t          |                     ddd           n# 1 swxY w Y   t           j        dk    rt          j	        ||            dS t          j
        ||            dS # t          $ r5 t           j                            |          rt          j        |            w xY w)zWrite metrics to the given path.

    This is intended for use with the Node exporter textfile collector.
    The path must end in .prom for the textfile collector to process it..wbNnt)osgetpidr   current_threadidentopenr  r#   r   r@   renamer   r  existsremove)r  rZ   tmppathfs       rI   r,   r,   t  s3   
 HH	HHi&>&@&@&FHHG'4   	/AGGOH--...	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 7d??Jw%%%%%Igt$$$$$   7>>'"" 	Igs5   B; #A2&B; 2A66B; 9A6:(B; $B; ;?C:urlr0   timeoutr9   r<   base_handlerc                 (     d fd}|S )Nrc   c                     t          	          } fd| _        D ]\  }}|                     ||           t                                        |           }|j        dk    rt          d|j         d|j                   d S )N)r<   c                       S )NrP   )r0   s   rI   <lambda>z/_make_handler.<locals>.handle.<locals>.<lambda>  s    V rK   )r#  i  zerror talking to pushgateway: r8   )r   r>   
add_headerr   r  rD   OSErrorrE   )
requestr   r   respr$  r<   r9   r0   r#  r"  s
       rI   handlez_make_handler.<locals>.handle  s    #D)))+^^^ 	% 	%DAqq!$$$$L))..w.HH9Q49QQtxQQRRR rK   r  rP   )r"  r0   r#  r9   r<   r$  r-  s   `````` rI   _make_handlerr.    sQ    S S S S S S S S S S S MrK   c                 4    t          | ||||t                    S )zDefault handler that implements HTTP/HTTPS connections.

    Used by the push_to_gateway functions. Can be re-used by other handlers.)r.  r   r"  r0   r#  r9   r<   s        rI   default_handlerr1    s     fgwkJJJrK   c                 4    t          | ||||t                    S )a  
    Handler that automatically trusts redirect responses for all HTTP methods.

    Augments standard HTTPRedirectHandler capability by permitting PUT requests,
    preserving the method upon redirect, and passing through all headers and
    data from the original request. Only use this handler if you control or
    trust the source of redirect responses you encounter when making requests
    via the Prometheus client. This handler will simply repeat the identical
    request, including same method and data, to the new redirect URL.)r.  r.   r0  s        rI   passthrough_redirect_handlerr3    s    " fgw>XYYYrK   usernamepasswordc                 *      fd}|S )zHandler that implements HTTP/HTTPS connections with Basic Auth.

    Sets auth headers using supplied 'username' and 'password', if set.
    Used by the push_to_gateway functions. Can be re-used by other handlers.c                      	KI	 d                                  } t          j        |           }d|z   }                    d|f            t	                                 dS )z1Handler that implements HTTP Basic Auth.
        N:s   Basic Authorization)rp   base64	b64encoderY   r1  )

auth_value
auth_tokenauth_headerr<   r9   r0   r5  r#  r"  r4  s
      rI   r-  z"basic_auth_handler.<locals>.handle  s     H$8$11x1188::J)*55J#j0KNNO[9:::<VWgt<<>>>>>rK   rP   )r"  r0   r#  r9   r<   r4  r5  r-  s   ``````` rI   basic_auth_handlerr?    sG    ? ? ? ? ? ? ? ? ? ? ? MrK   insecure_skip_verifyc
                 .   t          j        |          }
||
                    |           n|
                                 |	rd|
_        t           j        |
_        |
                    ||           t          |
          }t          | |||||          S )aL  Handler that implements an HTTPS connection with TLS Auth.

    The default protocol (ssl.PROTOCOL_TLS_CLIENT) will also enable
    ssl.CERT_REQUIRED and SSLContext.check_hostname by default. This can be
    disabled by setting insecure_skip_verify to True.

    Both this handler and the TLS feature on pushgateay are experimental.r   NFr   )r   )
r   r   r   r   check_hostname	CERT_NONEr   r   r   r.  )r"  r0   r#  r9   r<   r   r   r   r   r@  r   handlers               rI   tls_auth_handlerrE    s    & nh///G%%f----""$$$ ,!&!mXw???7+++GfgwgFFFrK      gatewayjobgrouping_keyrD  c           	      0    t          d| |||||           dS )aN  Push metrics to the given pushgateway.

    `gateway` the url for your push gateway. Either of the form
              'http://pushgateway.local', or 'pushgateway.local'.
              Scheme defaults to 'http' if none is provided
    `job` is the job label to be attached to all pushed metrics
    `registry` is an instance of CollectorRegistry
    `grouping_key` please see the pushgateway documentation for details.
                   Defaults to None
    `timeout` is how long push will attempt to connect before giving up.
              Defaults to 30s, can be set to None for no timeout.
    `handler` is an optional function which can be provided to perform
              requests to the 'gateway'.
              Defaults to None, in which case an http or https request
              will be carried out by a default handler.
              If not None, the argument must be a function which accepts
              the following arguments:
              url, method, timeout, headers, and content
              May be used to implement additional functionality not
              supported by the built-in default handler (such as SSL
              client certicates, and HTTP authentication mechanisms).
              'url' is the URL for the request, the 'gateway' argument
              described earlier will form the basis of this URL.
              'method' is the HTTP method which should be used when
              carrying out the request.
              'timeout' requests not successfully completed after this
              many seconds should be aborted.  If timeout is None, then
              the handler should not set a timeout.
              'headers' is a list of ("header-name","header-value") tuples
              which must be passed to the pushgateway in the form of HTTP
              request headers.
              The function should raise an exception (e.g. IOError) on
              failure.
              'content' is the data which should be used to form the HTTP
              Message Body.

    This overwrites all metrics with the same job and grouping_key.
    This uses the PUT HTTP method.r7   N_use_gatewayrG  rH  rZ   rI  r#  rD  s         rI   r(   r(     s%    \ hgwOOOOOrK   c           	      0    t          d| |||||           dS )a"  PushAdd metrics to the given pushgateway.

    `gateway` the url for your push gateway. Either of the form
              'http://pushgateway.local', or 'pushgateway.local'.
              Scheme defaults to 'http' if none is provided
    `job` is the job label to be attached to all pushed metrics
    `registry` is an instance of CollectorRegistry
    `grouping_key` please see the pushgateway documentation for details.
                   Defaults to None
    `timeout` is how long push will attempt to connect before giving up.
              Defaults to 30s, can be set to None for no timeout.
    `handler` is an optional function which can be provided to perform
              requests to the 'gateway'.
              Defaults to None, in which case an http or https request
              will be carried out by a default handler.
              See the 'prometheus_client.push_to_gateway' documentation
              for implementation requirements.

    This replaces metrics with the same name, job and grouping_key.
    This uses the POST HTTP method.r6   NrK  rM  s         rI   r)   r)   -  s$    8 #xwPPPPPrK   c           	      0    t          d| |d|||           dS )a  Delete metrics from the given pushgateway.

    `gateway` the url for your push gateway. Either of the form
              'http://pushgateway.local', or 'pushgateway.local'.
              Scheme defaults to 'http' if none is provided
    `job` is the job label to be attached to all pushed metrics
    `grouping_key` please see the pushgateway documentation for details.
                   Defaults to None
    `timeout` is how long delete will attempt to connect before giving up.
              Defaults to 30s, can be set to None for no timeout.
    `handler` is an optional function which can be provided to perform
              requests to the 'gateway'.
              Defaults to None, in which case an http or https request
              will be carried out by a default handler.
              See the 'prometheus_client.push_to_gateway' documentation
              for implementation requirements.

    This deletes metrics with the given job and grouping_key.
    This uses the DELETE HTTP method.DELETENrK  )rG  rH  rI  r#  rD  s        rI   r"   r"   L  s$    4 7C|WgNNNNNrK   c                    t          |          }|j        r	|j        dvrd| }|                    d          } dj        |gt	          d|          R  }d}	| dk    r|t
          }t          |          }	|i }|d                    d	 t          |	                                          D                       z  }  ||| |d
t          fg|	                       d S )N)httphttpszhttp:///z{}/metrics/{}/{}rH  rK   rP  ri   c           	   3      K   | ]9\  }} d j         t          t          |          t          |                     V  :dS )z/{}/{}N)ro   _escape_grouping_keyr   r   s      rI   	<genexpr>z_use_gateway.<locals>.<genexpr>  sZ       2 2Aq 	-c!ffc!ff==>2 2 2 2 2 2rK   rR   r0  )r   schemerstripro   rV  r   r#   r   r   r   r!   )
r0   rG  rH  rZ   rI  r#  rD  gateway_urlr"  r<   s
             rI   rL  rL  i  s1    7##K &!3;L!L!L%G%%nnS!!G
#

#G
O.B5#.N.N
O
O
OCDHx((277 2 2<--//002 2 2 2 2 2CGG "567d       rK   c                     |dk    r| dz   dfS d|v r?| dz   t          j        |                    d                                        d          fS | t	          |          fS )Nri   z@base64=rT  r   )r:  urlsafe_b64encoderp   decoder   )r   r   s     rI   rV  rV    si    Bww9}c!!	9}f6qxx7H7HIIPPQXYYYY*Q--rK   c                  P   t          t          j        t          j        t          j                            5 } t          j        dk    r|                     d           n|                     d           d|                                 d         icddd           S # 1 swxY w Y   dS )z>Grouping key with instance set to the IP Address of this host.darwin)z10.255.255.255r   )	localhostr   instancer   N)r   r   AF_INET
SOCK_DGRAMsysplatformconnectgetsockname)r   s    rI   r$   r$     s    	v~v/@AA	B	B 0a<8## II+,,,,II&'''AMMOOA./0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s   ABB"B)r%   )NNF)NN)Wr:  
contextlibr   rS   http.serverr   r  r   socketserverr   r   re  r   typingr   r   r   r	   r
   r   r   r   urllib.errorr   urllib.parser   r   r   urllib.requestr   r   r   r   r   r   wsgiref.simple_serverr   r   r   r   r   rZ   r   r   utilsr   
validationr    __all__r!   r.   rb   boolr&   rv   r~   r   r   r   r   r   PROTOCOL_TLS_SERVERr   r+   r*   bytesr#   rU   rW   r'   r,   r   r   r.  r1  r3  r?  PROTOCOL_TLS_CLIENTrE  r(   r)   r"   rL  rV  r$   asgir%   rP   rK   rI   <module>ry     s	           . . . . . . 				  ' ' ' ' ' ' 



 



     N N N N N N N N N N N N N N N N N N N N " " " " " " 7 7 7 7 7 7 7 7 7 7                N M M M M M M M M M 2 2 2 2 2 2 1 1 1 1 1 1 1 1 " " " " " " 4 4 4 4 4 4 A  ,4 4 4 4 4!4 4 4 4n% % % 19V[    -  t  `h        F    '       .*      !% $%*& &&& & 	&
 & #& 	^& & & &V &."&!%'+'+/%*  $ 3-	
 #  }  }  # :y''(   : &  3; B+ B+/ B+u B+ B+ B+ B+J0# 0%:K9Le9S0TVY0Y*Z 0 0 0 0# $    #  #  #  #  # + #  #  # LC +<     * % %S/*	
  K-. b$h   (KKK %K eCHo&	K
 K b$hK K K KZZZ %Z eCHo&	Z
 Z b$hZ Z Z Z4 #'"&  % eCHo&	
  3- 3- b$h   F !%/%*G GGG %G eCHo&	G
 G G G G G #G b$hG G G GL 26#%+.P .P.P.P $.P tCH~.	.P
 %.P .P 
.P .P .P .Pj 26#%+Q QQQ ,-Q tCH~.	Q
 %Q Q 
Q Q Q QD 26#%+O OOO tCH~.O %	O
 O 
O O O O:      ,-	 
 tCH~.  %    
       F     0$sCx. 0 0 0 0          rK   