+
    öÙ†j¼:  ã                   ó,  € R t R.t^ RIt^ RIt^ RIt]P
                  ! R4      t]P
                  ! R4      t ! R R]4      t	R t
R tR	 t ! R
 R4      t ! R R4      t ! R R4      t ! R R4      t ! R R4      tR tR tR tR tR tR tR tR tR# )a&  
Middleware to check for obedience to the WSGI specification.

Some of the things this checks:

* Signature of the application and start_response (including that
  keyword arguments are not used).

* Environment checks:

  - Environment is a dictionary (and not a subclass).

  - That all the required keys are in the environment: REQUEST_METHOD,
    SERVER_NAME, SERVER_PORT, wsgi.version, wsgi.input, wsgi.errors,
    wsgi.multithread, wsgi.multiprocess, wsgi.run_once

  - That HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH are not in the
    environment (these headers should appear as CONTENT_LENGTH and
    CONTENT_TYPE).

  - Warns if QUERY_STRING is missing, as the cgi module acts
    unpredictably in that case.

  - That CGI-style variables (that don't contain a .) have
    (non-unicode) string values

  - That wsgi.version is a tuple

  - That wsgi.url_scheme is 'http' or 'https' (@@: is this too
    restrictive?)

  - Warns if the REQUEST_METHOD is not known (@@: probably too
    restrictive).

  - That SCRIPT_NAME and PATH_INFO are empty or start with /

  - That at least one of SCRIPT_NAME or PATH_INFO are set.

  - That CONTENT_LENGTH is a positive integer.

  - That SCRIPT_NAME is not '/' (it should be '', and PATH_INFO should
    be '/').

  - That wsgi.input has the methods read, readline, readlines, and
    __iter__

  - That wsgi.errors has the methods flush, write, writelines

* The status is a string, contains a space, starts with an integer,
  and that integer is in range (> 100).

* That the headers is a list (not a subclass, not another kind of
  sequence).

* That the items of the headers are tuples of strings.

* That there is no 'status' header (that is used in CGI, but not in
  WSGI).

* That the headers don't contain newlines or colons, end in _ or -, or
  contain characters codes below 037.

* That Content-Type is given if there is content (CGI often has a
  default content type, but WSGI does not).

* That no Content-Type is given when there is no content (@@: is this
  too restrictive?)

* That the exc_info argument to start_response is a tuple or None.

* That all calls to the writer are with strings, and no other methods
  on the writer are accessed.

* That wsgi.input is used properly:

  - .read() is called with exactly one argument

  - That it returns a string

  - That readline, readlines, and __iter__ return strings

  - That .close() is not called

  - No other methods are provided

* That wsgi.errors is used properly:

  - .write() and .writelines() is called with a string

  - That .close() is not called, and no other methods are provided.

* The response iterator:

  - That it is not a string (it should be a list of a single string; a
    string will work, but perform horribly).

  - That .__next__() returns a string

  - That the iterator is not iterated over until start_response has
    been called (that can signal either a server or application
    error).

  - That .close() is called (doesn't raise exception, only prints to
    sys.stderr, because we only know it isn't called when the object
    is garbage collected).
Ú	validatorNz^[a-zA-Z][a-zA-Z0-9\-_]*$z[\000-\037]c                   ó   € ] tR t^ytRtRtR# )ÚWSGIWarningz2
Raised in response to WSGI-spec-related warnings
© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú'/usr/lib/python3.14/wsgiref/validate.pyr   r   y   s   † õr   r   c                 ó(   € V '       g
   \        V!  hR # ©N)ÚAssertionError)ÚcondÚargss   &*r   Úassert_r   ~   s   € ßÜ˜dÑ#Ð#ñ r   c                 ót   € \        V 4      \        J d   V # \        R P                  V\	        V 4      4      4      h)z!{0} must be of type str (got {1}))ÚtypeÚstrr   ÚformatÚrepr)ÚvalueÚtitles   &&r   Úcheck_string_typer   ‚   s6   € ÜˆUƒ|”sÓØˆÜ
