package documentation

HTTP module.

Module auth HTTP authentication module.
Module client HTTP client module.
Module server HTTP server module.

From __init__.py:

Class HttpBase Base class for HTTP server and client.
Class HttpClientToServerStartLine Data structure for HTTP request start line.
Class HttpMessage Data structure for HTTP message.
Class HttpMessageReader Reads HTTP message from socket.
Class HttpMessageWriter Writes an HTTP message to a socket.
Class HttpServerToClientStartLine Data structure for HTTP response start line.
Class HttpSslParams Data class for SSL key and certificate.
Exception HttpBadGateway 502 Bad Gateway
Exception HttpBadRequest 400 Bad Request
Exception HttpConflict 409 Conflict
Exception HttpConnectionClosed Internal exception for a closed connection.
Exception HttpError Internal exception for HTTP errors.
Exception HttpException Undocumented
Exception HttpForbidden 403 Forbidden
Exception HttpGatewayTimeout 504 Gateway Timeout
Exception HttpGone 410 Gone
Exception HttpInternalServerError 500 Internal Server Error
Exception HttpLengthRequired 411 Length Required
Exception HttpMethodNotAllowed 405 Method Not Allowed
Exception HttpNotAcceptable 406 Not Acceptable
Exception HttpNotFound 404 Not Found
Exception HttpNotImplemented 501 Not Implemented
Exception HttpPreconditionFailed 412 Precondition Failed
Exception HttpRequestTimeout 408 Request Timeout
Exception HttpServiceUnavailable 503 Service Unavailable
Exception HttpSessionHandshakeUnexpectedEOF Internal exception for errors during SSL handshake.
Exception HttpSocketTimeout Internal exception for socket timeouts.
Exception HttpUnauthorized 401 Unauthorized
Exception HttpUnsupportedMediaType 415 Unsupported Media Type
Exception HttpVersionNotSupported 505 HTTP Version Not Supported
Function Handshake Shakes peer's hands.
Function ParseHeaders Parses HTTP headers.
Function ShutdownConnection Closes the connection.
Function SocketOperation Wrapper around socket functions.
Constant HTTP_0_9 Undocumented
Constant HTTP_1_0 Undocumented
Constant HTTP_1_1 Undocumented
Constant HTTP_ALLOW Undocumented
Constant HTTP_APP_JSON Undocumented
Constant HTTP_APP_OCTET_STREAM Undocumented
Constant HTTP_AUTHENTICATION_INFO Undocumented
Constant HTTP_AUTHORIZATION Undocumented
Constant HTTP_CONNECTION Undocumented
Constant HTTP_CONTENT_LENGTH Undocumented
Constant HTTP_CONTENT_TYPE Undocumented
Constant HTTP_DATE Undocumented
Constant HTTP_DELETE Undocumented
Constant HTTP_ETAG Undocumented
Constant HTTP_GANETI_VERSION Undocumented
Constant HTTP_GET Undocumented
Constant HTTP_HEAD Undocumented
Constant HTTP_HOST Undocumented
Constant HTTP_KEEP_ALIVE Undocumented
Constant HTTP_NO_CONTENT Undocumented
Constant HTTP_NOT_MODIFIED Undocumented
Constant HTTP_OK Undocumented
Constant HTTP_POST Undocumented
Constant HTTP_PUT Undocumented
Constant HTTP_SERVER Undocumented
Constant HTTP_USER_AGENT Undocumented
Constant HTTP_WWW_AUTHENTICATE Undocumented
Constant SOCK_BUF_SIZE Undocumented
Constant SOCKOP_HANDSHAKE Undocumented
Constant SOCKOP_RECV Undocumented
Constant SOCKOP_SEND Undocumented
Constant SOCKOP_SHUTDOWN Undocumented
Constant _SSL_SHUTDOWN_DURING_INIT Undocumented
Constant _SSL_UNEXPECTED_EOF Undocumented
HTTP_GANETI_VERSION =

Undocumented

Value
'Ganeti %s'%constants.RELEASE_VERSION
HTTP_OK: int =

Undocumented

Value
200
HTTP_NO_CONTENT: int =

Undocumented

Value
204
HTTP_NOT_MODIFIED: int =

Undocumented

Value
304
HTTP_0_9: str =

Undocumented

Value
'HTTP/0.9'
HTTP_1_0: str =

Undocumented

Value
'HTTP/1.0'
HTTP_1_1: str =

Undocumented

Value
'HTTP/1.1'
HTTP_GET: str =

Undocumented

Value
'GET'
HTTP_HEAD: str =

Undocumented

Value
'HEAD'
HTTP_POST: str =

Undocumented

Value
'POST'
HTTP_PUT: str =

Undocumented

Value
'PUT'
HTTP_DELETE: str =

Undocumented

Value
'DELETE'
HTTP_ETAG: str =

Undocumented

Value
'ETag'
HTTP_HOST: str =

Undocumented

Value
'Host'
HTTP_SERVER: str =

Undocumented

Value
'Server'
HTTP_DATE: str =

Undocumented

Value
'Date'
HTTP_USER_AGENT: str =

Undocumented

Value
'User-Agent'
HTTP_CONTENT_TYPE: str =

Undocumented

Value
'Content-Type'
HTTP_CONTENT_LENGTH: str =

Undocumented

Value
'Content-Length'
HTTP_CONNECTION: str =

Undocumented

Value
'Connection'
HTTP_KEEP_ALIVE: str =

Undocumented

Value
'Keep-Alive'
HTTP_WWW_AUTHENTICATE: str =

Undocumented

Value
'WWW-Authenticate'
HTTP_AUTHORIZATION: str =

Undocumented

Value
'Authorization'
HTTP_AUTHENTICATION_INFO: str =

Undocumented

Value
'Authentication-Info'
HTTP_ALLOW: str =

Undocumented

Value
'Allow'
HTTP_APP_OCTET_STREAM: str =

Undocumented

Value
'application/octet-stream'
HTTP_APP_JSON: str =

Undocumented

Value
'application/json'
_SSL_UNEXPECTED_EOF: str =

Undocumented

Value
'Unexpected EOF'
_SSL_SHUTDOWN_DURING_INIT: tuple[str, ...] =

Undocumented

Value
('SSL routines', 'SSL_shutdown', 'shutdown while in init')
SOCKOP_SEND =

Undocumented

SOCKOP_RECV =

Undocumented

SOCKOP_SHUTDOWN =

Undocumented

SOCKOP_HANDSHAKE =

Undocumented

SOCK_BUF_SIZE: int =

Undocumented

Value
32768
def ParseHeaders(buf):

Parses HTTP headers.

Note
This is just a trivial wrapper around email.message_from_file
def SocketOperation(sock, op, arg1, timeout):

Wrapper around socket functions.

This function abstracts error handling for socket operations, especially for the complicated interaction with OpenSSL.

Parameters
sock:socketSocket for the operation
op:intOperation to execute (SOCKOP_* constants)
arg1:anyParameter for function (if needed)
timeout:None or floatTimeout in seconds or None
Returns
Return value of socket function
def ShutdownConnection(sock, close_timeout, write_timeout, msgreader, force):

Closes the connection.

Parameters
sock:socketSocket to be shut down
close_timeout:floatHow long to wait for the peer to close the connection
write_timeout:floatWrite timeout for shutdown
msgreader:http.HttpMessageReaderRequest message reader, used to determine whether peer should close connection
force:boolWhether to forcibly close the connection without waiting for peer
def Handshake(sock, write_timeout):

Shakes peer's hands.

Parameters
sock:socketSocket to be shut down
write_timeout:floatWrite timeout for handshake