Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�ddlZddlZddlZddlmZddlmZmZmZiddgfd!gd6ddgfd"gd	6dd
gfd#gd6dd
gfd$gd6ddgfd%gd6ddgfd&gd6ddgfd'gd6ddgfd(gd6ddgfd)gd6ddgfgd6dd
gfddgfgd6ddgfd*gd6Z
d�Zdefd��YZ
d �ZdS(+i�N(tutil(t
ErrorResponset
statusmessagetHTTP_NOT_MODIFIEDtcmdt	changelogtrevtcltshortlogtslt	changesettnodetcstfiletfilenodetftfilelogtfltfiledifftfdtannotatetfatmanifesttmftarchivetcattagsttiptstaticcCs�xhtj�D]Z}||kr
x;t|D]/\}}|dkrO||}n|||<q*W||=q
q
Wx=|j�D]/\}}g|D]}|j�^q�||<qxW|S(N(t	shortcutstiterkeystNonet	iteritemststrip(tformtktnametvaluetvti((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyt	normalizes
'twsgirequestcBsbeZd�Zd�Zdd�Zd�Zd
d
d�Zd�Zd�Z	d�Z
d	�ZRS(cCs�|d}|dks"|d
kr5td|��n|d|_|d|_|d|_|d	|_|d
|_||_ttj	|j|jdd��|_
||_d|_
g|_dS(Nswsgi.versioniiis*Unknown and unsupported WSGI version %d.%ds
wsgi.inputswsgi.errorsswsgi.multithreadswsgi.multiprocesss
wsgi.run_oncetkeep_blank_values(ii(ii(tRuntimeErrortinpterrtthreadedtmultiprocesstrun_oncetenvR(tcgitparseR"t_start_responseRtserver_writetheaders(tselftwsgienvtstart_responsetversion((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyt__init__+s 






				cCs
tg�S(N(titer(R7((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyt__iter__=si�cCs|jj|�S(N(R,tread(R7tcount((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyR>@scCsEt|jjd�pd�}x tj|jd|�D]}q7WdS(s:need to read all data from request, httplib is half-duplextCONTENT_LENGTHitlimitN(tintR1tgetRt
filechunkiterR,(R7tlengthts((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pytdrainCscCs�|jdk	r�|jjd|f�|rs|jd�djdd�jdd�}|jjdd	|f�n|dk	r�|jjd
tt|��f�nx<|jD]1\}}t|t�s�t	d|f��q�q�Wt|t
�rf|jj|j�|jt
krNg|jD]$\}}|dkr||f^q|_nt|j|j�}n3|dkr{d}nt|t�r�t|�}n|j||j�|_d|_g|_n|dk	r�j|�d|_ndS(NsContent-Typet/i�s\s\\t"s\"sContent-Dispositionsinline; filename="%s"sContent-Lengthsheader value must be string: %rtDatetETagtExpiress
Cache-ControltVaryi�s200 Script output follows(RJRKRLs
Cache-ControlRM(R4RR6tappendtsplittreplacetstrtlent
isinstancet	TypeErrorRtextendtcodeRRtmessageRBR5twrite(R7tstatusttypetfilenametbodyR#R&((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pytrespondIs:%!		
cCsP|rLy|j|�WqLtjk
rH}|dtjkrI�qIqLXndS(Ni(R5tsocketterrorterrnot
ECONNRESET(R7tthingtinst((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyRXnscCs"x|D]}|j|�qWdS(N(RX(R7tlinestline((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyt
writelinesvs
cCsdS(N(R(R7((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pytflushzscCsdS(N(R(R7((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pytclose}sN(t__name__t
__module__R;R=R>RGRR]RXRfRgRh(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyR)*s			%			cs|���fd�}|S(s{For compatibility with old CGI scripts. A plain hgweb() or hgwebdir()
    can and should now be used as a WSGI application.cs
�||�S(N((R1R](tapplication(s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pytrun_wsgi�s((t	app_makerRl((Rks;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pytwsgiapplication�s	(RN(RN(snodeN(RN(RN(snodeN(RN(RN(snodeN(sfileN(R^R2R`t	mercurialRtcommonRRRRRR(tobjectR)Rn(((s;/sys/lib/python2.7/site-packages/mercurial/hgweb/request.pyt<module>	s$$	V

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].