Ø+×2Ñ2°5¼$¸u»+ÓFóHð Hr   c                ó   a € V 3R lpV# )aŽ  
When applied between a WSGI server and a WSGI application, this
middleware will check for WSGI compliance on a number of levels.
This middleware does not modify the request or response in any
way, but will raise an AssertionError if anything seems off
(except for a failure to close the application iterator, which
will be printed to stderr -- there's no way to raise an exception
at that point).
c                  óT  <aa€ \        \        V 4      ^8H  R4       \        V'       * R4       V w  po\        V4       . oVV3R lp\        VR,          4      VR&   \	        VR,          4      VR&   S! W#4      p\        VRJ;'       d    VR8g  R4       \        V4       \        VS4      # )	é   zTwo arguments requiredúNo keyword arguments allowedc                  ó~  <€ \        \        V 4      ^8H  ;'       g    \        V 4      ^8H  RV : 24       \        V'       * R4       V ^ ,          pV ^,          p\        V 4      ^8X  d   V ^,          pMRp\        V4       \        V4       \	        W#4       \        V4       SP                  R4       \        S! V !  4      # )r   zInvalid number of arguments: r   N)r   ÚlenÚcheck_statusÚcheck_headersÚcheck_content_typeÚcheck_exc_infoÚappendÚWriteWrapper)r   ÚkwÚstatusÚheadersÚexc_infoÚstart_responseÚstart_response_starteds   *,   €€r   Ústart_response_wrapperÚ;validator.<locals>.lint_app.<locals>.start_response_wrapperŸ   s¢   ø€ Ü”C˜“I ‘N×4Ð4¤c¨$£i°1¡nøÚ59Ð;ô>ä˜”FÐ:Ô;Ø˜!•WˆFØ˜1•gˆGÜ�4‹y˜AŒ~Ø �7‘à�ä˜Ô Ü˜'Ô"Ü˜vÔ/Ü˜8Ô$à"×)Ñ)¨$Ô/Ü¡°Ñ 5Ó6Ð6r   ú
wsgi.inputúwsgi.errorsNFz>The application must return an iterator, if only an empty list)r   r!   Úcheck_environÚInputWrapperÚErrorWrapperÚcheck_iteratorÚIteratorWrapper)r   r(   Úenvironr.   Úiteratorr,   r-   Úapplications   *,   @@€r   Úlint_appÚvalidator.<locals>.lint_app”   s®   ú€ Ü”�D“	˜Q‘Ð 8Ô9Ü�B”Ð6Ô7Ø"&Ñˆ�ä�gÔð "$Ðö	7ô& !-¨W°\Õ-BÓ Cˆ�ÑÜ!-¨g°mÕ.DÓ!Eˆ�Ñá˜wÓ?ˆÜ� Ð$×:Ð:¨°UÑ):ØLô	Nô 	�xÔ ä˜xÐ)?Ó@Ð@r   r   )r9   r:   s   f r   r   r   ˆ   s   ø€ õ'AðR €Or   c                   óD   a € ] tR t^¿t o R tR tR tR tR tR t	Rt
V tR# )	r3   c                ó   € Wn         R # r   ©Úinput)ÚselfÚ
wsgi_inputs   &&r   Ú__init__ÚInputWrapper.__init__Á   s   € ØŽ
r   c                óœ   € \        \        V4      ^8H  4       V P                  P                  ! V!  p\        \	        V4      \
        J 4       V# ©é   )r   r!   r?   Úreadr   Úbytes©r@   r   Úvs   &* r   rG   ÚInputWrapper.readÄ   s:   € Ü”�D“	˜Q‘ÔØ�J‰J�OŠO˜TÑ"ˆÜ”�Q“œ5Ð Ô!Øˆr   c                óœ   € \        \        V4      ^8*  4       V P                  P                  ! V!  p\        \	        V4      \
        J 4       V# rE   )r   r!   r?   Úreadliner   rH   rI   s   &* r   rM   ÚInputWrapper.readlineÊ   s<   € Ü”�D“	˜Q‘ÔØ�J‰J×Ò Ñ&ˆÜ”�Q“œ5Ð Ô!Øˆr   c                óâ   € \        \        V4      ^8*  4       V P                  P                  ! V!  p\        \	        V4      \
        J 4       V F  p\        \	        V4      \        J 4       K  	  V# rE   )r   r!   r?   Ú	readlinesr   ÚlistrH   )r@   r   ÚlinesÚlines   &*  r   rP   ÚInputWrapper.readlinesÐ   sW   € Ü”�D“	˜Q‘ÔØ—
