???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................U
    e5d¥T  ã                   @   sü   d dl mZmZmZ d dlmZ ddlZddlZddlZddddd	d
gZ	dddddddgZ
dddddddddddddgZdd„ Zd d!d"d#d$d%d&d'd(d)h
jZd*d+„ Zd,d
„ ZG d-d„ dƒZG d.d„ deƒZG d/d„ deƒZG d0d„ deƒZG d1d	„ d	eƒZdS )2é   )ÚFileWrapperÚguess_schemeÚis_hop_by_hop)ÚHeadersé    NÚBaseHandlerÚSimpleHandlerÚBaseCGIHandlerÚ
CGIHandlerÚIISCGIHandlerÚread_environZMonZTueZWedZThuZFriZSatZSunZJanZFebZMarZAprZMayZJunZJulZAugZSepZOctZNovZDecc           
   	   C   s:   t  | ¡\	}}}}}}}}}	dt| |t| ||||f S )Nz#%s, %02d %3s %4d %02d:%02d:%02d GMT)ÚtimeÚgmtimeÚ_weekdaynameÚ
_monthname)
Z	timestampZyearZmonthZdayZhhZmmZssZwdÚyÚz© r   ú(/usr/lib64/python3.8/wsgiref/handlers.pyÚformat_date_time   s          ÿr   ÚSCRIPT_NAMEÚ	PATH_INFOZQUERY_STRINGZREQUEST_METHODZ	AUTH_TYPEZCONTENT_TYPEZCONTENT_LENGTHZHTTPSZREMOTE_USERZREMOTE_IDENTc                 C   s6   t | ƒp4|  d¡p4|  d¡p4|  d¡o4t| dd … ƒS )NZHTTP_ZSSL_Z	REDIRECT_é	   )Ú_is_requestÚ
startswithÚ_needs_transcode)Úkr   r   r   r      s    ÿr   c                  C   sð   t  ¡ } d}zd d|¡ W n tk
r4   d}Y nX i }tj ¡ D ]¦\}}t|ƒrât jdkrÐtj 	dd¡ 
¡ }| d¡rŒ| d¡ d¡}qâ| d	¡r˜qâ| d
¡r¼d|kr¼| d¡ d¡}qâ| | d¡ d¡}n| | |¡ d¡}|||< qD|S )NÚsurrogateescapeÚ zutf-8ÚreplaceZwin32ÚSERVER_SOFTWAREzmicrosoft-iis/ú
iso-8859-1zapache/zsimplehttp/zpython/3)ÚsysÚgetfilesystemencodingÚencodeÚLookupErrorÚosÚenvironÚitemsr   ÚplatformÚgetÚlowerr   Údecode)ÚencZescr'   r   ÚvZsoftwarer   r   r   r   "   s0    

	

ÿþ
c                   @   s  e Zd ZdZdZdZdZdZdZdZ	e
ƒ ZeZeZdZdZdgZdZd ZZdZdZd	Zd
d„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd:dd„Zdd„ Z dd„ Z!dd„ Z"dd„ Z#d d!„ Z$d"d#„ Z%d$d%„ Z&d&d'„ Z'd(d)„ Z(d*d+„ Z)d,d-„ Z*d.d/„ Z+d0d1„ Z,d2d3„ Z-d4d5„ Z.d6d7„ Z/d8d9„ Z0dS );r   )r   r   TFz1.0Nz500 Internal Server Error)zContent-Typez
text/plains;   A server error occurred.  Please contact the administrator.r   c              
   C   st   z$|   ¡  || j| jƒ| _|  ¡  W nJ tttfk
r@   Y d S    z|  ¡  W n   |  	¡  ‚ Y nX Y nX d S ©N)
Úsetup_environr'   Ústart_responseÚresultÚfinish_responseÚConnectionAbortedErrorÚBrokenPipeErrorÚConnectionResetErrorÚhandle_errorÚclose)ÚselfZapplicationr   r   r   Úrun€   s    zBaseHandler.runc                 C   s–   | j  ¡  }| _|  ¡  |  ¡ |d< |  ¡ |d< | j|d< | j|d< |  ¡ |d< | j	|d< | j
|d< | jd k	rx| j|d< | jr’| jr’| d	| j¡ d S )
Nz
wsgi.inputzwsgi.errorszwsgi.versionzwsgi.run_oncezwsgi.url_schemezwsgi.multithreadzwsgi.multiprocesszwsgi.file_wrapperr    )Ú
os_environÚcopyr'   Úadd_cgi_varsÚ	get_stdinÚ
get_stderrÚwsgi_versionÚwsgi_run_onceÚ
get_schemeÚwsgi_multithreadÚwsgi_multiprocessÚwsgi_file_wrapperÚorigin_serverÚserver_softwareÚ
setdefault)r9   Úenvr   r   r   r0   ˜   s    





