Trees | Indices | Help |
|
---|
|
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>
|
|||
HTTPMessage | |||
HTTPResponse | |||
HTTPConnection | |||
SharedSocket | |||
SharedSocketClient | |||
SSLFile File-like object wrapping an SSL socket. |
|||
FakeSocket | |||
HTTPSConnection This class allows communication via SSL. |
|||
HTTP Compatibility class with httplib.py from 1.5. |
|||
HTTPS Compatibility with 1.5 httplib interface |
|||
HTTPException | |||
NotConnected | |||
InvalidURL | |||
UnknownProtocol | |||
UnknownTransferEncoding | |||
UnimplementedFileMode | |||
IncompleteRead | |||
ImproperConnectionState | |||
CannotSendRequest | |||
CannotSendHeader | |||
ResponseNotReady | |||
BadStatusLine | |||
error | |||
LineAndFileWrapper A limited file-like object for HTTP/0.9 responses. |
|
|||
|
|
|||
HTTP_PORT = 80
|
|||
HTTPS_PORT = 443
|
|||
_UNKNOWN =
|
|||
_CS_IDLE =
|
|||
_CS_REQ_STARTED =
|
|||
_CS_REQ_SENT =
|
|||
CONTINUE = 100
|
|||
SWITCHING_PROTOCOLS = 101
|
|||
PROCESSING = 102
|
|||
OK = 200
|
|||
CREATED = 201
|
|||
ACCEPTED = 202
|
|||
NON_AUTHORITATIVE_INFORMATION = 203
|
|||
NO_CONTENT = 204
|
|||
RESET_CONTENT = 205
|
|||
PARTIAL_CONTENT = 206
|
|||
MULTI_STATUS = 207
|
|||
IM_USED = 226
|
|||
MULTIPLE_CHOICES = 300
|
|||
MOVED_PERMANENTLY = 301
|
|||
FOUND = 302
|
|||
SEE_OTHER = 303
|
|||
NOT_MODIFIED = 304
|
|||
USE_PROXY = 305
|
|||
TEMPORARY_REDIRECT = 307
|
|||
BAD_REQUEST = 400
|
|||
UNAUTHORIZED = 401
|
|||
PAYMENT_REQUIRED = 402
|
|||
FORBIDDEN = 403
|
|||
NOT_FOUND = 404
|
|||
METHOD_NOT_ALLOWED = 405
|
|||
NOT_ACCEPTABLE = 406
|
|||
PROXY_AUTHENTICATION_REQUIRED = 407
|
|||
REQUEST_TIMEOUT = 408
|
|||
CONFLICT = 409
|
|||
GONE = 410
|
|||
LENGTH_REQUIRED = 411
|
|||
PRECONDITION_FAILED = 412
|
|||
REQUEST_ENTITY_TOO_LARGE = 413
|
|||
REQUEST_URI_TOO_LONG = 414
|
|||
UNSUPPORTED_MEDIA_TYPE = 415
|
|||
REQUESTED_RANGE_NOT_SATISFIABLE = 416
|
|||
EXPECTATION_FAILED = 417
|
|||
UNPROCESSABLE_ENTITY = 422
|
|||
LOCKED = 423
|
|||
FAILED_DEPENDENCY = 424
|
|||
UPGRADE_REQUIRED = 426
|
|||
INTERNAL_SERVER_ERROR = 500
|
|||
NOT_IMPLEMENTED = 501
|
|||
BAD_GATEWAY = 502
|
|||
SERVICE_UNAVAILABLE = 503
|
|||
GATEWAY_TIMEOUT = 504
|
|||
HTTP_VERSION_NOT_SUPPORTED = 505
|
|||
INSUFFICIENT_STORAGE = 507
|
|||
NOT_EXTENDED = 510
|
|||
responses =
|
|||
MAXAMOUNT = 1048576
|
Imports: errno, mimetools, socket, urlsplit, StringIO
|
Test this module. A hodge podge of tests collected here, because they have too many external dependencies for the regular test suite. |
|
responses
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Tue Jan 29 22:40:57 2008 | http://epydoc.sourceforge.net |