Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/httplib.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@stdZddlmZddlZddlZddlmZddlmZddlZej	��er�ej
dde�nddlZWdQXyddl
mZWn!ek
r�ddlmZnXd	d
ddd
ddddddddddddgZdZdZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Zd'Zd(Zd)Z d*Z!d+Z"d,Z#d-Z$d.Z%d/Z&d0Z'd1Z(d2Z)d3Z*d4Z+d5Z,d6Z-d7Z.d8Z/d9Z0d:Z1d;Z2d<Z3d=Z4d>Z5d?Z6d@Z7dAZ8dBZ9dCZ:dDZ;dEZ<dFZ=dGZ>dHZ?dIZ@dJZAdKZBdLZCdMZDdNZEdOZFdPZGi)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@6dqdA6drdB6dsdC6dtdD6dudI6dvdJ6dwdK6dxdL6dydM6dzdN6ZHd{ZId|ZJd}ejKfd~��YZLd
fd��YZMdfd���YZNd	fd���YZOyddlPZPWnek
r�nCXd�eNfd���YZQejRd��d�eOfd���YZSd��ZTdeUfd���YZVd
eVfd���YZWdeVfd���YZXdeVfd���YZYdeVfd���YZZdeVfd���YZ[deVfd���YZ\deVfd���YZ]de]fd���YZ^de]fd���YZ_de]fd���YZ`deVfd���YZad�eVfd���YZbeVZcd�fd���YZddS(�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 SupportediitHTTPMessagecBs#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/sys/lib/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/sys/lib/python2.7/httplib.pytaddcontinue�s
cCsRi|_d|_g|_}d|_d}d}d}}}t|jd�rc|jj}n|jr{|jj	}nx�t
rM|r�y
|�}Wq�tk
r�d}}d|_q�Xn|jjt
d�}t|�t
kr�d��n|sd|_Pn|r6|jd�r6|j||_q~nd}|r{|ddkr{|j|�|j||j��q~n(|j|�r�q~n|j|�r�Pn|j|�}|r�j|�|j||t|�dj��q~q~|jsd	|_n	d
|_|r ||�n)|r9|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.
        titunreadisheader linesEOF in headerssFrom s 	s
No headerss%Non-header line where header expecteds
; bad seekN(R"tunixfromtheaderststatusR$thasattrtfpR/tseekablettelltTruetIOErrortreadlinet_MAXLINEtlentLineTooLongt
startswithtappendR-tstript	iscommenttislasttisheaderR+tseek(R&thlistt
headerseent	firstlinetstartoflineR/R6tline((s/sys/lib/python2.7/httplib.pytreadheaders�sd		
			


	

$		
(t__name__t
__module__R+R-RI(((s/sys/lib/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&tsockRNROtmethodt	buffering((s/sys/lib/python2.7/httplib.pyt__init__Os										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.(R4R9R:R;R<RNtreprRtsplitR$t
ValueErrorR=ROtclosetLineAndFileWrappertint(R&RHRSR2RT((s/sys/lib/python2.7/httplib.pyt_read_statusks8


	

cCs
|jdk	rdSx�tr�|j�\}}}|tkrAPnxrtr�|jjtd�}t|�tkr�t	d��n|j
�}|s�Pn|jdkrDdG|GHqDqDWqW||_|j
�|_
|dkr�|_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|_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-encodingRUscontent-lengthidi�tHEAD( RQR$R7RctCONTINUER4R9R:R;R<R?RNR2RTRSR=R
RWRURXR!RR1t	getheadertlowerRVt_check_closeRbR_t
NO_CONTENTtNOT_MODIFIEDRP(R&RSR2RTtskipthdrttr_encRW((s/sys/lib/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
connectioniR`s
keep-alivesproxy-connection(RQRfRSRgR7tFalse(R&tconntpconn((s/sys/lib/python2.7/httplib.pyRh�scCs&|jr"|jj�d|_ndS(N(R4R`R$(R&((s/sys/lib/python2.7/httplib.pyR`s	
cCs
|jdkS(N(R4R$(R&((s/sys/lib/python2.7/httplib.pytisclosedscCs[|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�|jj|�}|r|r|j�n|jdk	rW|jt
|�8_|jsW|j�qWn|S(NR.Rdi(R4R$RPR`RUt
_read_chunkedRWtreadt
_safe_readR
R;(R&tamtts((s/sys/lib/python2.7/httplib.pyRus:
	


	


	cCsC|jtkst�|j}g}x�tr�|dkr�jjtd�}t	|�tkrpt
d��n|jd�}|dkr�|| }nyt|d�}Wn0t
k
r�|j�tdj|���nX|dkr��|dkr|j|j|��n�||krR|j|j|��|||_dj|�S||kr�|j|j|��|jd�d|_dj|�S|j|j|��||8}|jd�d}q'Wx[tr+|jjtd�}t	|�tkrt
d��n|sPn|d	kr�Pq�q�W|j�dj|�S(
Nis
chunk sizet;iiR.istrailer lines
(RURRtAssertionErrorRVR7R$R4R9R:R;R<tfindRbR_R`R
R%R>Rv(R&RwRVR(RHti((s/sys/lib/python2.7/httplib.pyRtCsV		





	



	
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.(R4Rutmint	MAXAMOUNTR
R%R>R;(R&RwRxtchunk((s/sys/lib/python2.7/httplib.pyRv}s
cCs
|jj�S(N(R4tfileno(R&((s/sys/lib/python2.7/httplib.pyR��scCs.|jdkrt��n|jj||�S(N(RQR$RRf(R&tnametdefault((s/sys/lib/python2.7/httplib.pyRf�scCs(|jdkrt��n|jj�S(s&Return list of (header, value) tuples.N(RQR$Rtitems(R&((s/sys/lib/python2.7/httplib.pyt
getheaders�sN(RJRKR$RpR\RcRnRhR`RsRuRtRvR�RfR�(((s/sys/lib/python2.7/httplib.pyREs
	'	V			-	:		cBs�eZdZdZeZeZdZdZ	dZ
ddej
dd�Zddd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zdd
�Zddd�Zd�Zdd�Zdid�Zd�Zd�Zed�ZRS(isHTTP/1.1iicCs�||_||_d|_g|_d|_t|_d|_d|_	d|_
i|_|dk	rr||_n|j
||�\|_|_tj|_dS(N(ttimeouttsource_addressR$RYt_buffert_HTTPConnection__responset_CS_IDLEt_HTTPConnection__stateRPt_tunnel_hostt_tunnel_portt_tunnel_headersROt
_get_hostportthosttporttsockettcreate_connectiont_create_connection(R&R�R�ROR�R�((s/sys/lib/python2.7/httplib.pyR\�s										cCsM|jrtd��n||_||_|r<||_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 HTML 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(RYtRuntimeErrorR�R�R�tclear(R&R�R�R1((s/sys/lib/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�||fS(	Nt:t]iR.snonnumeric port: '%s'it[i�(R$trfindRbR_tdefault_portR(R&R�R�R|tj((s/sys/lib/python2.7/httplib.pyR��s

	&cCs
||_dS(N(RN(R&tlevel((s/sys/lib/python2.7/httplib.pytset_debuglevel�sc
CsL|j|j|j�\}}|jd||f�x4|jj�D]#\}}|jd||f�qEW|jd�|j|jd|jd|j	�}|j
�\}}}|dkr�j�tj
d||j�f��nx[trG|jjtd�}	t|	�tkr*td	��n|	s4Pn|	dkr�q��dS(
NsCONNECT %s:%d HTTP/1.0
s%s: %s
s
RORZi�sTunnel connection failed: %d %sisheader line(R�R�R�tsendR�t	iteritemstresponse_classRYRORPRcR`R�RR?R7R4R9R:R;R<(
R&R�R�theaderR(tresponseRStcodetmessageRH((s/sys/lib/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�RYR�R�(R&((s/sys/lib/python2.7/httplib.pytconnects	cCsQ|jr"|jj�d|_n|jrD|jj�d|_nt|_dS(s(Close the connection to the HTTP server.N(RYR`R$R�R�R�(R&((s/sys/lib/python2.7/httplib.pyR`s	
	
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 RussendIng a read()ableN(RYR$t	auto_openR�R	RNR]R3t
isinstanceRRutsendall(R&tdatat	blocksizet	datablock((s/sys/lib/python2.7/httplib.pyR�"s	
	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&Rx((s/sys/lib/python2.7/httplib.pyt_output6scCsx|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_bodyRQ((s/sys/lib/python2.7/httplib.pyt_send_output=s
	
cCs|jr$|jj�r$d|_n|jtkr?t|_n	t��||_|s`d}nd|||jf}|j	|�|j
dkr|s�}|jd�r�t|�\}}}}}n|ry|j
d�}Wn tk
r|j
d�}nX|jd|�q�jr8|j}	|j}
n|j}	|j}
y|	j
d�}Wn tk
r|	j
d�}nX|jd	�d
kr�d|d}n|
|jkr�|jd|�q�jdd
||
f�n|s|jdd�qndS(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%s %s %siR.thttptasciitidnatHostR�iR�R�s%s:%ssAccept-EncodingtidentityN(R�RsR$R�R�t_CS_REQ_STARTEDRRPt
_http_vsn_strR�t	_http_vsnR=RtencodetUnicodeEncodeErrort	putheaderR�R�R�R�R{R�(R&RZturlt	skip_hosttskip_accept_encodingRltnetloctnilt
netloc_encR�R�thost_enc((s/sys/lib/python2.7/httplib.pyt
putrequestRsL			

				

cGs^|jtkrt��nd|djg|D]}t|�^q.�f}|j|�dS(skSend a request header line to the server.

        For example: h.putheader('Accept', 'text/html')
        s%s: %ss
	N(R�R�RR%R�R�(R&R�tvaluestvRl((s/sys/lib/python2.7/httplib.pyR��s2cCs5|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/sys/lib/python2.7/httplib.pyt
endheaders�s		cCs|j||||�dS(s&Send a complete request to the server.N(t
_send_request(R&RZR�tbodyR1((s/sys/lib/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�R;t	TypeErrortostfstatR�tst_sizetAttributeErrortOSErrorRNR�(R&R�tthelentte((s/sys/lib/python2.7/httplib.pyt_set_content_length�s"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"tfromkeysRgR�R$R�R�R�R�(
R&RZR�R�R1tktheader_namestskipsRlR(((s/sys/lib/python2.7/httplib.pyR��s(

cCs|jr$|jj�r$d|_n|jtks<|jrHt��n|jf}i|jd6|jd6}|j	dkr�||j	f7}n|r�t
|d<n|j||�}|j�|j
tks�t�t|_|j
r�j�n	||_|S(s!Get the response from the server.RORZiR[N(R�RsR$R�R�RRYRORPRNR7R�RnRXRRRzR�R`(R&R[targstkwdsR�((s/sys/lib/python2.7/httplib.pytgetresponses$

		
	N( RJRKR�R�RR�t	HTTP_PORTR�R�RNROR$R�t_GLOBAL_DEFAULT_TIMEOUTR\R�R�R�R�R�R`R�R�R�R�R�R�R�R�R�RpR�(((s/sys/lib/python2.7/httplib.pyR�s2					
		u			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�RO((s/sys/lib/python2.7/httplib.pyR\Cs	cCsj||_|j|_|j|_|j|_|j|_|j|_|j|_|j|_d|_	dS(N(
t_connR�R�R�R�R�R�R�R$tfile(R&Rq((s/sys/lib/python2.7/httplib.pyR�Os	cCs3|dk	r"|jj||�n|jj�dS(sDAccept arguments to set the host/port, since the superclass doesn't.N(R$R�t
_set_hostportR�(R&R�R�((s/sys/lib/python2.7/httplib.pyR�^scCs|jS(sCProvide a getfile, since the superclass' does not use this concept.(R�(R&((s/sys/lib/python2.7/httplib.pytgetfileescCs�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
        RLii�N(R�R�RRYRMR�R`R$R1RHRQR4R2RT(R&R[R�te((s/sys/lib/python2.7/httplib.pytgetreplyis
	cCs|jj�d|_dS(N(R�R`R$R�(R&((s/sys/lib/python2.7/httplib.pyR`�s
N(RJRKt__doc__R�R�RNRR�R$R\R�R�R�RpR�R`(((s/sys/lib/python2.7/httplib.pyR9s		!tHTTPSConnectioncBs;eZdZeZddddejdd�Zd�Z	RS(s(This class allows communication via SSL.cCs2tj||||||�||_||_dS(N(RR\tkey_filet	cert_file(R&R�R�R�R�ROR�R�((s/sys/lib/python2.7/httplib.pyR\�s	cCsh|j|j|jf|j|j�}|jrF||_|j�ntj	||j
|j�|_dS(s(Connect to a host on a given (SSL) port.N(R�R�R�R�R�R�RYR�tssltwrap_socketR�R�(R&RY((s/sys/lib/python2.7/httplib.pyR��s		
N(
RJRKR�t
HTTPS_PORTR�R$R�R�R\R�(((s/sys/lib/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�RO((s/sys/lib/python2.7/httplib.pyR\�s	
	N(RJRKR�R�R�R$R\(((s/sys/lib/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(RYtsslobj((s/sys/lib/python2.7/httplib.pyt
FakeSocket�s	
cBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR	�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBseZd�ZRS(cCs|f|_||_dS(N(R�RS(R&RS((s/sys/lib/python2.7/httplib.pyR\�s(RJRKR\(((s/sys/lib/python2.7/httplib.pyR
�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBs&eZdd�Zd�Zd�ZRS(cCs"|f|_||_||_dS(N(R�tpartialtexpected(R&R�R�((s/sys/lib/python2.7/httplib.pyR\�s	cCs<|jdk	rd|j}nd}dt|j�|fS(Ns, %i more expectedR.sIncompleteRead(%i bytes read%s)(R�R$R;R�(R&R�((s/sys/lib/python2.7/httplib.pyt__repr__�scCs
t|�S(N(R](R&((s/sys/lib/python2.7/httplib.pyt__str__�sN(RJRKR$R\R�R�(((s/sys/lib/python2.7/httplib.pyR
�s	cBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyR�scBseZRS((RJRK(((s/sys/lib/python2.7/httplib.pyRscBseZd�ZRS(cCs.|st|�}n|f|_||_dS(N(R]R�RH(R&RH((s/sys/lib/python2.7/httplib.pyR\s(RJRKR\(((s/sys/lib/python2.7/httplib.pyRsR<cBseZd�ZRS(cCstj|dt|f�dS(Ns&got more than %d bytes when reading %s(RR\R:(R&t	line_type((s/sys/lib/python2.7/httplib.pyR\s(RJRKR\(((s/sys/lib/python2.7/httplib.pyR<
sRacBsJeZdZd�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_offsetR;t
_line_left(R&RHR�((s/sys/lib/python2.7/httplib.pyR\s
				cCst|j|�S(N(tgetattrR�(R&tattr((s/sys/lib/python2.7/httplib.pyt__getattr__!scCs:d|_|jj|_|jj|_|jj|_dS(Ni(R�R�RuR9t	readlines(R&((s/sys/lib/python2.7/httplib.pyt_done$s	cCs|jr|jj|�S|js(t�|dksC||jkr�|j|j}|j�|dkrz||jj�S||jj|t	|��Snp||jks�t�|j}||}|j||!}||_|j|8_|jdkr|j�n|SdS(Ni(
R�R�RuR�RzR$R�R�RR;(R&RwRxR|R�((s/sys/lib/python2.7/httplib.pyRu-s$	
!	
	
cCsC|jr|jj�S|js%t�|j|j}|j�|S(N(R�R�R9R�RzR�R�R(R&Rx((s/sys/lib/python2.7/httplib.pyR9Cs	

cCsz|jr|jj|�S|js(t�|j|jg}|j�|dkrb||jj�S||jj|�SdS(N(	R�R�RR�RzR�R�RR$(R&tsizetL((s/sys/lib/python2.7/httplib.pyRKs	
N(
RJRKR�R\RRR$RuR9R(((s/sys/lib/python2.7/httplib.pyRas					(eR�RR�R�tsysRturlparseRR�tcatch_warningstfilterwarningsR�t	mimetoolst	cStringIORtImportErrort__all__R�R�RRR�R�R�RetSWITCHING_PROTOCOLSt
PROCESSINGRtCREATEDtACCEPTEDtNON_AUTHORITATIVE_INFORMATIONRit
RESET_CONTENTtPARTIAL_CONTENTtMULTI_STATUStIM_USEDtMULTIPLE_CHOICEStMOVED_PERMANENTLYtFOUNDt	SEE_OTHERRjt	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:tMessageR!RRRR�R�R>R�R�t	ExceptionRR	RR
RRR
RRRRRR<RRa(((s/sys/lib/python2.7/httplib.pyt<module>Cs*


				
k��[

	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].