‘
×$Ò$ dÑ+ˆÜ”�U“œtÐ#Ô$ÛˆDÜ”D˜“J¤%Ð'Ö(ñ àˆr   c              #  óJ   "  € V P                  4       ;p'       d   Vx € K  R # 5ir   )rM   )r@   rS   s   & r   Ú__iter__ÚInputWrapper.__iter__Ø   s    é € Ø—m‘m“oÐ%ˆdÖ%ØŒJñ &ùs   ‚#›#c                ó   € \        ^ R4       R# )é    z input.close() must not be calledN©r   ©r@   s   &r   ÚcloseÚInputWrapper.closeÜ   s   € Ü�Ð5Ö6r   r>   N)r   r   r   r	   rB   rG   rM   rP   rV   r\   r   Ú__classdictcell__©Ú__classdict__s   @r   r3   r3   ¿   s(   ø‡ € ò òòòò÷7ð 7r   r3   c                   ó>   a € ] tR t^ßt o R tR tR tR tR tRt	V t
R# )r4   c                ó   € Wn         R # r   ©Úerrors)r@   Úwsgi_errorss   &&r   rB   ÚErrorWrapper.__init__á   ó   € Ø!Žr   c                óp   € \        \        V4      \        J 4       V P                  P	                  V4       R # r   )r   r   r   rd   Úwrite©r@   Úss   &&r   ri   ÚErrorWrapper.writeä   s$   € Ü”�Q“œ3�ÔØ�‰×Ñ˜!Ör   c                ó:   € V P                   P                  4        R # r   )rd   Úflushr[   s   &r   rn   ÚErrorWrapper.flushè   s   € Ø�‰×ÑÖr   c                ó:   € V F  pV P                  V4       K  	  R # r   )ri   )r@   ÚseqrS   s   && r   Ú
writelinesÚErrorWrapper.writelinesë   s   € ÛˆDØ�J‰J�tÖó r   c                ó   € \        ^ R4       R# )rY   z!errors.close() must not be calledNrZ   r[   s   &r   r\   ÚErrorWrapper.closeï   s   € Ü�Ð6Ö7r   rc   N)r   r   r   r	   rB   ri   rn   rr   r\   r   r^   r_   s   @r   r4   r4   ß   s#   ø‡ € ò"òòò÷8ð 8r   r4   c                   ó,   a € ] tR t^òt o R tR tRtV tR# )r'   c                ó   € Wn         R # r   ©Úwriter)r@   Úwsgi_writers   &&r   rB   ÚWriteWrapper.__init__ô   rg   r   c                ó\   € \        \        V4      \        J 4       V P                  V4       R # r   )r   r   rH   ry   rj   s   &&r   Ú__call__ÚWriteWrapper.__call__÷   s   € Ü”�Q“œ5Ð Ô!Ø�‰�AŽr   rx   N)r   r   r   r	   rB   r}   r   r^   r_   s   @r   r'   r'   ò   s   ø‡ € ò"÷ð r   r'   c                   ó,   a € ] tR t^ût o R tR tRtV tR# )ÚPartialIteratorWrapperc                ó   € Wn         R # r   ©r8   )r@   Úwsgi_iterators   &&r   rB   ÚPartialIteratorWrapper.__init__ý   s   € Ø%Žr   c                ó.   € \        V P                  R 4      # r   )r6   r8   r[   s   &r   rV   ÚPartialIteratorWrapper.__iter__   s   € ä˜tŸ}™}¨dÓ3Ð3r   r‚   N)r   r   r   r	   rB   rV   r   r^   r_   s   @r   r€   r€   û   s   ø‡ € ò&÷4ð 4r   r€   c                   ó>   a € ] tR tRt o R tR tR tR tR tRt	V t
R# )	r6   i  c                óL   € Wn         \        V4      V n        R V n        W n        R# )FN)Úoriginal_iteratorÚiterr8   ÚclosedÚcheck_start_response)r@   rƒ   rŒ   s   &&&r   rB   ÚIteratorWrapper.__init__  s!   € Ø!.ÔÜ˜]Ó+ˆŒØˆŒØ$8Ö!r   c                ó   € V # r   r   r[   s   &r   rV   ÚIteratorWrapper.__iter__  s   € Øˆr   c                ó  € \        V P                  '       * R 4       \        V P                  4      p\	        V4      \
        Jd   \        RRV: R24       V P                  e   \        V P                  R4       RV n        V# )zIterator read after closedFz!Iterator yielded non-bytestring (Ú)NzjThe application returns and we started iterating over its body, but start_response has not yet been called)r   r‹   Únextr8   r   rH   rŒ   )r@   rJ   s   & r   Ú__next__ÚIteratorWrapper.__next__  si   € Ü�D—K‘K”Ø(ô	*ä�—‘ÓˆÜ�‹7œ%ÓÜ‘EÃQÐHÔIØ×$Ñ$Ò0Ü�D×-Ñ-Ø|ô~à(,ˆDÔ%Øˆr   c                ó„   € R V n         \        V P                  R4      '       d   V P                  P                  4        R# R# )Tr\   N)r‹   Úhasattrr‰   r\   r[   s   &r   r\   ÚIteratorWrapper.close  s3   € ØˆŒÜ�4×)Ñ)¨7×3Ò3Ø×"Ñ"×(Ñ(Ö*ñ 4r   c                ó”   € V P                   '       g    \        P                  P                  R 4       \	        V P                   R 4       R# )z/Iterator garbage collected without being closedN)r‹   ÚsysÚstderrri   r   r[   s   &r   Ú__del__ÚIteratorWrapper.__del__   s2   € Ø�{�{ˆ{Ü�J‰J×ÑØAôCä�—‘Ø=ö	?r   )rŒ   r‹   r8   r‰   N)r   r   r   r	   rB   rV   r“   r\   r›   r   r^   r_   s   @r   r6   r6     s#   ø‡ € ò9òò