zBaseHandler.setup_environc                 C   sd   z2|   ¡ r|  ¡ s0| jD ]}|  |¡ q|  ¡  W n$   t| jdƒrP| j ¡  ‚ Y n
X |  ¡  d S )Nr8   )Úresult_is_fileÚsendfiler2   ÚwriteÚfinish_contentÚhasattrr8   ©r9   Údatar   r   r   r3   ­   s    

zBaseHandler.finish_responsec                 C   s
   t | jƒS r/   )r   r'   ©r9   r   r   r   rB   Ç   s    zBaseHandler.get_schemec              
   C   sJ   zt | jƒ}W n tttfk
r(   Y nX |dkrFt| jƒ| jd< d S d S )Nr   úContent-Length)Úlenr2   Ú	TypeErrorÚAttributeErrorÚNotImplementedErrorÚstrÚ
bytes_sentÚheaders)r9   Zblocksr   r   r   Úset_content_lengthÌ   s    zBaseHandler.set_content_lengthc                 C   s   d| j kr|  ¡  d S )NrR   )rY   rZ   rQ   r   r   r   Úcleanup_headersÙ   s    
zBaseHandler.cleanup_headersc                 C   sh   |r2z$| j r&|d |d ƒ |d ¡‚W 5 d }X n| jd k	rDtdƒ‚|| _|  |¡| _|  |d¡}| jS )Nr   r   é   zHeaders already set!ZStatus)Úheaders_sentÚwith_tracebackrY   ÚAssertionErrorÚstatusÚheaders_classÚ_convert_string_typerL   )r9   r`   rY   Úexc_infor   r   r   r1   á   s    
zBaseHandler.start_responsec                 C   s(   t |ƒtkr|S td |t|ƒ¡ƒ‚d S )Nz!{0} must be of type str (got {1}))ÚtyperW   r_   ÚformatÚrepr)r9   ÚvalueÚtitler   r   r   rb   þ   s
    ÿz BaseHandler._convert_string_typec                 C   s’   | j rx|  ¡ rŽ|  d| j| jf  d¡¡ d| jkrP|  dtt ¡ ƒ  d¡¡ | j	rŽd| jkrŽ|  d| j	  d¡¡ n|  d| j  d¡¡ d S )NzHTTP/%s %s
r!   ZDatez
Date: %s
ZServerzServer: %s
zStatus: %s
)
rF   Úclient_is_modernÚ_writeÚhttp_versionr`   r$   rY   r   r   rG   rQ   r   r   r   Úsend_preamble  s    
ÿzBaseHandler.send_preamblec                 C   sR   | j stdƒ‚n,| js*t|ƒ| _|  ¡  n|  jt|ƒ7  _|  |¡ |  ¡  d S )Nzwrite() before start_response())r`   r_   r]   rS   rX   Úsend_headersrj   Ú_flushrO   r   r   r   rL     s    



zBaseHandler.writec                 C   s   dS )NFr   rQ   r   r   r   rK   )  s    zBaseHandler.sendfilec                 C   s"   | j s| j dd¡ |  ¡  n d S )NrR   Ú0)r]   rY   rH   rm   rQ   r   r   r   rM   >  s    
zBaseHandler.finish_contentc              	   C   sF   zt| j dƒr| j  ¡  W 5 d  | _  | _ | _| _d| _d| _X d S )Nr   Fr8   )r2   rY   r`   r'   rX   r]   rN   r8   rQ   r   r   r   r8   H  s     zBaseHandler.closec                 C   s8   |   ¡  d| _| jr|  ¡ r4|  ¡  |  t| jƒ¡ d S )NT)r[   r]   rF   ri   rl   rj   ÚbytesrY   rQ   r   r   r   rm   U  s
    zBaseHandler.send_headersc                 C   s   | j }|d k	ot| j|ƒS r/   )rE   Ú
