Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/hgweb/request.pyc

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


�
�c
@s�ddkZddkZddkZddklZddklZlZhddgfd!gd<ddgfd"gd	<dd
gfd#gd<dd
gfd$gd<ddgfd%gd<ddgfd&gd<ddgfd'gd<ddgfd(gd<ddgfd)gd<ddgfgd<dd
gfddgfgd<ddgfd*gd<Z	d�Z
defd��YZd �Z
dS(+i�N(tutil(t
ErrorResponset
statusmessagetcmdt	changelogtrevtcltshortlogtslt	changesettnodetcstfiletfilenodetftfilelogtfltfiledifftfdtannotatetfatmanifesttmftarchivetcattagsttiptstaticcCssxlti�D]^}||joKx=t|D]1\}}|djo||}n|||<q+W||=q
q
W|S(N(t	shortcutstiterkeystNone(tformtktnametvalue((s*/sys/lib/python/mercurial/hgweb/request.pytexpands


twsgirequestcBs�eZd�Zd�Zdd�Zd�Zdddd�Zd�Zd�Z	d	�Z
d
�Zdgd
�Zdddhd�Z
RS(cCs�|d}|djp
|d
jotd|��n|d|_|d|_|d|_|d	|_|d
|_||_tti	|i|idd��|_
||_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#tcgitparseRt_start_responseRtserver_writetheaders(tselftwsgienvtstart_responsetversion((s*/sys/lib/python/mercurial/hgweb/request.pyt__init__'s





	'		cCs
tg�S(N(titer(R2((s*/sys/lib/python/mercurial/hgweb/request.pyt__iter__7si�cCs|ii|�S(N(R'tread(R2tcount((s*/sys/lib/python/mercurial/hgweb/request.pyR9:scCsBt|iidd��}x ti|id|�D]}q4WdS(s:need to read all data from request, httplib is half-duplextCONTENT_LENGTHitlimitN(tintR,tgetRt
filechunkiterR'(R2tlengthts((s*/sys/lib/python/mercurial/hgweb/request.pytdrain=sicCs|idj	o|i|||�|iptd��nx;|iD]0\}}t|t�ptd|��qGqGWt|t�o#|i	|i�t
|i�}n8|djo
d}n!t|t�ot
|�}n|i||i�|_
d|_g|_ndS(Ns(request.write called before headers sentsheader value must be string: %ri�s200 Script output follows(R/RthttphdrR1R&t
isinstancetstrt	TypeErrorRtheaderRtcodeR=R0(R2tstatusttypetfilenameR@R tv((s*/sys/lib/python/mercurial/hgweb/request.pytrespondCs$



	cCs�t|d�o"xr|D]}|i|�qWnTt|�}y|i|�Wn3tij
o$}|dtijo�q�nXdS(NR8i(thasattrtwriteRER0tsocketterrorterrnot
ECONNRESET(R2tthingtparttinst((s*/sys/lib/python/mercurial/hgweb/request.pyROZscCs"x|D]}|i|�qWdS(N(RO(R2tlinestline((s*/sys/lib/python/mercurial/hgweb/request.pyt
writelinesfscCsdS(N(R(R2((s*/sys/lib/python/mercurial/hgweb/request.pytflushjscCsdS(N(R(R2((s*/sys/lib/python/mercurial/hgweb/request.pytclosemssContent-Types	text/htmlcCs|ii|�dS(N(R1textend(R2R1((s*/sys/lib/python/mercurial/hgweb/request.pyRGpscCs�|i�}|dj	o|id|f�n|oF|id�didd�idd�}|idd	|f�n|o|id
t|�f�n|i|�dS(NsContent-Typet/i�s\s\\t"s\"sContent-Dispositionsinline; filename="%s"sContent-Length(titemsRtappendtsplittreplaceRERG(R2RJRKR@R1((s*/sys/lib/python/mercurial/hgweb/request.pyRCss
	N(sContent-Types	text/html(t__name__t
__module__R6R8R9RBRRMRORYRZR[RGRC(((s*/sys/lib/python/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((R,RM(tapplication(s*/sys/lib/python/mercurial/hgweb/request.pytrun_wsgi�s((t	app_makerRf((Res*/sys/lib/python/mercurial/hgweb/request.pytwsgiapplication�s	(srevN(srevN(snodeN(sfilenodeN(sfilenodeN(snodeN(sfilenodeN(smanifestN(snodeN(sfileN(RPR-RRt	mercurialRtcommonRRRRR#tobjectR$Rh(((s*/sys/lib/python/mercurial/hgweb/request.pys<module>	s$$!	
Z

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.