ò+÷
?ð ?r   r6   c                 ó�  € \        \        V 4      \        J R \        V 4      : RV : R24       R  F  p\        W9   RV: 24       K  	  R! F!  p\        W9  RV: R	VR
,          : R24       K#  	  RV 9  d   \        P                  ! R\
        4       V P                  4        FO  pRV9   d   K  \        \        W,          4      \        J RV: R\        W,          4      : RW,          : R24       KQ  	  \        \        V R,          4      \        J RV R,          : R24       \        V R,          R"9   RV R,          ,          4       \        V R,          4       \        V R,          4       V R,          R#9  d*   \        P                  ! RV R,          ,          \
        4       \        V P                  R4      '       * ;'       g    V R,          P                  R4      RV R,          ,          4       \        V P                  R4      '       * ;'       g    V R,          P                  R4      RV R,          ,          4       V P                  R4      '       d.   \        \        V R,          4      ^ 8¬  RV R,          ,          4       V P                  R4      '       g   \        RV 9   R4       \        V P                  R4      R8g  R4       R# )$z&Environment is not of the right type: z (environment: r‘   ÚREQUEST_METHODúwsgi.versionr0   r1   z"Environment missing required key: z%Environment should not have the key: z (use :é   NNz	 instead)ÚQUERY_STRINGz’QUERY_STRING is not in the WSGI environment; the cgi module will use sys.argv when this variable is missing, so application errors are more likelyÚ.zEnvironmental variable z is not a string: z	 (value: z wsgi.version should be a tuple (zwsgi.url_schemezwsgi.url_scheme unknown: %rzUnknown REQUEST_METHOD: %rÚSCRIPT_NAMEÚ/z$SCRIPT_NAME doesn't start with /: %rÚ	PATH_INFOz"PATH_INFO doesn't start with /: %rÚCONTENT_LENGTHzInvalid CONTENT_LENGTH: %rzgOne of SCRIPT_NAME or PATH_INFO are required (PATH_INFO should at least be '/' if SCRIPT_NAME is empty)zOSCRIPT_NAME cannot be '/'; it should instead be '', and PATH_INFO should be '/'N)	rž   ÚSERVER_NAMEÚSERVER_PORTrŸ   r0   r1   zwsgi.multithreadzwsgi.multiprocesszwsgi.run_once)ÚHTTP_CONTENT_TYPEÚHTTP_CONTENT_LENGTH)ÚhttpÚhttps)ÚGETÚHEADÚPOSTÚOPTIONSÚPATCHÚPUTÚDELETEÚTRACE)r   r   ÚdictÚwarningsÚwarnr   Úkeysr   ÚtupleÚcheck_inputÚcheck_errorsÚgetÚ
