File: //usr/local/lib/python3.9/site-packages/future/backports/http/__pycache__/client.cpython-39.pyc
a
q�dg� � . @ s� d Z ddlmZmZmZmZ ddlmZmZm Z m
Z
ddlmZ ddl
mZ ddl
mZ ddlmZ ddlZddlZddlZdd lmZ ddlZdd
lmZ er�ddlmZ nddlmZ g d�Zd
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)Z<d*Z=d+Z>d,Z?d-Z@d.ZAd/ZBd0ZCd1ZDd2ZEd3ZFd4ZGd5ZHd6ZId7ZJd8ZKd9ZLd:ZMd;ZNd<ZOd=ZPd>ZQd?ZRd@ZSdAZTdBZUdCZVdDZWdEZXdFZYdGZZdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdu�-Z[dvZ\dwZ]dZ^G dxdy� dyej_�Z`e`fdzd{�Zaeb� ZcG d|d}� d}ejd�ZeG d~d� deb�ZfzddlgZgdd�lgmhZh W n ei�y� Y n0 G d�d�� d�ef�Zje�kd�� G d�d�� d�el�ZmG d�d�� d�em�ZnG d�d�� d�em�ZoG d�d�� d�em�ZpG d�d�� d�em�ZqG d�d�� d�em�ZrG d�d�� d�em�ZsG d�d�� d�em�ZtG d�d�� d�et�ZuG d�d�� d�et�ZvG d�d�� d�et�ZwG d�d�� d�em�ZxG d�d�� d�em�ZyemZzdS )�aD
HTTP/1.1 client library
A backport of the Python 3.3 http/client.py module for python-future.
<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>
� )�absolute_import�division�print_function�unicode_literals)�bytes�int�str�super)�PY2)�parser)�message)�create_connectionN)�urlsplit)�array)�Iterable)�HTTPResponse�HTTPConnection�
HTTPException�NotConnected�UnknownProtocol�UnknownTransferEncoding�UnimplementedFileMode�IncompleteRead�
InvalidURL�ImproperConnectionState�CannotSendRequest�CannotSendHeader�ResponseNotReady�
BadStatusLine�error� responses�P i� �UNKNOWN�IdlezRequest-startedzRequest-sent�d �e �f �� �� �� �� �� �� �� �� �� �, �- �. �/ �0 �1 �3 � � � � � � � � � � � � � � � � � � i� i� i� i� � � � �� � � � � � i� i� � �ContinuezSwitching Protocols�OK�Created�AcceptedzNon-Authoritative Informationz
No Contentz
Reset ContentzPartial ContentzMultiple ChoiceszMoved Permanently�Foundz See OtherzNot Modifiedz Use Proxyz(Unused)zTemporary RedirectzBad Request�UnauthorizedzPayment Required� Forbiddenz Not FoundzMethod Not AllowedzNot AcceptablezProxy Authentication RequiredzRequest Timeout�Conflict�GonezLength 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)-r$ r% r'