mς σRΕDc@s­dklZdkZdkZdkZeeƒdƒeeƒdƒeeƒdƒdklZd„Z de fd„ƒYZ d e e i fd „ƒYZd „ZdS( (s demandloadNs)urllib BaseHTTPServer socket SocketServersmercurial:ui,hg,util,templaters=hgweb_mod:hgweb hgwebdir_mod:hgwebdir request:wsgiapplication(sgettextcCsId|jo|iddƒ\}}n|d}}ti|ƒ|fS(sx Return path and query splited from uri Just like CGI environment, the path is unquoted, the query is not. t?itN(turitsplittpathtqueryturllibtunquote(RRR((t:/usr/lib/python2.4/site-packages/mercurial/hgweb/server.pyt _splitURIs   t _error_loggercBs,tZd„Zd„Zd„Zd„ZRS(NcCs ||_dS(N(thandlertself(R R ((Rt__init__scCsdS(N((R ((RtflushscCsti|idƒƒdS(Ns (R t writelineststrR(R((Rtwrite!scCs(x!|D]}tiid|ƒqWdS(Ns HG error: %s(tseqtmsgR R t log_error(RR((RR#s(t__name__t __module__R RRR(((RR s   t _hgwebhandlercBs\tZd„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Z d „Z RS( NcOs#d|_tii|||ŽdS(NsHTTP/1.1(R tprotocol_versiontBaseHTTPServertBaseHTTPRequestHandlerR targstkargs(R RR((RR (s cGs:|ii}|id|iƒ|iƒ||fƒdS(Ns%s - - [%s] %s (R tserverterrorlogRtaddress_stringtlog_date_time_stringtformatR(R R!RR((RR,s cGs:|ii}|id|iƒ|iƒ||fƒdS(Ns%s - - [%s] %s (R Rt accesslogRRR R!R(R R!RR"((Rt log_message2s cCsHy|iƒWn3tij o$}|dtijo‚qDnXdS(Ni(R tdo_hgwebtsocketterrortinstterrnotEPIPE(R R'((Rtdo_POST8s cCs|iƒdS(N(R R*(R ((Rtdo_GET?sc Cs«t|iƒ\}} h} d| d<|i| d<|ii| dRPRRQ((RR$Bs^      <            cCs<|iptdƒ‚n|iiddƒ}t|dƒ|d<|i|Œt}xR|i D]G}|i |Œ|di ƒdjot }t|dƒ|_q`q`Wdg}|iiddƒidƒD]}||iƒi ƒqΡ~jo t}n|o|i d dƒn||_|iƒt|_dS( Ns.Sending headers before start_response() callediiscontent-lengthtcloset connectionRt,t Connection(R R[tAssertionErrorRRFtintt send_responseRYt should_closeR\RLt send_headertlowerR]RIRJRDtgetttokenRRRZt end_headersR^(R RLRkRJRoR[((Rt send_headersvs&    L   c Csy|iddƒ\}}t|ƒ}||_d}g}|D](}|di ƒ|jo ||q>q>~|_ |iS(NiRestransfer-encodingi(s connectionstransfer-encoding(t http_statusRRFtcodeRRiR R[t bad_headersRJRDRLRmR\Rc( R RrRDtexc_infoRsRtRJRLR((RR`s   ?cCs£|iptdƒ‚n|ip|iƒn|idj o@t|ƒ|ijotdƒ‚n|it|ƒ|_n|i i |ƒ|i i ƒdS(Ns+data written before start_response() calledsLContent-length header sent, but more bytes than specified are being written.( R R[RhR^RqRIRFtlenRbtwfileRR(R Rb((RRc–s  ( RRR RR#R*R+R$RqRFR`Rc(((RR's      4  csšt}d„} |idddƒ} t|idddƒƒ}|iddƒ} |iddƒ‰| |idd d ƒt i ƒ‰| |idd d ƒt iƒ‰|o1yd kl}Wqέtj o t}qέXn|o ti}n1ttd ƒo ti}ndfd„ƒY}dt|tif‡‡‡‡d†ƒY}d|f‡d†ƒY‰| oˆ| |ftƒSn|| |ftƒSdS(NcCs)|o|djot|dƒSn|S(NR9tw(topttopentdefault(RyR{((Rtopenlog₯stwebtaddressRtporti@tipv6t webdir_confR"R9R(s activeCounttforkt_mixincBstZRS(N(RR(((RRƒ½stMercurialHTTPServercs)tZ‡‡‡‡d†Z‡d†ZRS(Ncsktii|||Žˆ|_ˆ|_ˆ|_ˆ|_ t |_ t |_ t|iƒ|_t|_dS(N(Rt HTTPServerR R RRR"RtrepoRthgwebdirt webdirmakerthgwebt repoviewmakertwsgiapplicationt make_handlerR_RYtdaemon_threads(R RR(R"RRR†(RR ΐs      csn|io|i|iƒ}nK|idj o%|iˆiˆiˆi ƒƒ}nt i t dƒƒ‚|S(Ns no repo found( R RRˆthgwebobjR†RFRŠt __class__tuitorigrootthgt RepoErrorR:(R RŽ(R†(RRŒΛs (RRR RŒ((R"RRR†(RR„Ώs tIPv6HTTPServercs&tZeeddƒZ‡d†ZRS(NtAF_INET6csF|idjotitdƒƒ‚ntˆ|ƒi||ŽdS(Ns!IPv6 not available on this system( R taddress_familyRFR’R“R:tsuperR”R Rtkwargs(R RR˜(R”(RR Ψs(RRtgetattrR%RFR–R ((R”(RR”Υs( RYt use_threadsR|RtconfigR~RiRt configbooltuse_ipv6RtsyststdoutR"tstderrRt threadingt activeCountt ImportErrorR]RVRWRƒthasattrtosRXtobjectRR…R„R”R(RR†RšRR’RƒR„RR"R|R”R~RR((R†R"R”RRRt create_server’s. !!  +(tmercurial.demandloadt demandloadR₯RžR(tglobalstmercurial.i18ntgettextR:R R¦R RRRR§( R(RR©R§RžR R R₯R:((RR s    {