isinstancer2   )r9   Úwrapperr   r   r   rJ   ^  s    zBaseHandler.result_is_filec                 C   s   | j d  ¡ dkS )NZSERVER_PROTOCOLzHTTP/0.9)r'   ÚupperrQ   r   r   r   ri   d  s    zBaseHandler.client_is_modernc                 C   sJ   z>ddl m} |  ¡ }||d |d |d | j|ƒ | ¡  W 5 d }X d S )Nr   )Úprint_exceptionr   r\   )Ú	tracebackrt   r?   Útraceback_limitÚflush)r9   rc   rt   Ústderrr   r   r   Úlog_exceptioni  s       þzBaseHandler.log_exceptionc                 C   s2   |   t ¡ ¡ | js.|  | j| j¡| _|  ¡  d S r/   )	ry   r"   rc   r]   Úerror_outputr'   r1   r2   r3   rQ   r   r   r   r7   y  s    zBaseHandler.handle_errorc                 C   s$   || j | jd d … t ¡ ƒ | jgS r/   )Úerror_statusÚerror_headersr"   rc   Ú
error_body)r9   r'   r1   r   r   r   rz     s    zBaseHandler.error_outputc                 C   s   t ‚d S r/   ©rV   rO   r   r   r   rj   ”  s    zBaseHandler._writec                 C   s   t ‚d S r/   r~   rQ   r   r   r   rn     s    zBaseHandler._flushc                 C   s   t ‚d S r/   r~   rQ   r   r   r   r>   ¥  s    zBaseHandler.get_stdinc                 C   s   t ‚d S r/   r~   rQ   r   r   r   r?   ©  s    zBaseHandler.get_stderrc                 C   s   t ‚d S r/   r~   rQ   r   r   r   r=   ­  s    zBaseHandler.add_cgi_vars)N)1Ú__name__Ú
__module__Ú__qualname__r@   rC   rD   rA   rF   rk   rG   r   r;   r   rE   r   ra   rv   r{   r|   r}   r`   r2   r]   rY   rX   r:   r0   r3   rB   rZ   r[   r1   rb   rl   rL   rK   rM   r8   rm   rJ   ri   ry   r7   rz   rj   rn   r>   r?   r=   r   r   r   r   r   ^   sT   

		c                   @   s>   e Zd Zddd„Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ ZdS )r   TFc                 C   s(   || _ || _|| _|| _|| _|| _d S r/   )ÚstdinÚstdoutrx   Úbase_envrC   rD   )r9   r‚   rƒ   rx   r'   ÚmultithreadÚmultiprocessr   r   r   Ú__init__¿  s    zSimpleHandler.__init__c                 C   s   | j S r/   )r‚   rQ   r   r   r   r>   É  s    zSimpleHandler.get_stdinc                 C   s   | j S r/   )rx   rQ   r   r   r   r?   Ì  s    zSimpleHandler.get_stderrc                 C   s   | j  | j¡ d S r/   )r'   Úupdater„   rQ   r   r   r   r=   Ï  s    zSimpleHandler.add_cgi_varsc                 C   s^   | j  |¡}|d ks |t|ƒkr$d S ddlm} |dtƒ ||d … }|sLqZ| j  |¡}q:d S )Nr   )Úwarnz9SimpleHandler.stdout.write() should not do partial writes)rƒ   rL   rS   Úwarningsr‰   ÚDeprecationWarning)r9   rP   r2   r‰   r   r   r   rj   Ò  s    ÿzSimpleHandler._writec                 C   s   | j  ¡  | j j| _d S r/   )rƒ   rw   rn   rQ   r   r   r   rn   ß  s    
zSimpleHandler._flushN)TF)	r   r€   r   r‡   r>   r?   r=   rj   rn   r   r   r   r   r   ²  s      ÿ

c                   @   s   e Zd ZdZdS )r	   FN)r   r€   r   rF   r   r   r   r   r	   ä  s   c                   @   s   e Zd ZdZi Zdd„ ZdS )r
   Tc              	   C   s(   t j| tjjtjjtjtƒ ddd d S )NFT©r…   r†   )r	   r‡   r"   r‚   Úbufferrƒ   rx   r   rQ   r   r   r   r‡     s         þzCGIHandler.__init__N©r   r€   r   rA   r;   r‡   r   r   r   r   r
   ü  s   c                   @   s   e Zd ZdZi Zdd„ ZdS )r   Tc              	   C   sj   t ƒ }| dd¡}| dd¡}|d  |d ¡rD|t|ƒd … |d< tj| tjjtj	jtj
|ddd d S )Nr   r   r   ú/FTrŒ   )r   r*   r   rS   r	   r‡   r"   r‚   r   rƒ   rx   )r9   r'   ÚpathZscriptr   r   r   r‡   2  s         þzIISCGIHandler.__init__NrŽ   r   r   r   r   r     s   )Úutilr   r   r   rY   r   r"   r&   r   Ú__all__r   r   r   Ú__contains__r   r   r   r   r   r	   r
   r   r   r   r   r   Ú<module>   sZ       þ          þ        þ<  V2