startswithÚint)r7   Úkeys   & r   r2   r2   '  sy  € ÜŒD�‹MœTÑ!ä�Ž=›'ð	#ô$ó!ˆô 	�’Ú69Ð;ö	=ñ	!ó <ˆÜ�Ò"ã"% s¨2§w wð0ö	1ñ <ð
 ˜WÔ$Ü�Šð4ô ô		ð �|‰|Ž~ˆØ�#Œ:áÜ”�W•\Ó"¤cÑ)ã”D˜�Ö&¨¯¨ð6ö	7ñ	 ô ŒD�˜Õ(Ó)¬UÑ2Ø18¸×1HÐ1HÐJôLäˆGÐ%Õ&Ð*;Ñ;Ø%¨Ð0AÕ(BÕBôDô �˜Õ%Ô&Ü�˜Õ'Ô(ð ÐÕ ð )Mô Mä�ŠØ(¨7Ð3CÕ+DÕDÜô	ô �—‘˜MÓ*Ô*÷ 6ð 6Ø�}Õ%×0Ñ0°Ó5Ø.°¸Õ1GÕGôIô �—‘˜KÓ(Ô(÷ 4ð 4Ø�{Õ#×.Ñ.¨sÓ3Ø,¨w°{Õ/CÕCôEð ‡{�{Ð#×$Ò$Ü”�GÐ,Õ-Ó.°!Ñ3Ø(¨7Ð3CÕ+DÕDô	Fð �;‰;�}×%Ò%Ü�˜wÑ&ð>ô	?ô ˆG�K‰K˜Ó&¨#Ñ-ð	"ö#r   c                 óR   € R F   p\        \        W4      RV : RV: 24       K"  	  R# )rG   zwsgi.input (ú) doesn't have the attribute N)rG   rM   rP   rV   ©r   r–   )rA   Úattrs   & r   rº   rº   h  s%   € Û=ˆÜ”˜
Ô)ãš4ð!ö	"ó >r   c                 óR   € R F   p\        \        W4      RV : RV: 24       K"  	  R# )rn   zwsgi.errors (rÁ   N)rn   ri   rr   rÂ   )re   rÃ   s   & r   r»   r»   n  s%   € Û0ˆÜ”˜Ô*ãšDð"ö	#ó 1r   c                 óT  € \        V R 4      p V P                  R^4      ^ ,          p\        \        V4      ^8H  RV,          4       \	        V4      p\        V^d8¬  RV,          4       \        V 4      ^8  g   V ^,          R8w  d%   \
        P                  ! RV ,          \        4       R# R# )ÚStatusNz)Status codes must be three characters: %rzStatus code is invalid: %rÚ zjThe status string (%r) should be a three-digit integer followed by a single space and a status explanation)r   Úsplitr   r!   r¾   r¶   r·   r   )r)   Ústatus_codeÚ
status_ints   &  r   r"   r"   t  s—   € Ü˜v xÓ0€Fà—,‘,˜t QÓ'¨Õ*€KÜŒC�Ó Ñ!Ø3°kÕAôCä�[Ó!€JÜˆJ˜#ÑÐ;¸jÕHÔIÜ
ˆ6ƒ{�Q„˜& �) sÔ*Ü�ŠðBàõä!ö	#ñ +r   c           
      ó@  € \        \        V 4      \        J R V : R\        V 4      : 24       V  EFj  p\        \        V4      \        J RV: R\        V4      : 24       \        \	        V4      ^8H  4       Vw  r#\        VR4      p\        VR4      p\        VP                  4       R8g  RV,          4       \        RV9  ;'       d    R	V9  R
