-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
Ì\,Tc@sŠdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ej
eƒZddgZ
dZdZdd>Zdd	>Zd
ZdZdZd
ZdZdZdZedZdZeZdefd„ƒYZdefd„ƒYZdej fd„ƒYZ!dej fd„ƒYZ"dej fd„ƒYZ#dej fd„ƒYZ$ej%Z%dS(sXImproved HTTP/1.1 client library

This library contains an HTTPConnection which is similar to the one in
httplib, but has several additional features:

  * supports keepalives natively
  * uses select() to block for incoming data
  * notices when the server responds early to a request
  * implements ssl inline instead of in a different class
iÿÿÿÿNtHTTPConnectiontHTTPResponsesHTTP/1.0sHTTP/1.1iiisaccept-encodingt
connectionscontent-lengthstransfer-encodingtchunkedtcloses
icBs_eZdZd„Zed„ƒZd„Zd„Zd„Zd	d„Z
d„Zd„ZRS(
s¯Response from an HTTP server.

    The response will continue to load as available. If you need the
    complete response before continuing, check the .complete() method.
    cCs‹||_||_d|_d|_d|_t|_d|_d|_	t|_
d|_d|_d|_
d|_t|_||_dS(Nti(tsocktmethodtraw_responset_headers_lentNonetheaderstFalset
will_closetstatus_linetstatust	continuedthttp_versiontreasont_readert_read_locationtEOLt_eolt_timeout(tselfRttimeoutR((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyt__init__Xs														cCs|jdS(Ni(R(R((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyt_end_headerskscCs|jr|jjƒSdS(sReturns true if this response is completely loaded.

        Note that if this is a connection where complete means the
        socket is closed, this will nearly always return False, even
        in cases where all the data has actually been loaded.
        N(Rtdone(R((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pytcompleteos	cCs#|jdk	r|jjƒndS(N(RR
t_close(R((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyRyscCsgg}xQtrY|jjd|ƒ|r<|dddksH|jƒrLPn|jƒq	Wdj|ƒS(s”Read a single line from the response body.

        This may block until either a line ending is found or the
        response is complete.
        s
iÿÿÿÿR(tTrueRtreadtoRt_selecttjoin(Rtblocks((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pytreadlines	&cCs‡x4|jƒr6|s)||jjkr6|jƒqW|sL|jj}n|jj|ƒ}|jƒrƒ|jrƒ|jjƒn|S(s!Read data from the response body.(RRtavailable_dataR!treadR
RR(Rtlengthtr((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR&scCstj|jggg|jƒ\}}}|sa|jƒsatjd|jƒtdƒ‚qany|jjtƒ}Wn@t	j
k
r¹}|jdt	jkr¨‚ntj
dƒtSXtj
dt|ƒƒ|só|jrï|jjƒntS|j|ƒtSdS(Nstimed out with timeout of %sstimeout reading datais2SSL_ERROR_WANT_READ in _select, should retry laters$response read %d data during _select(tselectRRRtloggertinfotHTTPTimeoutExceptiontrecvtINCOMING_BUFFER_SIZEtsockettsslerrortargstSSL_ERROR_WANT_READtdebugRtlenRRRt_load_response(RR(tunused_writet
unused_errtdatate((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR!žs($
	
c	Cse|j|7_|j|jkr†xbdD]W}||jkr(|jj|ƒt|jƒdkr(tjd|ƒ||_Pq(q(Wn|j|jks¡|jr¥dS|jj|jdƒ\}}|jddƒ\}}|j	dƒr||_t
|_tjd|ƒdS|jj|jdƒ\}}|`|j|krd|j|jdƒ\|_
}n||_
d}|j
jdd	ƒ\|_|_|_t|jƒ|_|jtkrÓ|j|jd
ƒ}ntjtj|ƒƒ}d}t|krt|tƒ}n|jtkr+t
|_n(t|krS|tjƒtk|_nt|krš|tjƒt kršt!j"|jƒ|_#tjdƒn‰|j$dksÄ|j$d
krÍ|dkrÍd}n|dk	rþtjd|ƒt!j%|ƒ|_#n%t!j&ƒ|_#tjdƒt
|_|r<|j#j'|ƒntjdƒ||_|j#j'|_(dS(Ns
s
is-bogus line endings detected, using %r for EOLt t100s!continue seen, setting body to %rRis
susing a chunked readertHEADtCONNECTis,using a content-length reader with length %dsusing a close-is-end readersheaders complete(s
s
()RRtindexR4R*R+RRtsplitt
startswithRRR3RRRRtintRtreplacetrfc822tMessaget	cStringIOtStringIOR
tHDR_CONTENT_LENGTHtHTTP_VER_1_0R
tHDR_CONNECTION_CTRLtlowertCONNECTION_CLOSEtHDR_XFER_ENCODINGtXFER_ENCODING_CHUNKEDt_readerst
ChunkedReaderRRtContentLengthReadertCloseIsEndReadert_loadR5(	RR8tbad_eolthdrstbodytunused_http_verRRtcontent_len((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR5½sp
				!	'			
	
	N(
t__name__t
__module__t__doc__RtpropertyRRRR$R
R&R!R5(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyRRs		
			cBs€eZdZeZeZd	d	d	ee	d	d	d„Z
d„Zd„Zd„Z
d„Zd„Zd	ied„Zd„ZRS(
s’Connection to a single http server.

    Supports 100-continue and keepalives natively. Uses select() for
    non-blocking socket operations.
    c	
Ks¥|d	kr!|jdƒdks-d|krp|jddƒ\}}t|ƒ}d|krp|dd!}qpn|d	k	rˆ||_ntj|_|d	kr»|d	kr»t}d}n<|d	krÖ|dk}n!|d	kr÷|rîdpñd}n||_|rtj	rt
dƒ‚n||_|	|_||_
||_d	|_d	|_t|_|d	kr}d	|_|_n|\|_|_||_||_d	S(
sCreate a new HTTPConnection.

        Args:
          host: The host to which we'll connect.
          port: Optional. The port over which we'll connect. Default 80 for
                non-ssl, 443 for ssl.
          use_ssl: Optional. Whether to use ssl. Defaults to False if port is
                   not 443, true if port is 443.
          ssl_validator: a function(socket) to validate the ssl cert
          timeout: Optional. Connection timeout, default is TIMEOUT_DEFAULT.
          continue_timeout: Optional. Timeout for waiting on an expected
                   "100 Continue" response. Default is TIMEOUT_ASSUME_CONTINUE.
          proxy_hostport: Optional. Tuple of (host, port) to use as an http
                       proxy for the connection. Default is to not use a proxy.
          ssl_wrap_socket: Optional function to use for wrapping
            sockets. If unspecified, the one from the ssl module will
            be used if available, or something that's compatible with
            it if on a Python older than 2.6.

        Any extra keyword arguments to this function will be provided
        to the ssl_wrap_socket method. If no ssl
        t:is]:t[iÿÿÿÿiPi»s,ssl requested but unavailable on this PythonN(R
tcounttrsplitRAt_ssl_wrap_sockett
socketutiltwrap_socketRtportthave_sslt	Exceptiontssltssl_optst_ssl_validatorthostRt_current_responset_current_response_takent_proxy_hostt_proxy_portRtcontinue_timeout(
RRiRctuse_sslt
ssl_validatorRRntproxy_hostporttssl_wrap_socketRg((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR$s<-										cCsó|jr
dS|jdk	rdtjd|j|jƒtj|j|jfƒ}|jr|j	dd|j
|jfitƒ}|j
|ƒ|jdƒ|j||jdƒ}tdƒ}xR|jƒsy(|jƒsõ|jƒsõ|‚qõnWqÂtk
r|‚qÂXqÂW|jdkrEtd|j|jƒfƒ‚ntjd	|j
|jƒqntj|j
|jfƒ}|jrÙ|jd
ƒtjd|jƒ|j||j}|jrÙ|j|ƒqÙn|jdƒ||_dS(s3Connect to the host and port specified in __init__.NsConnecting to http proxy %s:%sR=s%s:%dis1Timed out waiting for CONNECT response from proxyiÈsProxy connection failed: %d %ss/CONNECT (for SSL) to %s:%s via proxy succeeded.is'wrapping socket for ssl with options %r(RRlR
R*R+RmRatcreate_connectionRft
_buildheadersRiRcRHtsendtsetblockingtresponse_classRR,RR!RtHTTPProxyConnectFailedExceptionR&R3RgR`Rh(RRR8R(ttimeout_exc((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyt_connect`sN			


	
			
	
	
c	Cs=|jr|jdks'|jdkr3|j}n>d|jkr[d|j|jf}nd|j|jf}|jr³|jr³|ddks tdƒ‚d	||f}nd
|||tfg}d|f|d<td
f|t<x4|jƒD]&\}}|jd||tfƒqùW|jtƒdj	|ƒS(Ni»iPR\s[%s]:%ds%s:%dit/spath must start with a /shttp://%s%ss
%s %s %s%stHostRitidentitys%s: %s%sR(
RfRcRiRltAssertionErrorRtHDR_ACCEPT_ENCODINGt
itervaluestappendR"(	RRtpathRthttp_verthdrhosttoutgoingthdrtval((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyRt—s'
cCsF|jdkrdS|jjƒd|_tjd|j|jƒdS(såClose the connection to the server.

        This is a no-op if the connection is already closed. The
        connection may automatically close if requested by the server
        or required by the nature of a response.
        Nsclosed connection to %s on %s(RR
RR*R+RiRc(R((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR±s

	cCsa|j}|dk	r]|jrY|jr=d|_d|_tS|jƒrYd|_tSntStS(sƒReturns True if this connection object is currently in use.

        If a response is still pending, this will return True, even if
        the request has finished sending. In the future,
        HTTPConnection may transparently juggle multiple connections
        to the server, in which case this will be useful to detect if
        any of those connections is ready for use.
        N(RjR
RkR
RRRR(Rtcr((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pytbusy¾s							cCs(tjd|ƒ|jƒ|jƒdS(Nsreconnecting during %s(R*R+RRz(Rtwhere((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyt
_reconnectÔs
c
Cs’|jƒrtjdƒ‚nt|_tjd|||j|jƒt	d„|j
ƒDƒƒ}|jdd!ƒdjƒdkrt
}n|r d"|d<nt}|rt|krt|d
tƒrãtt|ƒf|t<qt|dtƒrttf|t<t
}qtdƒ‚n|jd k}|jƒ|j||||jƒ}	d }
t
}xe|	sl|rÄ|
o{|
jƒrÄ|j}|	p‘|}
t}|rë|	rë|
o¼|
jp¼|
jrëtjd
|jƒ|j}t
}t}
n|
r|jg}ng}tj|jg|g|ƒ\}}}||koO|koOgknr|rpt}tjdƒqtdƒ‚n|}|r yYy|dj t!ƒ}WnBt"j#k
ré}|j$dt"j%krÖ‚ntj&dƒw`nX|s’tjdƒd |_d |_'|
d k	r(|
j(ƒn|
d k	rQ|
jƒrQtjdƒPq’|rƒ|
d krƒtjdƒ|j)dƒw`q’t*dƒ‚ntj&dt|ƒƒ|
d krÓ|j+|d|j|ƒ}
n|
j,|ƒw`Wq t"j-k
r}|dt.j/kr|r‚qq Xn|r`|
r`yªt|
dtƒrÂ|
j0t1ƒ}|s\w`nt|ƒt1krŽ|r…dt2t2}qŽd }n|r¹t3t|ƒƒdt2|t2}
qÂ|}
n|dj4|
ƒ}Wn¬t"j-k
r„}|dt"j5kr
|j6r
q`n|dt.j7ks`|dt.j8kr9q`n)|dt.j9t.j/fkrb|rb‚n|j)dƒ|jj4|
ƒ}nXtj&d|ƒt}|
|kr´|
|}qÁ|
|}	q`q`W|
d kr?|j+|j|j|ƒ}
|s?|
j:ƒs<t;j&dƒd |_t<j=|||d|d|d|ƒSq?nt>|	pK|ƒ}|rptjdƒt
|
_?n|
j?r…d |_n|
|_'d S(#s†Send a request to the server.

        For increased flexibility, this does not return the response
        object. Future versions of HTTPConnection that juggle multiple
        sockets will be able to send (for example) 5 requests all at
        once, and then let the requests arrive as data is
        available. Use the `getresponse()` method to retrieve the
        response.
        s=Can not send another request before current response is read!s*sending %s request for %s to %s on port %scss-|]#\}}|jƒ||ffVqdS(N(RJ(t.0tktv((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pys	<genexpr>ìstexpectRis100-continuetExpects100-Continuet__len__R&s body has no __len__() nor read()s:waiting up to %s seconds for continue response from serversTno response to continue expectation from server, optimistically sending request bodystimeout sending datais3SSL_ERROR_WANT_READ while sending data, retrying...ssocket appears closed in reads2Got an early response, aborting remaining request.sOConnection appeared closed in read on first request loop iteration, will retry.sjConnection appears closed after some request data was written, but the response was missing or incomplete!sread %d bytes in request()t0itwritessent %dsQresponse._select() failed during request(). Assuming request needs to be retried.RURtexpect_continues@stopped sending request early, will close the socket to be safe.N(RR(Rs100-Continue(@R‰thttplibtCannotSendRequestRRkR*R+RiRctdictt	iteritemstgetRJRRGtgetattrR4RLRMtBadRequestDataRR
RzRtRRRRRRnR)R,R-R.R/R0R1R2R3RjRR‹tHTTPStateErrorRwR5terrorterrnotEPIPER&tOUTGOING_BUFFER_SIZERthexRutSSL_ERROR_WANT_WRITERftEWOULDBLOCKtEAGAINt
ECONNRESETR!tloggingRtrequesttboolR
(RRR‚RURR”RTRtfresh_sockettoutgoing_headerstresponsetfirsttselect_timeouttouttblocking_on_continuetwR(txt	was_firstR8R9tamtt	data_left((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR§Ùs		"	

	
	

		''

		




	%	&


		

	cCs©|jdkrtjƒ‚n|j}x<|jdkre|jƒr*|jƒr*tjƒ‚q*q*W|j	r„d|_
d|_n!|jƒrœd|_n	t|_|S(s0Returns the response to the most recent request.N(
RjR
R•tResponseNotReadyRR!RRNtHTTPRemoteClosedErrorR
RRRk(RR(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pytgetresponse±s				N(RXRYRZtHTTP_VER_1_1RRRwR
tTIMEOUT_DEFAULTtTIMEOUT_ASSUME_CONTINUERRzRtRR‰R‹RR§R·(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyRs	9	7		
		×R,cBseZdZRS(s/A timeout occurred while waiting on the server.(RXRYRZ(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR,ÆsR›cBseZdZRS(s1Request body object has neither __len__ nor read.(RXRYRZ(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyR›ÊsRxcBseZdZRS(s$Connecting to the HTTP proxy failed.(RXRYRZ(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyRxÎsRœcBseZdZRS(s#Invalid internal state encountered.(RXRYRZ(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyRœÒs(&RZRERžR•R¦RCR)R/RNRat	getLoggerRXR*t__all__RHR¸R R.RRIRGRLRMRKRt_END_HEADERSRºR
R¹tobjectRRt
HTTPExceptionR,R›RxRœR¶(((sA/usr/lib/python2.7/dist-packages/mercurial/httpclient/__init__.pyt<module>&sB


Éÿ¬

Copyright © 2017 || Recoded By Mr.Bumblebee