7wײ0
d Z ddlmZmZmZmZ ddlmZmZm Z m
Z
ddlmZ ddl
mZ ddl
mZ ddlmZ ddlZddlZddlZdd lmZ ddlZdd
lmZ erddlmZ nddlmZ g dZd
Z dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2d Z3d!Z4d"Z5d#Z6d$Z7d%Z8d&Z9d'Z:d(Z;d)Zd,Z?d-Z@d.ZAd/ZBd0ZCd1ZDd2ZEd3ZFd4ZGd5ZHd6ZId7ZJd8ZKd9ZLd:ZMd;ZNdZQd?ZRd@ZSdAZTdBZUdCZVdDZWdEZXdFZYdGZZi ddHddIddJddKddLddMddNddOddPddQd dRd!dSd"dTd#dUd$dVdWdXd%dYi d&dZd'd[d(d\d)d]d*d^d+d_d,d`d-dad.dbd/dcd0ddd1ded2dfd3dgd4dhd5did6djdkdldmdndodpdqdrdsdtdudvZ[dwZ\dxZ]dZ^ G dy dzej_ Z`e`fd{Za eb Zc G d| d}ejd Ze G d~ deb Zf ddlgZgddlgmhZh G d def Ziej d n# ek$ r Y nw xY w G d del Zm G d dem Zn G d dem Zo G d dem Zp G d dem Zq G d dem Zr G d dem Zs G d dem Zt G d det Zu G d det Zv G d det Zw G d dem Zx G d dem ZyemZzdS )aD
HTTP/1.1 client library
A backport of the Python 3.3 http/client.py module for python-future.
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
Req-started-unread-response _CS_REQ_STARTED
Req-sent-unread-response _CS_REQ_SENT
)absolute_importdivisionprint_functionunicode_literals)bytesintstrsuper)PY2)parser)message)create_connectionN)urlsplit)array)Iterable)HTTPResponseHTTPConnection
HTTPExceptionNotConnectedUnknownProtocolUnknownTransferEncodingUnimplementedFileModeIncompleteRead
InvalidURLImproperConnectionStateCannotSendRequestCannotSendHeaderResponseNotReady
BadStatusLineerror responsesP i UNKNOWNIdlezRequest-startedzRequest-sentd e f i, i- i. i/ i0 i1 i3 i i i i i i i i i i i i i i i i i i i i i i i ContinuezSwitching ProtocolsOKCreatedAcceptedzNon-Authoritative Informationz
No Contentz
Reset ContentzPartial ContentzMultiple ChoiceszMoved PermanentlyFoundz See OtherzNot Modifiedz Use Proxyi2 z(Unused)zTemporary RedirectzBad RequestUnauthorizedzPayment Required Forbiddenz Not FoundzMethod Not AllowedzNot AcceptablezProxy Authentication RequiredzRequest TimeoutConflictGonezLength RequiredzPrecondition FailedzRequest Entity Too LargezRequest-URI Too LongzUnsupported Media TypezRequested Range Not SatisfiablezExpectation FailedzPrecondition RequiredzToo Many RequestszRequest Header Fields Too LargezInternal Server ErrorzNot ImplementedzBad GatewayzService UnavailablezGateway TimeoutzHTTP Version Not SupportedzNetwork Authentication Required)r1 r2 r3 r4 r5 r6 r7 r8 r9 r: r; i i c e Zd Zd ZdS )HTTPMessagec 8 | dz }t | }g }d}| D ]Z}|d| |k rd}n|dd sd}|r| | [|S )a Find all header lines matching a given header name.
Look through the list of headers and find all lines matching a given
header name (and their continuation lines). A list of the lines is
returned, without interpretation. If the header does not occur, an
empty list is returned. If the header occurs multiple times, all
occurrences are returned. Case is not important in the header name.
:r N )lowerlenkeysisspaceappend)selfnamenlsthitlines n/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/future/backports/http/client.pygetallmatchingheadersz!HTTPMessage.getallmatchingheaders s zz||c!IIIIKK ! !DBQBx~~4''"1"X%%''
!
4
N)__name__
__module____qualname__rV rW rU rF rF s# rW rF c g } | t dz }t | t k rt d | | t | t
k rt
dt
z |dv rnt d | d }t j | | S ) aG Parses only RFC2822 headers from a file pointer.
email Parser wants to see strings rather than bytes.
But a TextIOWrapper around self.rfile would buffer too many bytes
from the stream, bytes which we later need to read as bytes.
So we read the correct bytes here, as bytes, for email Parser
to parse.
TrI header linezgot more than %d headers
rW rW
iso-8859-1)_class)
readline_MAXLINErK LineTooLongrN _MAXHEADERSr r joindecodeemail_parserParserparsestr)fprb headersrT hstrings rU
parse_headersro s G{{8a<((t99xm,,,tw<<+%% :[ HIII((( Cjjoog&&--l;;Gf---66w???rW c e Zd ZdeddfdZd Zd Zd Zd Z fdZ fd Z
d
Zd Zd fd Z
d
Zd Zd Zd Zd Zd Zd Zd ZddZd Zd Zd Zd Zd Z xZS )r r Nc b | d | _ || _ |t urt j dt d || _ d x| _ | _ t | _ t | _ t | _
t | _ t | _ t | _ t | _ d S )Nrbithe 'strict' argument isn't supported anymore; http.client now always assumes HTTP/1.x compliant servers. )makefilerl
debuglevel_strict_sentinelwarningswarnDeprecationWarning_methodrm msg_UNKNOWNversionstatusreasonchunked
chunk_leftlength
will_close)rO sockrv strictmethodurls rU __init__zHTTPResponse.__init__* s --%%$)))M M"A
'
'
' #'&tx ""rW c t | j t dz d }t | t k rt d | j dk rt dt | |st | |
d d \ }}}n?# t $ r2 |
d d \ }}d}n# t $ r d}Y nw xY wY nw xY w| d s#|
t | t | }|d k s|d
k rt | n# t $ r t | w xY w|||fS )NrI ra zstatus liner zreply:rt zHTTP/r% i )r rl rc rd rK re rv printreprr split
ValueError
startswith_close_connr )rO rT r~ r r s rU _read_statuszHTTPResponse._read_statusL s 47##HqL11<@@t99xm,,,?Q(DJJ''' & %%% &*jjq&9&9#GVVV
"&**T1"5"5
!!'** &%%% &[[F||v||#D))) , &