Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/httplib.pyc

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


�
��c@s�dZddkZddkZddkZddklZyddklZWn#ej
oddklZnXddddd	d
ddd
dddddddddgZ	dZ
dZdZdZ
dZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Zd'Zd(Zd)Zd*Zd+Zd,Zd-Z d.Z!d/Z"d0Z#d1Z$d2Z%d3Z&d4Z'd5Z(d6Z)d7Z*d8Z+d9Z,d:Z-d;Z.d<Z/d=Z0d>Z1d?Z2d@Z3dAZ4dBZ5dCZ6dDZ7dEZ8dFZ9dGZ:dHZ;dIZ<dJZ=dKZ>dLZ?dMZ@hdNd<dOd<dPd <dQd!<dRd"<dSd#<dTd$<dUd%<dVd&<dWd)<dXd*<dYd+<dZd,<d[d-<d\d.<d]d^<d_d/<d`d0<dad1<dbd2<dcd3<ddd4<ded5<dfd6<dgd7<dhd8<did9<djd:<dkd;<dld<<dmd=<dnd><dod?<dpd@<dqdA<drdF<dsdG<dtdH<dudI<dvdJ<dwdK<ZAdxZBdyeiCfdz��YZDdfd{��YZEdfd|��YZFd}fd~��YZGdfd���YZHd�eHfd���YZId�eHfd���YZJdeFfd���YZKdfd���YZLeMed��od�eLfd���YZNnd	eOfd���YZPd
ePfd���YZQdePfd���YZRdePfd���YZSdePfd���YZTd
ePfd���YZUdePfd���YZVdePfd���YZWdeWfd���YZXdeWfd���YZYdeWfd���YZZdePfd���YZ[ePZ\d�fd���YZ]d��Z^e_d�joe^�ndS(�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�N(turlsplit(tStringIOtHTTPtHTTPResponsetHTTPConnectiontHTTPSConnectiont
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 SupporteditHTTPMessagecBs#eZd�Zd�Zd�ZRS(cCsV|ii|�}|djo||i|<n#di||f�}||i|<dS(s*Add header for field key handling repeats.s, N(tdicttgettNonetjoin(tselftkeytvaluetprevtcombined((s/sys/lib/python/httplib.pyt	addheader�s

cCs&|i|}|d||i|<dS(s-Add more field data from a continuation line.s
 N(R (R$R%tmoreR'((s/sys/lib/python/httplib.pytaddcontinue�s
cCsHh|_d|_g|_}d|_d}d}d}}}t|id�o|ii}n|io|ii	}nx�t
o�|o:y
|�}Wq�tj
od}}d|_q�Xn|ii�}|pd|_Pn|o'|i
d�o|i||_q�nd}|o;|ddjo*|i|�|i||i��q�n-|i|�oq�n|i|�oPn|i|�}|o8|i|�|i||t|�di��q�q�|ip
d|_n
d	|_|o||�n,|o|ii|�n|id
|_Pq�WdS(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.
        titunreadisEOF in headerssFrom s 	s
No headerss%Non-header line where header expecteds
; bad seekN(R tunixfromtheaderststatusR"thasattrtfpR-tseekablettelltTruetIOErrortreadlinet
startswithtappendR+tstript	iscommenttislasttisheaderR)tlentseek(R$thlistt
headerseent	firstlinetstartoflineR-R4tline((s/sys/lib/python/httplib.pytreadheaders�s`		
	



	

$

	(t__name__t
__module__R)R+RE(((s/sys/lib/python/httplib.pyR�s			cBszeZdddd�Zd�Zd�Zd�Zd�Zd�Zdd�Z	d�Z
d	�Zdd
�Zd�Z
RS(
icCs||idd�|_||_||_||_d|_t|_t|_	t|_
t|_t|_t|_
t|_dS(Ntrbi(tmakefileR2t
debugleveltstrictt_methodR"tmsgt_UNKNOWNtversionR0treasontchunkedt
chunk_lefttlengtht
will_close(R$tsockRJRKtmethod((s/sys/lib/python/httplib.pyt__init__Cs										c	Csv|ii�}|idjodGt|�GHn|pt|��ny|idd�\}}}WnQtj
oEy"|idd�\}}d}Wq�tj
o
d}q�XnX|id�pA|i	o|i
�t|��q
t||i�|_dSny:t|�}|d	jp
|d
jot|��nWntj
ot|��nX|||fS(Nisreply:iiR,sHTTP/sHTTP/0.9i�idi�(sHTTP/0.9i�R,(
R2R7RJtreprRtsplitR"t
ValueErrorR8RKtclosetLineAndFileWrappertint(R$RDROR0RP((s/sys/lib/python/httplib.pyt_read_statusUs4


cCs�|idj	odSnx�tox|i�\}}}|tjoPnxJtoB|ii�i�}|pPn|idjo
dG|GHqLqLWqW||_	|i�|_
|djo
d|_nD|id�o
d|_n'|djo
d|_n
t
|��|idjo5d|_d|_d	|_tt��|_dSnt|id�|_|idjo#x |iiD]}dG|Gq�Wnd|i_|iid
�}|o)|i�djod	|_d|_n
d|_|i�|_|iid�}|oA|io6yt|�|_Wqftj
od|_qfXn
d|_|tjp;|tjp.d
|jo
djnp|idjo
d|_n|io(|io|idjo
d	|_ndS(Nisheader:sHTTP/1.0i
sHTTP/1.isHTTP/0.9i	istransfer-encodingRQscontent-lengthidi�tHEAD(RMR"R5R^tCONTINUER2R7R:RJR0RPROR8RRSRQRTRRR/t	getheadertlowerRRt_check_closeR]RZt
NO_CONTENTtNOT_MODIFIEDRL(R$ROR0RPtskipthdrttr_encRS((s/sys/lib/python/httplib.pytbeginzsl


	




			
	
		
cCs�|iid�}|idjo<|iid�}|od|i�jotSntSn|iid�otSn|od|i�jotSn|iid�}|od|i�jotSntS(Nt
connectioniR[s
keep-alivesproxy-connection(RMRaRORbR5tFalse(R$tconntpconn((s/sys/lib/python/httplib.pyRc�scCs(|io|ii�d|_ndS(N(R2R[R"(R$((s/sys/lib/python/httplib.pyR[�s

cCs
|idjS(N(R2R"(R$((s/sys/lib/python/httplib.pytisclosed�scCs|idjodSn|io|i|�Sn|djoP|idjo|ii�}n|i|i�}d|_|i�|Sn|idj	o!||ijo
|i}q�n|ii|�}|idj	o|it|�8_n|S(NR,i(	R2R"RQt
_read_chunkedRStreadt
_safe_readR[R>(R$tamtts((s/sys/lib/python/httplib.pyRp�s$

	
cCs�|itjpt�|i}d}x>to6|djo^|ii�}|id�}|djo|| }nt	|d�}|djoPq�n|djo||i
|�7}n�||jo(||i
|�7}|||_|Sn\||jo1||i
|�7}|i
d�d|_|Sn||i
|�7}||8}|i
d�d}q)Wx-to%|ii�}|djoPqjqjW|i�|S(NR,t;iiis
(RQRNtAssertionErrorRRR5R"R2R7tfindR]RqR[(R$RrRRR&RDti((s/sys/lib/python/httplib.pyRosB	



	




	





cCswg}xa|djoS|iit|t��}|pt|��n|i|�|t|�8}q	Wdi|�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,(R2Rptmint	MAXAMOUNTRR9R>R#(R$RrRstchunk((s/sys/lib/python/httplib.pyRqFs
cCs0|idjo
t��n|ii||�S(N(RMR"RRa(R$tnametdefault((s/sys/lib/python/httplib.pyRa]s
cCs*|idjo
t��n|ii�S(s&Return list of (header, value) tuples.N(RMR"Rtitems(R$((s/sys/lib/python/httplib.pyt
getheadersbs
N(RFRGR"RWR^RiRcR[RnRpRoRqRaR~(((s/sys/lib/python/httplib.pyR9s
	%	P				/	cBs�eZdZdZeZeZdZdZ	dZ
ddd�Zd�Z
d�Zd�Zd�Zd	�Zd
�Zd�Zddd�Zd
�Zd�Zdhd�Zd�Zd�ZRS(isHTTP/1.1iicCs[d|_g|_d|_t|_d|_|i||�|dj	o
||_ndS(N(	R"RUt_buffert_HTTPConnection__responset_CS_IDLEt_HTTPConnection__stateRLt
_set_hostportRK(R$thosttportRK((s/sys/lib/python/httplib.pyRWts					
cCs�|djo�|id�}|id�}||joTyt||d�}Wn+tj
otd||d��nX|| }n
|i}|o3|ddjo"|ddjo|dd!}q�n||_||_dS(Nt:t]isnonnumeric port: '%s'it[i�(R"trfindR]RZRtdefault_portR�R�(R$R�R�Rwtj((s/sys/lib/python/httplib.pyR�s

	)	cCs
||_dS(N(RJ(R$tlevel((s/sys/lib/python/httplib.pytset_debuglevel�scCs&d}x�i|i|idti�D]�}|\}}}}}yUti|||�|_|idjod|i|ifGHn|ii|�Wnhtij
oY}|idjodG|i|ifGHn|io|ii	�nd|_q(nXPq(W|ipti|�ndS(s3Connect to the host and port specified in __init__.s!getaddrinfo returns an empty listisconnect: (%s, %s)s
connect fail:N(tsockettgetaddrinfoR�R�tSOCK_STREAMRURJtconnectRR[R"(R$RMtrestaftsocktypetprotot	canonnametsa((s/sys/lib/python/httplib.pyR��s(

	
cCsU|io|ii�d|_n|io|ii�d|_nt|_dS(s(Close the connection to the HTTP server.N(RUR[R"R�R�R�(R$((s/sys/lib/python/httplib.pyR[�s





cCs�|idjo%|io|i�q5t��n|idjodGt|�GHny|ii|�Wn:ti	j
o+}|ddjo|i
�n�nXdS(sSend `str' to the server.issend:i N(RUR"t	auto_openR�RRJRXtsendallR�RR[(R$tstrtv((s/sys/lib/python/httplib.pytsend�s

cCs|ii|�dS(suAdd a line of output to the current request buffer.

        Assumes that the line does *not* end with \r\n.
        N(RR9(R$Rs((s/sys/lib/python/httplib.pyt_output�scCs:|iid�di|i�}|i2|i|�dS(spSend the currently buffered request and clear the buffer.

        Appends an extra \r\n to the buffer.
        R,s
N(R,R,(RtextendR#R�(R$RM((s/sys/lib/python/httplib.pyt_send_output�sc
Cs�|io|ii�o
d|_n|itjo
t|_n
t��||_|p
d}nd|||if}|i	|�|i
djo1|pd}|id�ot|�\}}}}}n|oLy|i
d�}Wn"tj
o|i
d�}nX|id|�q�y|ii
d�}	Wn%tj
o|ii
d�}	nX|itjo|id|	�q�|idd	|	|if�n|p|id
d�q�ndS(
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,thttptasciitidnatHosts%s:%ssAccept-EncodingtidentityN(R�RnR"R�R�t_CS_REQ_STARTEDRRLt
_http_vsn_strR�t	_http_vsnR8RtencodetUnicodeEncodeErrort	putheaderR�R�t	HTTP_PORT(
R$RVturlt	skip_hosttskip_accept_encodingR�tnetloctnilt
netloc_encthost_enc((s/sys/lib/python/httplib.pyt
putrequest�s>

		

!
cCs>|itjo
t��nd||f}|i|�dS(skSend a request header line to the server.

        For example: h.putheader('Accept', 'text/html')
        s%s: %sN(R�R�RR�(R$theaderR&R�((s/sys/lib/python/httplib.pyR�Es
cCs4|itjo
t|_n
t��|i�dS(s?Indicate that the last header line has been sent to the server.N(R�R�t_CS_REQ_SENTRR�(R$((s/sys/lib/python/httplib.pyt
endheadersPs
	cCsry|i||||�WnQtij
oB}|ddjp|io�n|i||||�nXdS(s&Send a complete request to the server.ii N(t
_send_requestR�RR�(R$RVR�tbodyR/R�((s/sys/lib/python/httplib.pytrequestZscCstig}|D]}||i�q~�}h}d|jod|d<nd|jod|d<n|i|||�|o-d|jo |idtt|���nx*|i�D]\}	}
|i|	|
�q�W|i�|o|i	|�ndS(NR�iR�saccept-encodingR�scontent-lengthsContent-Length(
R tfromkeysRbR�R�R�R>t	iteritemsR�R�(R$RVR�R�R/t_[1]tktheader_namestskipsRgR&((s/sys/lib/python/httplib.pyR�fs0

 

cCs�|io|ii�o
d|_n|itjp
|io
t��n|idjo.|i|i|id|i	d|i
�}n%|i|id|i	d|i
�}|i�|it
jpt�t|_|io|i�n
||_|S(s!Get the response from the server.iRKRVN(R�RnR"R�R�RRJtresponse_classRURKRLRiRTRNRuR�R[(R$tresponse((s/sys/lib/python/httplib.pytgetresponsezs"

	
	
	N(RFRGR�R�RR�R�R�R�RJRKR"RWR�R�R�R[R�R�R�R�R�R�R�R�R�(((s/sys/lib/python/httplib.pyRis*				
			
k		
	tSharedSocketcBs,eZd�Zd�Zd�Zd�ZRS(cCs||_d|_dS(Ni(RUt_refcnt(R$RU((s/sys/lib/python/httplib.pyRW�s	cCs|id7_dS(Ni(R�(R$((s/sys/lib/python/httplib.pytincref�scCsK|id8_|idjpt�|idjo|ii�ndS(Nii(R�RuRUR[(R$((s/sys/lib/python/httplib.pytdecref�scCs|ii�dS(N(RUR[(R$((s/sys/lib/python/httplib.pyt__del__�s(RFRGRWR�R�R�(((s/sys/lib/python/httplib.pyR��s			tSharedSocketClientcBseZd�Zd�ZRS(cCs/d|_||_|ii�|i|_dS(Ni(t_closedt_sharedR�RUt_sock(R$tshared((s/sys/lib/python/httplib.pyRW�s		
cCs1|ip#|ii�d|_d|_ndS(Ni(R�R�R�R"(R$((s/sys/lib/python/httplib.pyR[�s

	(RFRGRWR[(((s/sys/lib/python/httplib.pyR��s	tSSLFilecBseeZdZdZdd�Zd�Zdd�Zd�Zdd�Z	d�Z
d	�Zd
�ZRS(s(File-like object wrapping an SSL socket.i cCs<ti||�||_d|_|p
|ii|_dS(NR,(R�RWt_sslt_buft	__class__tBUFSIZEt_bufsize(R$RUtssltbufsize((s/sys/lib/python/httplib.pyRW�s		cCs�d}x�o�y|ii|i�}Wn�tij
oh}|dtijp|dtijoq	n|dtijp|dti	joPn�q	ti
j
o@}|dtijoq	n|dti
joPn�q	XPq	W|S(NR,i(R5R�RpR�R�tsslerrortSSL_ERROR_WANT_READtSSL_ERROR_WANT_WRITEtSSL_ERROR_ZERO_RETURNt
SSL_ERROR_EOFRterrnotEINTRtEBADF(R$tbufterr((s/sys/lib/python/httplib.pyt_read�s(
cCs�|ig}t|i�}xZ|djp
||jo?|i�}|djoPn|i|�|t|�7}qWdi|�}|djod|_|Sn|||_|| SdS(NR,(R�R>R"R�R9R#(R$tsizetLtavailRstall((s/sys/lib/python/httplib.pyRp�s


	
cCs�|ig}d|_xS|did�}|djoPn|i�}|djoPn|i|�q|djodi|�Sn>di|�}|id�d}|| }|||_|SdS(NR,i�s
ii(R�RvR�R9R#(R$R�RwRsR�RD((s/sys/lib/python/httplib.pyR7s"	




icCsmd}g}xZtoR|i�}|pPn|i|�|t|�7}|o||joPqqW|S(Ni(R5R7R9R>(R$tsizehintttotaltlistRD((s/sys/lib/python/httplib.pyt	readlines"s


cCs
|ii�S(N(R�tfileno(R$((s/sys/lib/python/httplib.pyR�/scCs|S(N((R$((s/sys/lib/python/httplib.pyt__iter__2scCs!|i�}|p
t�n|S(N(R7t
StopIteration(R$RD((s/sys/lib/python/httplib.pytnext5s
N(
RFRGt__doc__R�R"RWR�RpR7R�R�R�R�(((s/sys/lib/python/httplib.pyR��s		
		t
FakeSocketcBsceZdd
d��YZd�Zd�Zdd�Zdd�ZeZddd�Z	d	�Z
RS(t
_closedsocketcBseZd�ZRS(cCstdd��dS(Ni	sBad file descriptor(R(R$R{((s/sys/lib/python/httplib.pyt__getattr__>s(RFRGR�(((s/sys/lib/python/httplib.pyR�=scCs)t|�}ti||�||_dS(N(R�R�RWR�(R$RUR�((s/sys/lib/python/httplib.pyRWAscCs#ti|�|ii�|_dS(N(R�R[R�R�R�(R$((s/sys/lib/python/httplib.pyR[Fs
cCs=|djo|djo
t��nt|i|i|�S(NtrRH(R
R�R�R�(R$tmodeR�((s/sys/lib/python/httplib.pyRIJs
icCs|ii|�S(N(R�twrite(R$tstufftflags((s/sys/lib/python/httplib.pyR�OsicCs|ii|�S(N(R�Rp(R$R>R�((s/sys/lib/python/httplib.pytrecvTscCst|i|�S(N(tgetattrR�(R$tattr((s/sys/lib/python/httplib.pyR�Ws(N(RFRGR�RWR[R"RIR�R�R�R�(((s/sys/lib/python/httplib.pyR�;s		cBs2eZdZeZddddd�Zd�ZRS(s(This class allows communication via SSL.cCs,ti||||�||_||_dS(N(RRWtkey_filet	cert_file(R$R�R�R�R�RK((s/sys/lib/python/httplib.pyRW`s	cCsbtititi�}|i|i|if�ti||i|i�}t	||�|_
dS(s(Connect to a host on a given (SSL) port.N(R�tAF_INETR�R�R�R�R�R�R�R�RU(R$RUR�((s/sys/lib/python/httplib.pyR�fsN(RFRGR�t
HTTPS_PORTR�R"RWR�(((s/sys/lib/python/httplib.pyR[s
	cBsteZdZdZdZdZeZdddd�Z	d�Z
ddd�Zd�Zd	�Z
d
�Zd�ZRS(
s-Compatibility class with httplib.py from 1.5.i
sHTTP/1.0iR,cCs7|djo
d}n|i|i|||��dS(s:Provide a default host, since the superclass requires one.iN(R"t_setupt_connection_class(R$R�R�RK((s/sys/lib/python/httplib.pyRWys

cCs^||_|i|_|i|_|i|_|i|_|i|_|i|_d|_dS(N(	t_connR�R�R�R�R�R�R"tfile(R$Rl((s/sys/lib/python/httplib.pyR��s	cCs5|dj	o|ii||�n|ii�dS(sDAccept arguments to set the host/port, since the superclass doesn't.N(R"R�R�R�(R$R�R�((s/sys/lib/python/httplib.pyR��s
cCs|iS(sCProvide a getfile, since the superclass' does not use this concept.(R(R$((s/sys/lib/python/httplib.pytgetfile�scGs |ii|di|��dS(s.The superclass allows only one value argument.s
	N(R�R�R#(R$R�tvalues((s/sys/lib/python/httplib.pyR��scCs�y|ii�}WnStj
oG}|iiidd�|_|i�d|_d|i	dfSnX|i
|_|i|_|i|i
|i
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
        RHii�N(R�R�RRURIRR[R"R/RDRMR2R0RP(R$R�te((s/sys/lib/python/httplib.pytgetreply�s
	cCs|ii�d|_dS(N(R�R[R"R(R$((s/sys/lib/python/httplib.pyR[�s
N(RFRGR�R�R�RJRR�R"RWR�R�RR�RR[(((s/sys/lib/python/httplib.pyRos				R�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,cCsO|djo
d}n|i|i|||||��||_||_dS(Ni(R"R�R�R�R�(R$R�R�R�R�RK((s/sys/lib/python/httplib.pyRW�s


	N(RFRGR�RR�R"RW(((s/sys/lib/python/httplib.pyR�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyR�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyR�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyR�scBseZd�ZRS(cCs|f|_||_dS(N(targsRO(R$RO((s/sys/lib/python/httplib.pyRW�s(RFRGRW(((s/sys/lib/python/httplib.pyR�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyR	�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyR
�scBseZd�ZRS(cCs|f|_||_dS(N(Rtpartial(R$R((s/sys/lib/python/httplib.pyRW�s(RFRGRW(((s/sys/lib/python/httplib.pyR�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyR
�scBseZRS((RFRG(((s/sys/lib/python/httplib.pyRscBseZRS((RFRG(((s/sys/lib/python/httplib.pyRscBseZRS((RFRG(((s/sys/lib/python/httplib.pyRscBseZd�ZRS(cCs|f|_||_dS(N(RRD(R$RD((s/sys/lib/python/httplib.pyRWs(RFRGRW(((s/sys/lib/python/httplib.pyR
sR\cBsJeZdZd�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$RDR((s/sys/lib/python/httplib.pyRWs
				cCst|i|�S(N(R�R	(R$R�((s/sys/lib/python/httplib.pyR�!scCs:d|_|ii|_|ii|_|ii|_dS(Ni(R
R	RpR7R�(R$((s/sys/lib/python/httplib.pyt_done$s	cCs"|io|ii|�Sn|ipt�|djp||ijo^|i|i}|i�|djo||ii�Sq||ii|t	|��Snu||ijpt�|i}||}|i||!}||_|i|8_|idjo|i�n|SdS(Ni(
R
R	RpRRuR"RRR
R>(R$RrRsRwR�((s/sys/lib/python/httplib.pyRp-s$


"	
	cCsJ|io|ii�Sn|ipt�|i|i}|i�|S(N(R
R	R7RRuRRR
(R$Rs((s/sys/lib/python/httplib.pyR7Cs

cCs�|io|ii|�Sn|ipt�|i|ig}|i�|djo||ii�Sn||ii|�SdS(N(	R
R	R�RRuRRR
R"(R$R�R�((s/sys/lib/python/httplib.pyR�Ks


N(
RFRGR�RWR�R
R"RpR7R�(((s/sys/lib/python/httplib.pyR\s					c
Cs�ddk}ddk}|i|idd�\}}d}x/|D]'\}}|djo|d}qDqDWd}d}|do|d}n|do|d}nt�}	|	i|�|	i|�|	id	|�|	i�|	i�\}
}}d
G|
GHdG|GHdGt	|	i
�i��GHH|o#x |iD]}
|
i
�GHq>WnHd
tfd��Y}|d�}	|	id	d�|	i�|	i�|	i�ttd�o�x�dD]�\}}d||fGHt�}|i|�|i|�|id	|�|i�|i�\}
}}d
G|
GHdG|GHdGt	|i
�i��GHH|o#x |iD]}
|
i
�GHqkWnHq�WndS(s�Test this module.

    A hodge podge of tests collected here, because they have too many
    external dependencies for the regular test suite.
    i�Nitdis-dswww.python.orgR�tGETsstatus =sreason =RptHTTP11cBseZdZdZRS(isHTTP/1.1(RFRGR�R�(((s/sys/lib/python/httplib.pyRvsshttp://www.python.org/~jeremy/R�ssourceforge.nets/projects/pythonshttps://%s%s(ssourceforge.nets/projects/python((ssourceforge.nets/projects/python(tsystgetopttargvRR�R�R�R�RR>RRpR/R:R[R1R�R(RRtoptsRtdltotaR�tselectorthR0RPR/R�Rths((s/sys/lib/python/httplib.pyttestVsb	


		



	


		
t__main__(`R�R�t	mimetoolsR�turlparseRt	cStringIORtImportErrort__all__R�R�RNR�R�R�R`tSWITCHING_PROTOCOLSt
PROCESSINGRtCREATEDtACCEPTEDtNON_AUTHORITATIVE_INFORMATIONRdt
RESET_CONTENTtPARTIAL_CONTENTtMULTI_STATUStIM_USEDtMULTIPLE_CHOICEStMOVED_PERMANENTLYtFOUNDt	SEE_OTHERRet	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_EXTENDEDRRytMessageRRRR�R�R�R�RRR1Rt	ExceptionRRRRR	R
RR
RRRRRR\RRF(((s/sys/lib/python/httplib.pys<module>Cs																																											i��d YD	=


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].