�
�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��YZd �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
�Zdddhd�Z
RS(cCs�|d}|djp
|d
jotd|��n|d|_|d|_|d|_|d |_|d
|_||_tti |i|idd��|_
||_d|_
g|_dS(Nswsgi.versioniiis*Unknown and unsupported WSGI version %d.%ds
wsgi.inputswsgi.errorsswsgi.multithreadswsgi.multiprocesss
wsgi.run_oncetkeep_blank_values(ii(ii(tRuntimeErrortinpterrtthreadedtmultiprocesstrun_oncetenvR#tcgitparseRt_start_responseRtserver_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.pyROZscCs"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.pytclosemssContent-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(NsContent-Typet/i�s\s\\t"s\"sContent-Dispositionsinline; filename="%s"sContent-Length(titemsRtappendtsplittreplaceRERG(R2RJRKR@R1((s*/sys/lib/python/mercurial/hgweb/request.pyRCss
N(sContent-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
|