HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python2.7/dist-packages/mercurial/keepalive.pyc

Xc@@sdZddlmZmZddlZddlZddlZddlZddlZddl	m
Z
e
jZe
jZe
j
Z
daejdkrdandadefd	YZd
efdYZdee
jfd
YZdejfdYZdZdZdejfdYZdZdZdZddZdZddZ e!dkrddl"Z"y$e#ej$dZ%ej$dZ&Wn,e'e(fk
re)dej$dqXe e&e%ndS(s
An HTTP handler for urllib2 that supports HTTP 1.1 and keepalive.

>>> import urllib2
>>> from keepalive import HTTPHandler
>>> keepalive_handler = HTTPHandler()
>>> opener = urlreq.buildopener(keepalive_handler)
>>> urlreq.installopener(opener)
>>>
>>> fo = urlreq.urlopen('http://www.python.org')

If a connection to a given host is requested, and all of the existing
connections are still in use, another connection will be opened.  If
the handler tries to use an existing connection but it fails in some
way, it will be closed and removed from the pool.

To remove the handler, simply re-run build_opener with no arguments, and
install that opener.

You can explicitly close connections by using the close_connection()
method of the returned file-like object (described below) or you can
use the handler methods:

  close_connection(host)
  close_all()
  open_connections()

NOTE: using the close_connection and close_all methods of the handler
should be done with care when using multiple threads.
  * there is nothing that prevents another thread from creating new
    connections immediately after connections are closed
  * no checks are done to prevent in-use connections from being closed

>>> keepalive_handler.close_all()

EXTRA ATTRIBUTES AND METHODS

  Upon a status of 200, the object returned has a few additional
  attributes and methods, which should not be used if you want to
  remain consistent with the normal urllib2-returned objects:

    close_connection()  -  close the connection to the host
    readlines()         -  you know, readlines()
    status              -  the return status (i.e. 404)
    reason              -  english translation of status (i.e. 'File not found')

  If you want the best of both worlds, use this inside an
  AttributeError-catching try:

  >>> try: status = fo.status
  >>> except AttributeError: status = None

  Unfortunately, these are ONLY there if status == 200, so it's not
  easy to distinguish between non-200 responses.  The reason is that
  urllib2 tries to do clever things with error codes 301, 302, 401,
  and 407, and it wraps the object upon return.

  For python versions earlier than 2.4, you can avoid this fancy error
  handling by setting the module-level global HANDLE_ERRORS to zero.
  You see, prior to 2.4, it's the HTTP Handler's job to determine what
  to handle specially, and what to just pass up.  HANDLE_ERRORS == 0
  means "pass everything up".  In python 2.4, however, this job no
  longer belongs to the HTTP Handler and is now done by a NEW handler,
  HTTPErrorProcessor.  Here's the bottom line:

    python version < 2.4
        HANDLE_ERRORS == 1  (default) pass up 200, treat the rest as
                            errors
        HANDLE_ERRORS == 0  pass everything up, error processing is
                            left to the calling code
    python version >= 2.4
        HANDLE_ERRORS == 1  pass up 200, treat the rest as errors
        HANDLE_ERRORS == 0  (default) pass everything up, let the
                            other handlers (specifically,
                            HTTPErrorProcessor) decide what to do

  In practice, setting the variable either way makes little difference
  in python 2.4, so for the most consistent behavior across versions,
  you probably just want to use the defaults, which will give you
  exceptions on errors.

i(tabsolute_importtprint_functionNi(tutiliitConnectionManagercB@sGeZdZdZdZdZdZdZddZ	RS(sV
    The connection manager must be able to:
      * keep track of all existing
      cC@s.tj|_i|_i|_i|_dS(N(t	threadingtLockt_lockt_hostmapt_connmapt	_readymap(tself((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt__init__s		cC@ss|jjzQ||jkr/g|j|<n|j|j|||j|<||j|<Wd|jjXdS(N(RtacquireRtappendRR	trelease(R
thostt
connectiontready((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytadds

cC@s|jjzky|j|}Wntk
r4nCX|j|=|j|=|j|j||j|sw|j|=nWd|jjXdS(N(RRRtKeyErrorR	RtremoveR(R
RR((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRs




cC@s)y||j|<Wntk
r$nXdS(N(R	R(R
RR((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt	set_readys
cC@szd}|jjzR||jkrdx<|j|D]*}|j|r3d|j|<|}Pq3q3WnWd|jjX|S(Ni(tNoneRRRR	R(R
Rtconntc((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytget_ready_conns


cC@s0|rt|jj|gSt|jSdS(N(tlistRtgettdict(R
R((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytget_allsN(
t__name__t
__module__t__doc__RRRRRRR(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRs					tKeepAliveHandlercB@seeZdZdZdZdZdZddZdZdZ	d	Z
d
ZRS(cC@st|_dS(N(Rt_cm(R
((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRscC@s8g|jjjD]\}}|t|f^qS(streturn a list of connected hosts and the number of connections
        to each.  [('foo.com:80', 2), ('bar.org', 1)](R"Rtitemstlen(R
Rtli((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytopen_connectionsscC@s;x4|jj|D] }|jj||jqWdS(sclose connection(s) to <host>
        host is the host:port spec, as in 'www.cnn.com:8080' as passed in.
        no error occurs if there is no connection to that host.N(R"RRtclose(R
Rth((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytclose_connectionscC@sUxN|jjjD]7\}}x(|D] }|jj||jq)WqWdS(sclose all open connectionsN(R"Rt	iteritemsRR'(R
RtconnsR(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt	close_alls"
cC@s|jj|ddS(setells us that this request is now closed and that the
        connection is ready for another requestiN(R"R(R
trequestRR((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt_request_closedsicC@s'|r|jn|jj|dS(N(R'R"R(R
RRR'((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt_remove_connections
cC@s|jt|S(N(tdo_opentHTTPConnection(R
treq((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt	http_openscC@s|j}|s$tjdny|jj|}x|r|j|||}|raPn|j|jj||jj|}q<W||}trtj	d|t
|n|jj||d|j|||j
}Wn.tjtjfk
r"}tj|nX|jr?|jj|ntratj	d|j|jn||_||_|j|_||_|j|_|j|_|j|_|jdkstr|S|jjd|||j|j|jSdS(Ns
no host givens"creating new connection to %s (%d)isSTATUS: %s, %sithttp(tget_hostturlerrturlerrorR"Rt_reuse_connectionR'RtDEBUGtinfotidRt_start_transactiontgetresponsetsocketterrorthttplibt
HTTPExceptiont
will_closetstatustreasont_handlert_hosttget_full_urlt_urlt_connectiontcodetmsgtheaderst
HANDLE_ERRORStparent(R
t
http_classR2RR(trterr((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR0sH	
					cC@sy |j|||j}Wnhtjtjfk
rEd}nFtrjtjd|t|n|j	j
||jnX|dks|jdkrtrtj
d|t|nd}n"trtj
d|t|n|S(sGstart the transaction with a re-used connection
        return a response object (r) upon success or None on failure.
        This DOES not close or remove bad connections in cases where
        it returns.  However, if an unexpected exception occurs, it
        will close and remove the connection before re-raising.
        s4unexpected exception - closing connection to %s (%d)i	s&failed to re-use connection to %s (%d)sre-using connection to %s (%d)N(R<R=R>R?R@RARR9R;R"RR'tversionR:(R
R(R2RRP((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR8s(	
	
		c
C@s|jj}tjdkr1|j|jn|j|jjtd|j	D}i}x7dD]/}||krmd|d|j
dd	<qmqmWy|jr|j}|j
d
|j|d|kr|jdd
nd|kr8|jddt|q8n|j
d|j|Wn%tjk
r`}tj|nXx*|j	D]\}}	|j||	qnW|j|jr|j|ndS(Niics@s'|]\}}|j|fVqdS(N(tlower(t.0tntv((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pys	<genexpr>SsRsaccept-encodingitskip_t-t_tPOSTscontent-typesContent-types!application/x-www-form-urlencodedscontent-lengthsContent-lengths%dtGET(ii(Rsaccept-encoding(RLtcopytsystversion_infotupdatetunredirected_hdrsRNt
addheadersRR#treplacethas_datatget_datat
putrequesttget_selectort	putheaderR$R>R?R6R7t
endheaderstsend(
R
R(R2RLtskipheadersRUtdataRQtkRV((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR<Ls4
!	
 
(RRRR&R)R,R.R/R3R0R8R<(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR!s							4	.tHTTPHandlercB@seZRS((RR(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRmkstHTTPResponsecB@sweZddddZejjZdZdZ	dZ
dZddZdZdd	Z
dd
ZRS(icC@shtjj|||||j|_d|_d|_d|_d|_d|_	d|_
d|_dS(Nti(R@RnRtfilenoRRJt_rbuft	_rbufsizeRERFRHRI(R
tsockt
debugleveltstricttmethod((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRs						cC@sN|jrJ|jjd|_|jrJ|jj||j|jqJndS(N(tfpR'RRER.RFRI(R
((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR's	
		cC@s-|jj|j|jdd|jdS(NR'i(RER/RFRIR'(R
((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR)scC@s|jS(N(RL(R
((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR:scC@s|jS(N(RH(R
((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytgeturlscC@s|jra|dk	rat|j}||kr=||8}qa|j| }|j||_|Sn|j|j|}d|_|S(NRo(RqRR$t	_raw_read(R
tamttLts((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytreads

	cC@s|j}d}x[trl|dkr|jj}|jd}|dkr[|| }nyt|d}Wn*tk
r|jt	j
|nX|dkrPqn|dkr||j|7}n||kr||j|7}|||_|S||kr9||j|7}|jdd|_|S||j|7}||8}|jdd}qWx3tr|jj}|sPn|dkrpPqpqpW|j|S(NRot;iiis
(t
chunk_lefttTrueRRwtreadlinetfindtintt
ValueErrorR'R@tIncompleteReadt
_safe_read(R
RzRtvaluetlineti((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt
_read_chunkedsL		




	


	
icC@s |jjd}x|dkrd|koAt|jknr|j|j}|scPn|jd}|dkr|t|j}n|j||_qW|dkrt|j}n
|d}d|kot|jknr|}n|j| |j|}|_|S(Ns
ii(RqRR$RyRr(R
tlimitRtnewRk((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRs 5
%	cC@sfd}g}xStra|j}|s+Pn|j||t|7}|r||krPqqW|S(Ni(RRR
R$(R
tsizehintttotalRR((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt	readliness	
N(RRRRR@RnR}RyR'R)R:RxRRR(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRnns					8cC@st|dddk	rdS|jdkrM|jrA|jqMtjn|jdkrrtdt	|nyd}t|dd}|dk	r|jdkrtdn||}x9|r|jj
|||}qWn|jj
|Wn{tjk
r{}t
}|dtjkrl|jtjkr_d|_|j|_t}n|jn|r|q|nXdS(s`Send `str' to the server.

    Shamelessly ripped off from httplib to patch a bad behavior.
    t_broken_pipe_respNissend:i R}ssending a read()able(tgetattrRRst	auto_opentconnectR@tNotConnectedRttprinttreprtsendallR>R?RterrnotEPIPEt_HTTPConnection__statet_CS_REQ_SENTRR=tFalseR'(R
tstrt	blocksizeR}RkRVtreraise((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytsafesend
s:	

			
c@s"fd}jj|_|S(s>Wraps getresponse in cls with a broken-pipe sane version.
    c@s/t|dd}|dk	r"|Sj|S(NR(RRR=(R
RP(tcls(s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytsafegetresponse@s(R=R (RR((Rs7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytwrapgetresponse=s	R1cB@s#eZeZeZeejZ	RS((
RRRntresponse_classRRiRR@R1R=(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyR1LscC@s4t}t}tj|}tj|idd6dd6}xd	D]}td|||f|ay^tj|}|j|jy|j	|j
}}Wntk
rd
\}}nXWn$t
k
r}	td|	qFXtd||fqFW|a|j}
td|
|jdS(Ntoffitonis.  fancy error handling %s (HANDLE_ERRORS = %i)s  EXCEPTION: %ss  status = %s, reason = %ssopen connections:(ii(NN(RMRmturlreqtbuildopenert
installopenerRturlopenR}R'RCRDtAttributeErrorRtIOErrorR&R,(turltorigtkeepalive_handlertopenertposRtfoRCRDtethosts((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt
error_handlerWs0	





cC@sStj}d}tj}tj|tj|}|j}|j||}t|d|j	ftjt
}tj|tj|}|j}|j||}t|d|j	ftj|}d}x*tr|j}|r||}qPqW|j||}t|d|j	fdS(Ns%25s: %ss
normal urllibskeepalive readRoskeepalive readline(
thashlibtmd5RRRRR}R'Rt	hexdigestRmRR(RRtformatRRtfootmtf((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt
continuityss4	



	

cC@std||ftjjdtj}tj|t||}td|tjjdtjt}tj|t||}td|td||dS(Ns   making %i connections to:
  %ss(  first using the normal urllib handlerss  TIME: %.3f ss(  now using the keepalive handler       s  improvement factor: %.2f(	RR]tstdouttwriteRRRtfetchRm(tNRRtt1tt2((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytcomps

cC@sddl}g}|j}xnt|D]`}|rS|dkrS|j|ntj|}|j}|j|jt|q+W|j|}	d}
xC|dD]7}|
d}
||dkst	d|
|fqqW|	S(Niis+WARNING: inconsistent length on read %i: %i(
ttimetrangetsleepRRR}R'R
R$R(RRtdelayRtlenst	starttimeRRRtdifftj((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRs"

cC@st}dtfdY}|atdtj|}|j}|jd}td|xH|dkrtjj	d|tjj
tjd|d8}qkWtj
j	d	td
tj|}|j}|j||krtdn
td|adS(
Nt
FakeLoggercB@seZdZeZZZRS(cW@st||dS(N(R(R
RKtargs((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pytdebugs(RRRR:twarningR?(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyRs	s-  fetching the file to establish a connectionis;  waiting %i seconds for the server to close the connectionis
  %2iis
s!  fetching the file a second times  data are identicals  ERROR: DATA DIFFER(R9tobjectRRRR}R'R]RRtflushRRtstderr(RtdbbackupRRtdata1Rtdata2((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyttest_timeouts.	







i
cC@stdyt|Wn%tk
r?tdtjnXtdtdt|tdtdt||tdtdt|dS(Ns-checking error handler (do this on a non-200)s.exiting - exception will prevent further testsRos>performing continuity test (making sure stuff isn't corrupted)sperforming speed comparisons#performing dropped-connection check(RRRR]texitRRR(RR((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyttests










t__main__s%s <integer> <url>(ii(*R t
__future__RRRRR>R]RRoRR@R6RRR9R^RMRRR!thttphandlerRmRnRRR1RRRRRRRRRtargvRRt
IndexErrorRR(((s7/usr/lib/python2.7/dist-packages/mercurial/keepalive.pyt<module>jsF				?	3			"		#