-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/hgweb/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyc


l\c@sddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddl
mZdZdefdYZdejfd	YZd
efdYZdefd
YZy$ddlmZeejZWnEek
ree	jedrLejZqfdefdYZnXdZdeeejfdYZdefdYZ dZ!dS(iN(tutilterror(tcommon(t_cCsGd|kr'|jdd\}}n
|d}}tj||fS(sReturn path and query that has been split from uri

    Just like CGI environment, the path is unquoted, the query is
    not.
    t?it(tsplitturllibtunquote(turitpathtquery((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyt	_splitURIs
t
_error_loggercBs,eZdZdZdZdZRS(cCs
||_dS(N(thandler(tselfR((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyt__init__scCsdS(N((R((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytflushscCs|j|jddS(Ns
(t
writelinesR(Rtstr((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytwritescCs(x!|D]}|jjd|qWdS(Ns
HG error:  %s(Rt	log_error(Rtseqtmsg((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR!s
(t__name__t
__module__RRRR(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR
s			t_httprequesthandlercBseZdZedZdZdZdZdZdddZ	dZ
d	Zd
ZdZ
dZdd
ZdZdZRS(thttpcCsdS(s*Prepare .socket of new HTTPServer instanceN((t
httpservertssl_cert((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytpreparehttpserver)scOs#d|_tjj|||dS(NsHTTP/1.1(tprotocol_versiontBaseHTTPServertBaseHTTPRequestHandlerR(Rtargstkargs((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR.s	cGs9|jd|jd|j||f|jdS(Ns%s - - [%s] %s
i(Rtclient_addresstlog_date_time_stringR(RtfptformatR"((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyt_log_any2s	cGs|j|jj||dS(N(R(tserverterrorlog(RR'R"((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR8scGs|j|jj||dS(N(R(R)t	accesslog(RR'R"((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytlog_message;st-c
Csg}tj|drPg|jjD]}|djdr(|^q(}n|jd|jt|t|djgt	|D]}d|^qdS(Ntheadersisx-s"%s" %s %s%sRs %s:%s(
RtsafehasattrR.titemst
startswithR,trequestlineRtjointsorted(Rtcodetsizetxheadersth((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytlog_request>s"	cCsDy|jWn/tjk
r?}|dtjkr@q@nXdS(Ni(tdo_hgwebtsocketRterrnotEPIPE(Rtinst((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytdo_writeGs
cCswy|jWnbtk
rr|jdg|jddjtjtj}|j	d|j
|nXdS(Ns500 Internal Server ErrorsInternal Server ErrorRs5Exception happened during processing request '%s':
%s(R?t	Exceptiont_start_responset_writeR3t	tracebacktformat_exceptiontsystexc_infoRR
(Rttb((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytdo_POSTNs

	cCs|jdS(N(RH(R((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytdo_GETXsc
Cst|j\}}i}d|d<|j|d<|jj|d<t|jj|d<|j|d<|jj|d<|t|jj|d<|j	d	|d
<|j	d	|d<|r||d<n|j
jdkr|j
j
|d
<n|j
j|d
<|j
jd}|r||d<nxg|j
jD]}|d!kr1|^q1D]_}d|jddj}|j
j|}|jddj}|rM|||<qMqMW|j|d<d"|d<|j|d<|jddjdkrtj|j|jj|_n|j|d<t||d<t|jtj|d<t|jtj |d<d	|d <d|_!g|_"t#|_$d|_%d|_&x-|jj'||j(D]}	|j)|	qW|j$s|j*n|j+dS(#NsCGI/1.1tGATEWAY_INTERFACEtREQUEST_METHODtSERVER_NAMEtSERVER_PORTtREQUEST_URItSCRIPT_NAMEt	PATH_INFOitREMOTE_HOSTtREMOTE_ADDRtQUERY_STRINGtCONTENT_TYPEscontent-lengthtCONTENT_LENGTHscontent-typetHTTP_R-Rs
RtSERVER_PROTOCOLiswsgi.versionswsgi.url_schemetHTTP_EXPECTs100-continues
wsgi.inputswsgi.errorsswsgi.multithreadswsgi.multiprocesss
wsgi.run_once(scontent-typescontent-length(ii(,RR
tcommandR)tserver_nameRtserver_porttprefixtlenR$R.t
typeheadertNonettypet	getheadertkeystreplacetuppertstriptrequest_versiont
url_schemetgettlowerRtcontinuereadertrfiletwfileRR
t
isinstancetSocketServertThreadingMixIntForkingMixIntsaved_statust
saved_headerstFalsetsent_headerstlengtht_chunkedtapplicationRARBtsend_headerst_done(
RR
RtenvRuR8theaderthkeythvaltchunk((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR:[s`







!
		
						
cCs1|jstdn|jjdd}t|d|d<|j|d|_t|_xJ|j	D]?}|j
||djdkrjt|d|_qjqjW|jdkr|dtj
kr|jo|jdk|_|jr|j
ddq|j
dd	n|jt|_dS(
Ns.Sending headers before start_response() callediiscontent-lengthsHTTP/1.1sTransfer-Encodingtchunkedt
Connectiontclose(RqtAssertionErrorRR_tintt
send_responseRuRsRvRrtsend_headerRiRtHTTP_NOT_MODIFIEDtclose_connectionRftend_headerstTrueRt(RRqR8((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRxs(	
		

	
cCsl|jdd\}}t|}||_d}g|D]"}|dj|kr:|^q:|_|jS(Nit
connectionstransfer-encodingi(s
connectionstransfer-encoding(RR_RRqRiRrRB(Rthttp_statusR.RFR5Rtbad_headersR8((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRAs	
%cCs|jstdn|js.|jn|jdk	rzt||jkratdn|jt||_n(|jr|rdt||f}n|jj	||jj
dS(Ns+data written before start_response() calledsLContent-length header sent, but more bytes than specified are being written.s%x
%s
(RqRRtRxRuR_R]RvRlRR(Rtdata((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRBs		
cCs-|jr)|jjd|jjndS(Ns0

(RvRlRR(R((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRys	N(RRRgtstaticmethodRRR(RR,R9R?RHRIR:RxR_RARBRy(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR%s							
		7			t_httprequesthandleropensslcBs>eZdZdZedZdZdZdZRS(s HTTPS handler based on pyOpenSSLthttpscCsyddl}|jjWn4tk
rPtjtdtddnX|jj|jj}|j||j	|t
j
|j|j}|jj
|||_
|j|jdS(NisSSL support is unavailables  (try installing the %s package)spython-openssl(tOpenSSLtSSLtContexttImportErrorRtAbortRt
SSLv23_METHODtuse_privatekey_filetuse_certificate_fileR;taddress_familytsocket_typeRtserver_bindtserver_activate(RRRtctxtsock((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs



cCsL|j|_tj|jd|j|_tj|jd|j|_dS(Ntrbtwb(trequestRR;t_fileobjecttrbufsizeRktwbufsizeRl(R((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytsetupscCsYddl}ytj|Wn5|jjk
rT}|jdtjkrUqUnXdS(Nii(RRR?RtSysCallErrorR"R<R=(RRR>((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR?scCsPddl}ytj|Wn,|jj|jjfk
rKt|_nXdS(Ni(RRthandle_one_requestRRtZeroReturnErrorRR(RR((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs	(	RRt__doc__RgRRRR?R(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs		t_httprequesthandlersslcBs,eZdZdZedZdZRS(s=HTTPS handler based on Pythons ssl module (introduced in 2.6)RcCs|yddl}|jWn4tk
rMtjtdtddnX|j|jdtd|d|j|_dS(NisSSL support is unavailables  (try installing the %s package)spython-openssltserver_sidetcertfiletssl_version(	tssltwrap_socketRRRRR;RtPROTOCOL_SSLv23(RRR((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs
cCsL|j|_tj|jd|j|_tj|jd|j|_dS(NRR(RRR;RRRkRRl(R((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs(RRRRgRRR(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs(tactiveCounttforkt_mixincBseZRS((RR(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRscCs#|r|dkrt|dS|S(NR-ta(topen(topttdefault((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pytopenlogs
tMercurialHTTPServercBs)eZejdkrdZndZRS(tntic	Kstjj||||t|_||_|j||jdd|jddd}|rxd|jd}n||_	t
|jdddtj}t
|jdddtj
}||_||_|jjd	d
!\|_|_tj|d	|_dS(NtwebtcertificateR\Rt/R+R-R*ii(R t
HTTPServerRRtdaemon_threadsRwRtconfigReR\RREtstdouttstderrR+R*R;tgetsocknametaddrtporttgetfqdntfqaddr(	RtuitappRRtkwargsR\talogtelog((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs			!!		"(RRtostnametallow_reuse_addressR(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyRs	tIPv6HTTPServercBs#eZeeddZdZRS(tAF_INET6cOsD|jdkr'tjtdntt|j||dS(Ns$IPv6 is not available on this system(RR_Rt	RepoErrorRtsuperRR(RR"R((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR2sN(RRtgetattrR;R_RR(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyR0sc	Cs_|jddr3tjdkr*t}q9t}nt}|jddrTt}nt}yddl	}|j
WnRtk
rtjt
ttj}tjd|j
tj|nX|jddd	}tj|jdd
d}y|||||f|SWn?tjk
rZ}tjtd|||jd
fnXdS(NRRiitipv6itlatin1taddressRRi@s"cannot start server at '%s:%d': %si(ii(RREtversion_infoRRRt
configboolRRt	mimetypestinittUnicodeDecodeErrortargvtreloadtgetdefaultencodingtsetdefaultencodingRtgetportR;RRRR"(	RRRtclsRtoldencRRR>((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyt
create_server7s2			



("RRER<RR R;RnRCt	mercurialRRtmercurial.hgwebRtmercurial.i18nRRtobjectR
R!RRRt	threadingRRoRRR/RpRRRRR(((s:/usr/lib/python2.7/dist-packages/mercurial/hgweb/server.pyt<module>	s(`	*

	

Copyright © 2017 || Recoded By Mr.Bumblebee