V,          4       \        \        P                  V4      RV,          4       \        VP                  R4      '       * ;'       d    VP                  R4      '       * RV,          4       \        P                  V4      '       g   EK3  \        ^ RV: R\        P                  V4      P                  ^ 4      : R24       EKm  	  R# )z	Headers (z) must be of type list: zIndividual headers (z) must be of type tuple: úHeader namezHeader valuer)   zyThe Status header cannot be used; it conflicts with CGI script, and HTTP status is not given through headers (value: %r).Ú
Ú:z,Header names may not contain ':' or '\n': %rzBad header name: %rÚ-Ú_z#Names may not end in '-' or '_': %rzBad header value: z (bad char: r‘   N)r   r   rQ   r¹   r!   r   ÚlowerÚ	header_reÚsearchÚendswithÚbad_header_value_reÚgroup)r*   ÚitemÚnamer   s   &   r   r#   r#   ‚  sT  € ÜŒD�‹MœTÑ!ã”D˜•Mð	#ô$ô ˆÜ”�T“
œeÑ#ã”T˜$•Zð!ô	"ô 	”�D“	˜Q‘ÔØ‰ˆÜ   }Ó5ˆÜ! %¨Ó8ˆÜ�—
‘
“ Ñ(ðà"õ#ô	$ô 	�˜DÑ ×4Ð4 S°¡_Ø;¸dÕBô	Dä”	× Ñ  Ó&Ð(=ÀÕ(DÔEÜ�D—M‘M #Ó&Ô&×AÐA¨t¯}©}¸SÓ/AÔ+AØ1°DÕ8ô	:ä×%Ñ% e×,Õ,Ü‘AÛÔ)×0Ñ0°Ó7×=Ñ=¸aÖ@ðB÷ Có% r   c                 ó0  € \        V R 4      p \        V P                  R^4      ^ ,          4      pRpV FD  w  rE\        VR4      pVP                  4       R8X  g   K(  W#9  d    R# \	        ^ RV,          4       KF  	  W#9  d   \	        ^ RV,          4       R# R# )rÆ   NrÌ   zcontent-typezJContent-Type header found in a %s response, which must not return content.z,No Content-Type header found in headers (%s))éÌ   i0  )r   r¾   rÈ   rÑ   r   )r)   r*   ÚcodeÚNO_MESSAGE_BODYrØ   r   s   &&    r   r$   r$   ›  s”   € Ü˜v xÓ0€FÜˆv�|‰|˜D !Ó$ QÕ'Ó(€Dð !€OÛ‰ˆÜ   }Ó5ˆØ�:‰:‹<˜>Ö)ØÔ*ÚÜ�Að 9Ø<@õAö Bñ ð Ô"Ü�ÐAÀGÕKÖLñ #r   c           	      óv   € \        V R J ;'       g    \        V 4      \        J RV : R\        V 4      : 24       R # )Nz
exc_info (z) is not a tuple: )r   r   r¹   )r+   s   &r   r%   r%   «  s0   € ÜˆH˜Ð×7Ð7¤ X£´%Ð 7øÛ.6¼¸X½ÐGöIr   c                 óP   € \        \        V \        \        34      '       * R 4       R# )zwYou should not return a string as your application iterator, instead return a single-item list containing a bytestring.N)r   Ú
isinstancer   rH   r‚   s   &r   r5   r5   °  s#   € ô ”
˜8¤c¬5 \Ó2Ô2ð	EöFr   )r
   Ú__all__Úrer™   r¶   ÚcompilerÒ   rÕ   ÚWarningr   r   r   r   r3   r4   r'   r€   r6   r2   rº   r»   r"   r#   r$   r%   r5   r   r   r   Ú<module>rä      s¼   ðñ
iðT ˆ-€ó 
Û 
Û à�JŠJÐ3Ó4€	Ø—j’j Ó0Ð ô�'ô ò
$òHò5÷n7ñ 7÷@8ñ 8÷&ñ ÷4ñ 4÷!?ñ !?òF?#òB"ò#ò#òCò2Mò Iô
Fr   