Your IP : 3.14.255.237


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/httplib.pyo

�
�mec@s�dZddlmZddlZddlZddlZddlmZddlmZddl	Z	e	j
��-er�e	jdde�nddl
Z
WdQXyddlmZWn!ek
r�ddlmZnXd	d
ddd
ddddddddddddgZdZdZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Zd'Zd(Z d)Z!d*Z"d+Z#d,Z$d-Z%d.Z&d/Z'd0Z(d1Z)d2Z*d3Z+d4Z,d5Z-d6Z.d7Z/d8Z0d9Z1d:Z2d;Z3d<Z4d=Z5d>Z6d?Z7d@Z8dAZ9dBZ:dCZ;dDZ<dEZ=dFZ>dGZ?dHZ@dIZAdJZBdKZCdLZDdMZEdNZFdOZGdPZHi)dQd 6dRd!6dSd#6dTd$6dUd%6dVd&6dWd'6dXd(6dYd)6dZd,6d[d-6d\d.6d]d/6d^d06d_d16d`da6dbd26dcd36ddd46ded56dfd66dgd76dhd86did96djd:6dkd;6dld<6dmd=6dnd>6dod?6dpd@6dqdA6drdB6dsdC6dtdD6dudI6dvdJ6dwdK6dxdL6dydM6dzdN6ZId{ZJd|ZKd ZLejMd}�jNZOejMd~�jPZQejMd�ZRejMd��ZSd�e
jTfd���YZUd
fd���YZVdfd���YZWd	fd���YZXyddlYZYWnek
rJnCXd�eWfd���YZZej[d��d�eXfd���YZ\d��Z]de^fd���YZ_d
e_fd���YZ`de_fd���YZade_fd���YZbde_fd���YZcde_fd���YZdde_fd���YZede_fd���YZfdeffd���YZgdeffd���YZhdeffd���YZide_fd���YZjd�e_fd���YZke_Zld�fd���YZmdS(�s�	HTTP/1.1 client library

<intro stuff goes here>
<other stuff, too>

HTTPConnection goes through a number of "states", which define when a client
may legally make another request or fetch the response for a particular
request. This diagram details these state transitions:

    (null)
      |
      | HTTPConnection()
      v
    Idle
      |
      | putrequest()
      v
    Request-started
      |
      | ( putheader() )*  endheaders()
      v
    Request-sent
      |
      | response = getresponse()
      v
    Unread-response   [Response-headers-read]
      |\____________________
      |                     |
      | response.read()     | putrequest()
      v                     v
    Idle                  Req-started-unread-response
                     ______/|
                   /        |
   response.read() |        | ( putheader() )*  endheaders()
                   v        v
       Request-started    Req-sent-unread-response
                            |
                            | response.read()
                            v
                          Request-sent

This diagram presents the following rules:
  -- a second request may not be started until {response-headers-read}
  -- a response [object] cannot be retrieved until {request-sent}
  -- there is no differentiation between an unread response body and a
     partially read response body

Note: this enforcement is applied by the HTTPConnection class. The
      HTTPResponse class does not enforce this state machine, which
      implies sophisticated clients may accelerate the request/response
      pipeline. Caution should be taken, though: accelerating the states
      beyond the above pattern may imply knowledge of the server's
      connection-close behavior for certain requests. For example, it
      is impossible to tell whether the server will close the connection
      UNTIL the response headers have been read; this means that further
      requests cannot be placed into the pipeline until it is known that
      the server will NOT be closing the connection.

Logical State                  __state            __response
-------------                  -------            ----------
Idle                           _CS_IDLE           None
Request-started                _CS_REQ_STARTED    None
Request-sent                   _CS_REQ_SENT       None
Unread-response                _CS_IDLE           <response_class>
Req-started-unread-response    _CS_REQ_STARTED    <response_class>
Req-sent-unread-response       _CS_REQ_SENT       <response_class>
i����(tarrayN(tpy3kwarning(turlsplittignores.*mimetools has been removed(tStringIOtHTTPtHTTPResponsetHTTPConnectiont
HTTPExceptiontNotConnectedtUnknownProtocoltUnknownTransferEncodingtUnimplementedFileModetIncompleteReadt
InvalidURLtImproperConnectionStatetCannotSendRequesttCannotSendHeadertResponseNotReadyt
BadStatusLineterrort	responsesiPi�tUNKNOWNtIdlesRequest-startedsRequest-sentidieifi�i�i�i�i�i�i�i�i�i,i-i.i/i0i1i3i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�i�tContinuesSwitching ProtocolstOKtCreatedtAcceptedsNon-Authoritative Informations
No Contents
Reset ContentsPartial ContentsMultiple ChoicessMoved PermanentlytFounds	See OthersNot Modifieds	Use Proxys(Unused)i2sTemporary RedirectsBad RequesttUnauthorizedsPayment Requiredt	Forbiddens	Not FoundsMethod Not AllowedsNot AcceptablesProxy Authentication RequiredsRequest TimeouttConflicttGonesLength RequiredsPrecondition FailedsRequest Entity Too LargesRequest-URI Too LongsUnsupported Media TypesRequested Range Not SatisfiablesExpectation FailedsInternal Server ErrorsNot ImplementedsBad GatewaysService UnavailablesGateway TimeoutsHTTP Version Not Supportediis\A[^:\s][^:\r\n]*\Zs\n(?![ \t])|\r(?![ \t\n])s[- -�]s[-]tHTTPMessagecBs#eZd�Zd�Zd�ZRS(cCsT|jj|�}|dkr.||j|<n"dj||f�}||j|<dS(s*Add header for field key handling repeats.s, N(tdicttgettNonetjoin(tselftkeytvaluetprevtcombined((s/usr/lib64/python2.7/httplib.pyt	addheader
s
cCs&|j|}|d||j|<dS(s-Add more field data from a continuation line.s
 N(R"(R&R'tmoreR)((s/usr/lib64/python2.7/httplib.pytaddcontinues
cCswi|_d|_g|_}d|_d}d}d
}}}t|jd�rc|jj}n|jr{|jj	}nx�t
rrt|�tkr�t
dt��n|r�y
|�}Wq�tk
r�d
}}d|_q�Xn|jjtd�}t|�tkrtd��n|s0d|_Pn|r[|jd�r[|j||_q~nd}|r�|dd	kr�|j|�|j||j��q~n(|j|�r�q~n|j|�r�Pn|j|�}|r|j|�|j||t|�dj��q~q~|js)d
|_n	d|_|rE||�n)|r^|jj|�n|jd|_Pq~Wd
S(s:Read header lines.

        Read header lines up to the entirely blank line that terminates them.
        The (normally blank) line that ends the headers is skipped, but not
        included in the returned list.  If a non-header line ends the headers,
        (which is an error), an attempt is made to backspace over it; it is
        never included in the returned list.

        The variable self.status is set to the empty string if all went well,
        otherwise it is an error message.  The variable self.headers is a
        completely uninterpreted list of lines contained in the header (so
        printing them will reproduce the header exactly as it appears in the
        file).

        If multiple header fields with the same name occur, they are combined
        according to the rules in RFC 2616 sec 4.2:

        Appending each subsequent field-value to the first, each separated
        by a comma. The order in which header fields with the same field-name
        are received is significant to the interpretation of the combined
        field value.
        titunreadsgot more than %d headersisheader linesEOF in headerssFrom s 	s
No headerss%Non-header line where header expecteds
; bad seekN(R"tunixfromtheaderststatusR$thasattrtfpR/tseekablettelltTruetlent_MAXHEADERSRtIOErrortreadlinet_MAXLINEtLineTooLongt
startswithtappendR-tstript	iscommenttislasttisheaderR+tseek(R&thlistt
headerseent	firstlinetstartoflineR/R6tline((s/usr/lib64/python2.7/httplib.pytreadheaderssh		
			


	

$		
(t__name__t
__module__R+R-RJ(((s/usr/lib64/python2.7/httplib.pyR!s			cBs�eZddd
ed�Zd�Zd�Zd�Zd�Zd�Z	d
d�Z
d�Zd	�Zd
�Z
d
d�Zd�ZRS(icCs�|r|jd�|_n|jdd�|_||_||_||_d|_t|_t|_	t|_
t|_t|_t|_
t|_dS(Ntrbi(tmakefileR4t
debugleveltstrictt_methodR$tmsgt_UNKNOWNtversionR2treasontchunkedt
chunk_lefttlengtht
will_close(R&tsockRORPtmethodt	buffering((s/usr/lib64/python2.7/httplib.pyt__init__s										cCs�|jjtd�}t|�tkr7td��n|jdkrXdGt|�GHn|smt|��ny|jdd�\}}}WnMt
k
r�y"|jdd�\}}d}Wq�t
k
r�d}q�XnX|jd�s)|jr
|j
�t|��q)t||j�|_dSny7t|�}|d
ksP|dkr_t|��nWnt
k
rt|��nX|||fS(
Nisheader lineisreply:iR.sHTTP/sHTTP/0.9i�idi�(sHTTP/0.9i�R.(R4R;R<R8R=ROtreprRtsplitR$t
ValueErrorR>RPtclosetLineAndFileWrappertint(R&RIRTR2RU((s/usr/lib64/python2.7/httplib.pyt_read_status�s8


	

c
Cs
|jdk	rdSx�tr�|j�\}}}|tkrAPnxrtr�|jjtd�}t|�tkr�t	d��n|j
�}|s�Pn|jdkrDdG|GHqDqDWqW||_|j
�|_
|dkr�d|_n?|jd�rd|_n$|d	krd
|_nt|��|jd
krid|_d|_d|_tt��|_dSt|jd�|_|jdkr�x|jjD]}dG|Gq�Wnd|j_|jjd�}|r�|j�dkr�d|_d|_n	d|_|j�|_|jjd
�}|r�|jr�yt|�|_Wntk
rcd|_q�X|jdkr�d|_q�n	d|_|tks�|tks�d|ko�dkns�|jdkr�d|_n|jr	|jr	|jdkr	d|_ndS(Nisheader lineisheader:sHTTP/1.0i
sHTTP/1.isHTTP/0.9i	stransfer-encodingRVscontent-lengthidi�tHEAD( RRR$R7RdtCONTINUER4R;R<R8R=R@ROR2RURTR>R
RXRVRYR!RR1t	getheadertlowerRWt_check_closeRcR`t
NO_CONTENTtNOT_MODIFIEDRQ(R&RTR2RUtskipthdrttr_encRX((s/usr/lib64/python2.7/httplib.pytbegin�st								

	

cCs�|jjd�}|jdkrS|jjd�}|rOd|j�krOtStS|jjd�ritS|r�d|j�kr�tS|jjd�}|r�d|j�kr�tStS(Nt
connectioniRas
keep-alivesproxy-connection(RRRgRTRhR7tFalse(R&tconntpconn((s/usr/lib64/python2.7/httplib.pyRiscCs&|jr"|jj�d|_ndS(N(R4RaR$(R&((s/usr/lib64/python2.7/httplib.pyRa6s	
cCs
|jdkS(N(R4R$(R&((s/usr/lib64/python2.7/httplib.pytisclosed;scCsT|jdkrdS|jdkr0|j�dS|jrF|j|�S|dkr�|jdkrs|jj�}n@y|j|j�}Wnt	k
r�|j��nXd|_|j�|S|jdk	r�||jkr�|j}q�n|jj|�}|s|j�n|jdk	rP|jt
|�8_|jsP|j�qPn|S(NR.Rei(R4R$RQRaRVt
_read_chunkedRXtreadt
_safe_readR
R8(R&tamtts((s/usr/lib64/python2.7/httplib.pyRvFs:
	


	

	cCs.|j}g}x�tr�|dkr�|jjtd�}t|�tkr[td��n|jd�}|dkr�|| }nyt	|d�}Wn0t
k
r�|j�tdj
|���nX|dkr�Pq�n|dkr|j|j|��n�||kr=|j|j|��|||_dj
|�S||kr�|j|j|��|jd�d|_dj
|�S|j|j|��||8}|jd�d}qWx[tr|jjtd�}t|�tkr�td��n|sPn|d	kr�Pq�q�W|j�dj
|�S(
Nis
chunk sizet;iiR.istrailer lines
(RWR7R$R4R;R<R8R=tfindRcR`RaR
R%R?Rw(R&RxRWR(RIti((s/usr/lib64/python2.7/httplib.pyRussT		





	



	
cCsg}xi|dkrq|jjt|t��}|sQtdj|�|��n|j|�|t|�8}q	Wdj|�S(sVRead the number of bytes requested, compensating for partial reads.

        Normally, we have a blocking socket, but a read() can be interrupted
        by a signal (resulting in a partial read).

        Note that we cannot distinguish between EOF and an interrupt when zero
        bytes have been read. IncompleteRead() will be raised in this
        situation.

        This function should be used when <amt> bytes "should" be present for
        reading. If the bytes are truly not available (due to EOF), then the
        IncompleteRead exception can be used to detect the problem.
        iR.(R4Rvtmint	MAXAMOUNTR
R%R?R8(R&RxRytchunk((s/usr/lib64/python2.7/httplib.pyRw�s
cCs
|jj�S(N(R4tfileno(R&((s/usr/lib64/python2.7/httplib.pyR��scCs.|jdkrt��n|jj||�S(N(RRR$RRg(R&tnametdefault((s/usr/lib64/python2.7/httplib.pyRg�scCs(|jdkrt��n|jj�S(s&Return list of (header, value) tuples.N(RRR$Rtitems(R&((s/usr/lib64/python2.7/httplib.pyt
getheaders�sN(RKRLR$RqR]RdRoRiRaRtRvRuRwR�RgR�(((s/usr/lib64/python2.7/httplib.pyRus
	'	V			-	:		cBseZdZdZeZeZdZdZ	dZ
ddej
dd�Zddd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zdd�Zddd�Zd�Zd�Zdd�Zdid�Zd�Zd�Ze d�Z!RS(isHTTP/1.1iicCs�||_||_d|_g|_d|_t|_d|_d|_	d|_
i|_|dk	rr||_n|j
||�\|_|_tj|_dS(N(ttimeouttsource_addressR$RZt_buffert_HTTPConnection__responset_CS_IDLEt_HTTPConnection__stateRQt_tunnel_hostt_tunnel_portt_tunnel_headersRPt
_get_hostportthosttporttsockettcreate_connectiont_create_connection(R&R�R�RPR�R�((s/usr/lib64/python2.7/httplib.pyR]�s										cCsY|jrtd��n|j||�\|_|_|rH||_n
|jj�dS(sC Set up host and port for HTTP CONNECT tunnelling.

        In a connection that uses HTTP Connect tunneling, the host passed to the
        constructor is used as proxy server that relays all communication to the
        endpoint passed to set_tunnel. This is done by sending a HTTP CONNECT
        request to the proxy server when the connection is established.

        This method must be called before the HTTP connection has been
        established.

        The headers argument should be a mapping of extra HTTP headers
        to send with the CONNECT request.
        s.Can't setup tunnel for established connection.N(RZtRuntimeErrorR�R�R�R�tclear(R&R�R�R1((s/usr/lib64/python2.7/httplib.pyt
set_tunnel�s	cCs�|dkr�|jd�}|jd�}||kr�yt||d�}WnItk
r�||ddkr~|j}q�td||d��nX|| }n	|j}|r�|ddkr�|ddkr�|dd!}q�n||fS(	Nt:t]iR.snonnumeric port: '%s'it[i����(R$trfindRcR`tdefault_portR(R&R�R�R|tj((s/usr/lib64/python2.7/httplib.pyR�s

	&cCs"|j||�\|_|_dS(N(R�R�R�(R&R�R�((s/usr/lib64/python2.7/httplib.pyt
_set_hostport#scCs
||_dS(N(RO(R&tlevel((s/usr/lib64/python2.7/httplib.pytset_debuglevel&scCs4|jd|j|jf�x4|jj�D]#\}}|jd||f�q-W|jd�|j|jd|jd|j�}|j	�\}}}|dkr�|j
�tjd||j
�f��nx[tr/|jjtd�}t|�tkrtd	��n|sPn|dkr�Pq�q�WdS(
NsCONNECT %s:%d HTTP/1.0
s%s: %s
s
RPR[i�sTunnel connection failed: %d %sisheader line(tsendR�R�R�t	iteritemstresponse_classRZRPRQRdRaR�RR@R7R4R;R<R8R=(R&theaderR(tresponseRTtcodetmessageRI((s/usr/lib64/python2.7/httplib.pyt_tunnel)s(

	cCsD|j|j|jf|j|j�|_|jr@|j�ndS(s3Connect to the host and port specified in __init__.N(R�R�R�R�R�RZR�R�(R&((s/usr/lib64/python2.7/httplib.pytconnectBs	cCsQ|jr"|jj�d|_n|jrD|jj�d|_nt|_dS(s(Close the connection to the HTTP server.N(RZRaR$R�R�R�(R&((s/usr/lib64/python2.7/httplib.pyRaJs	
	
cCs�|jdkr1|jr%|j�q1t��n|jdkrRdGt|�GHnd}t|d�r�t|t	�r�|jdkr�dGHn|j
|�}x<|r�|jj|�|j
|�}q�Wn|jj|�dS(sSend `data' to the server.issend:i RvssendIng a read()ableN(RZR$t	auto_openR�R	ROR^R3t
isinstanceRRvtsendall(R&tdatat	blocksizet	datablock((s/usr/lib64/python2.7/httplib.pyR�Ts	
	cCs|jj|�dS(suAdd a line of output to the current request buffer.

        Assumes that the line does *not* end with \r\n.
        N(R�R?(R&Ry((s/usr/lib64/python2.7/httplib.pyt_outputhscCsx|jjd�dj|j�}|j2t|t�rK||7}d}n|j|�|dk	rt|j|�ndS(s�Send the currently buffered request and clear the buffer.

        Appends an extra \r\n to the buffer.
        A message_body may be specified, to be appended to the request.
        R.s
N(R.R.(R�textendR%R�tstrR$R�(R&tmessage_bodyRR((s/usr/lib64/python2.7/httplib.pyt_send_outputos
	
c
CsF|jr$|jj�r$d|_n|jtkr?t|_n	t��|j|�||_|smd}nt	j
|�}|r�td||j�f��nd|||j
f}|j|�|jdkrB|s&d}|jd�rt|�\}}}}}n|r[y|jd�}	Wn tk
rG|jd�}	nX|jd	|	�q&|jry|j}
|j}n|j}
|j}y|
jd�}Wn tk
r�|
jd�}nX|jd
�dkr�d|d
}n||jkr	|jd	|�q&|jd	d||f�n|sB|jdd�qBndS(s`Send a request to the server.

        `method' specifies an HTTP request method, e.g. 'GET'.
        `url' specifies the object being requested, e.g. '/index.html'.
        `skip_host' if True does not add automatically a 'Host:' header
        `skip_accept_encoding' if True does not add automatically an
           'Accept-Encoding:' header
        t/s<URL can't contain control characters. %r (found at least %r)s%s %s %siR.thttptasciitidnatHostR�iR�R�s%s:%ssAccept-EncodingtidentityN(R�RtR$R�R�t_CS_REQ_STARTEDRt_validate_methodRQt!_contains_disallowed_url_pchar_retsearchRtgroupt
_http_vsn_strR�t	_http_vsnR>RtencodetUnicodeEncodeErrort	putheaderR�R�R�R�R{R�(
R&R[turlt	skip_hosttskip_accept_encodingtmatchRmtnetloctnilt
netloc_encR�R�thost_enc((s/usr/lib64/python2.7/httplib.pyt
putrequest�sV	
		

				

cCs8tj|�}|r4td||j�f��ndS(s&Validate a method name for putrequest.s?method can't contain control characters. %r (found at least %r)N(t$_contains_disallowed_method_pchar_reR�R`R�(R&R[R�((s/usr/lib64/python2.7/httplib.pyR�s
cGs�|jtkrt��nd|}t|�sGtd|f��ng|D]}t|�^qN}x0|D](}t|�rmtd|f��qmqmWd|dj|�f}|j|�dS(skSend a request header line to the server.

        For example: h.putheader('Accept', 'text/html')
        s%ssInvalid header name %rsInvalid header value %rs%s: %ss
	N(	R�R�Rt_is_legal_header_nameR`R�t_is_illegal_header_valueR%R�(R&R�tvaluestvt	one_valueRm((s/usr/lib64/python2.7/httplib.pyR�s

cCs5|jtkrt|_n	t��|j|�dS(s�Indicate that the last header line has been sent to the server.

        This method sends the request to the server.  The optional
        message_body argument can be used to pass a message body
        associated with the request.  The message body will be sent in
        the same packet as the message headers if it is string, otherwise it is
        sent as a separate packet.
        N(R�R�t_CS_REQ_SENTRR�(R&R�((s/usr/lib64/python2.7/httplib.pyt
endheaderss		cCs|j||||�dS(s&Send a complete request to the server.N(t
_send_request(R&R[R�tbodyR1((s/usr/lib64/python2.7/httplib.pytrequest.scCs�d}ytt|��}Wnftk
r�}y"ttj|j��j�}Wq�tt	fk
r�|j
dkr�dGHq�q�XnX|dk	r�|jd|�ndS(Nis
Cannot stat!!sContent-Length(R$R�R8t	TypeErrortostfstatR�tst_sizetAttributeErrortOSErrorROR�(R&R�tthelentte((s/usr/lib64/python2.7/httplib.pyt_set_content_length2s"c
Cs�tjg|D]}|j�^q
�}i}d|krGd|d<nd|kr`d|d<n|j|||�|dk	r�d|kr�|j|�nx*|j�D]\}}	|j||	�q�W|j|�dS(NR�iR�saccept-encodingR�scontent-length(	R"tfromkeysRhR�R$R�R�R�R�(
R&R[R�R�R1tktheader_namestskipsRmR(((s/usr/lib64/python2.7/httplib.pyR�Cs(

cCs�|jr$|jj�r$d|_n|jtks<|jrHt��n|jf}i|jd6|jd6}|j	dkr�||j	f7}n|r�t
|d<n|j||�}|j�t
|_|jr�|j�n	||_|S(s!Get the response from the server.RPR[iR\N(R�RtR$R�R�RRZRPRQROR7R�RoR�RYRa(R&R\targstkwdsR�((s/usr/lib64/python2.7/httplib.pytgetresponseTs"

		
	N("RKRLR�R�RR�t	HTTP_PORTR�R�RORPR$R�t_GLOBAL_DEFAULT_TIMEOUTR]R�R�R�R�R�R�RaR�R�R�R�R�R�R�R�R�R�RqR�(((s/usr/lib64/python2.7/httplib.pyR�s6						
		}	
			cBsneZdZdZdZdZeZdddd�Z	d�Z
ddd�Zd�Ze
d	�Zd
�ZRS(s-Compatibility class with httplib.py from 1.5.i
sHTTP/1.0iR.cCs5|dkrd}n|j|j|||��dS(s:Provide a default host, since the superclass requires one.iN(R$t_setupt_connection_class(R&R�R�RP((s/usr/lib64/python2.7/httplib.pyR]�s	cCsj||_|j|_|j|_|j|_|j|_|j|_|j|_|j|_d|_	dS(N(
t_connR�R�R�R�R�R�R�R$tfile(R&Rr((s/usr/lib64/python2.7/httplib.pyR��s	cCsG|dk	r6|jj||�\|j_|j_n|jj�dS(sDAccept arguments to set the host/port, since the superclass doesn't.N(R$R�R�R�R�R�(R&R�R�((s/usr/lib64/python2.7/httplib.pyR��s*cCs|jS(sCProvide a getfile, since the superclass' does not use this concept.(R�(R&((s/usr/lib64/python2.7/httplib.pytgetfile�scCs�y.|s|jj�}n|jj|�}WnNtk
r~}|jjjdd�|_|j�d|_d|j	dfSX|j
|_|j|_|j|j
|j
fS(sCompat definition since superclass does not define it.

        Returns a tuple consisting of:
        - server status code (e.g. '200' if all goes well)
        - server "reason" corresponding to status code
        - any RFC822 headers in the response from the server
        RMii����N(R�R�RRZRNR�RaR$R1RIRRR4R2RU(R&R\R�te((s/usr/lib64/python2.7/httplib.pytgetreply�s
	cCs|jj�d|_dS(N(R�RaR$R�(R&((s/usr/lib64/python2.7/httplib.pyRa�s
N(RKRLt__doc__R�R�RORR�R$R]R�R�R�RqR�Ra(((s/usr/lib64/python2.7/httplib.pyR�s		!tHTTPSConnectionc	BsAeZdZeZddddejdddd�Zd�Z	RS(s(This class allows communication via SSL.c
Cs�tj||||||�||_||_|dkrItj�}n|jtjk}
|	dkrp|
}	n|	r�|
r�t	d��n|s�|r�|j
||�n||_|	|_dS(NsMcheck_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED(
RR]tkey_filet	cert_fileR$tsslt_create_default_https_contexttverify_modet	CERT_NONER`tload_cert_chaint_contextt_check_hostname(R&R�R�R�R�RPR�R�tcontexttcheck_hostnametwill_verify((s/usr/lib64/python2.7/httplib.pyR]�s			
	cCs�tj|�|jr"|j}n	|j}tjr:|nd}|jj|j	d|�|_	|jj
r�|jr�ytj|j	j
�|�Wq�tk
r�|j	jtj�|j	j��q�XndS(s(Connect to a host on a given (SSL) port.tserver_hostnameN(RR�R�R�R�tHAS_SNIR$R�twrap_socketRZR�R�tmatch_hostnametgetpeercertt	ExceptiontshutdownR�t	SHUT_RDWRRa(R&R�tsni_hostname((s/usr/lib64/python2.7/httplib.pyR��s
		

N(
RKRLR�t
HTTPS_PORTR�R$R�R�R]R�(((s/usr/lib64/python2.7/httplib.pyR��s		tHTTPScBs,eZdZeZdddddd�ZRS(s�Compatibility with 1.5 httplib interface

        Python 1.5.2 did not have an HTTPS class, but it defined an
        interface for sending http requests that is also useful for
        https.
        R.cCsM|dkrd}n|j|j|||||��||_||_dS(Ni(R$R�R�R�R�(R&R�R�R�R�RP((s/usr/lib64/python2.7/httplib.pyR] s	
	N(RKRLR�R�R�R$R](((s/usr/lib64/python2.7/httplib.pyR	scCstjddtdd�|S(Ns0FakeSocket is deprecated, and won't be in 3.x.  s5Use the result of ssl.wrap_socket() directly instead.t
stackleveli(twarningstwarntDeprecationWarning(RZtsslobj((s/usr/lib64/python2.7/httplib.pyt
FakeSocket0s	
cBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyR7scBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyR	<scBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyR?scBseZd�ZRS(cCs|f|_||_dS(N(R�RT(R&RT((s/usr/lib64/python2.7/httplib.pyR]Cs(RKRLR](((s/usr/lib64/python2.7/httplib.pyR
BscBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyRGscBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyRJscBs&eZdd�Zd�Zd�ZRS(cCs"|f|_||_||_dS(N(R�tpartialtexpected(R&RR((s/usr/lib64/python2.7/httplib.pyR]Ns	cCs<|jdk	rd|j}nd}dt|j�|fS(Ns, %i more expectedR.sIncompleteRead(%i bytes read%s)(RR$R8R(R&R�((s/usr/lib64/python2.7/httplib.pyt__repr__RscCs
t|�S(N(R^(R&((s/usr/lib64/python2.7/httplib.pyt__str__XsN(RKRLR$R]RR(((s/usr/lib64/python2.7/httplib.pyR
Ms	cBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyR[scBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyR^scBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyRascBseZRS((RKRL(((s/usr/lib64/python2.7/httplib.pyRdscBseZd�ZRS(cCs.|st|�}n|f|_||_dS(N(R^R�RI(R&RI((s/usr/lib64/python2.7/httplib.pyR]hs(RKRLR](((s/usr/lib64/python2.7/httplib.pyRgsR=cBseZd�ZRS(cCstj|dt|f�dS(Ns&got more than %d bytes when reading %s(RR]R<(R&t	line_type((s/usr/lib64/python2.7/httplib.pyR]os(RKRLR](((s/usr/lib64/python2.7/httplib.pyR=nsRbcBsJeZdZd�Zd�Zd�Zdd�Zd�Zdd�Z	RS(s2A limited file-like object for HTTP/0.9 responses.cCs7||_||_d|_d|_t|�|_dS(Ni(t_linet_filet_line_consumedt_line_offsetR8t
_line_left(R&RIR�((s/usr/lib64/python2.7/httplib.pyR]~s
				cCst|j|�S(N(tgetattrR(R&tattr((s/usr/lib64/python2.7/httplib.pyt__getattr__�scCs:d|_|jj|_|jj|_|jj|_dS(Ni(RRRvR;t	readlines(R&((s/usr/lib64/python2.7/httplib.pyt_done�s	cCs�|jr|jj|�S|dks4||jkr�|j|j}|j�|dkrk||jj�S||jj|t|��Sn[|j}||}|j||!}||_|j|8_|jdkr�|j�n|SdS(Ni(	RRRvR$RRRRR8(R&RxRyR|R�((s/usr/lib64/python2.7/httplib.pyRv�s 	
!	
	
cCs4|jr|jj�S|j|j}|j�|S(N(RRR;RRR(R&Ry((s/usr/lib64/python2.7/httplib.pyR;�s
	

cCsk|jr|jj|�S|j|jg}|j�|dkrS||jj�S||jj|�SdS(N(RRRRRRR$(R&tsizetL((s/usr/lib64/python2.7/httplib.pyR�s	
N(
RKRLR�R]RRR$RvR;R(((s/usr/lib64/python2.7/httplib.pyRbvs					(nR�RR�treR�tsysRturlparseRRtcatch_warningstfilterwarningsR
t	mimetoolst	cStringIORtImportErrort__all__R�RRSR�R�R�RftSWITCHING_PROTOCOLSt
PROCESSINGRtCREATEDtACCEPTEDtNON_AUTHORITATIVE_INFORMATIONRjt
RESET_CONTENTtPARTIAL_CONTENTtMULTI_STATUStIM_USEDtMULTIPLE_CHOICEStMOVED_PERMANENTLYtFOUNDt	SEE_OTHERRkt	USE_PROXYtTEMPORARY_REDIRECTtBAD_REQUESTtUNAUTHORIZEDtPAYMENT_REQUIREDt	FORBIDDENt	NOT_FOUNDtMETHOD_NOT_ALLOWEDtNOT_ACCEPTABLEtPROXY_AUTHENTICATION_REQUIREDtREQUEST_TIMEOUTtCONFLICTtGONEtLENGTH_REQUIREDtPRECONDITION_FAILEDtREQUEST_ENTITY_TOO_LARGEtREQUEST_URI_TOO_LONGtUNSUPPORTED_MEDIA_TYPEtREQUESTED_RANGE_NOT_SATISFIABLEtEXPECTATION_FAILEDtUNPROCESSABLE_ENTITYtLOCKEDtFAILED_DEPENDENCYtUPGRADE_REQUIREDtINTERNAL_SERVER_ERRORtNOT_IMPLEMENTEDtBAD_GATEWAYtSERVICE_UNAVAILABLEtGATEWAY_TIMEOUTtHTTP_VERSION_NOT_SUPPORTEDtINSUFFICIENT_STORAGEtNOT_EXTENDEDRR~R<R9tcompileR�R�R�R�R�R�tMessageR!RRRR�R�R?R	RRRR	RR
RRR
RRRRRR=RRb(((s/usr/lib64/python2.7/httplib.pyt<module>Cs6


				
m�d��[
.