Package ganeti :: Package http :: Module server :: Class HttpServerRequestExecutor
[hide private]
[frames] | no frames]

Class HttpServerRequestExecutor

source code


Implements server side of HTTP.

This class implements the server side of HTTP. It's based on code of Python's BaseHTTPServer, from both version 2.4 and 3k. It does not support non-ASCII character encodings. Keep-alive connections are not supported.

Instance Methods [hide private]
 
__init__(self, server, sock, client_addr)
Initializes this class.
source code
 
_ReadRequest(self)
Reads a request sent by client.
source code
 
_HandleRequest(self)
Calls the handler function for the current request.
source code
 
_SendResponse(self)
Sends the response to the client.
source code
 
_SetErrorStatus(self, err)
Sets the response code and body from a HttpException.
source code
string
_FormatErrorMessage(self, values)
Formats the body of an error message.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  default_request_version = "HTTP/0.9"
  error_message_format = "...
  error_content_type = "text/html"
  responses = BaseHTTPServer.BaseHTTPRequestHandler.responses
  WRITE_TIMEOUT = 10
  READ_TIMEOUT = 10
  CLOSE_TIMEOUT = 1
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, server, sock, client_addr)
(Constructor)

source code 

Initializes this class.

Overrides: object.__init__

_SetErrorStatus(self, err)

source code 

Sets the response code and body from a HttpException.

Parameters:
  • err (HttpException) - Exception instance

_FormatErrorMessage(self, values)

source code 

Formats the body of an error message.

Parameters:
  • values (dict) - dictionary with keys code, message and explain.
Returns: string
the body of the message

Class Variable Details [hide private]

error_message_format

Value:
"""\
<html>
<head>
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code %(code)d.
...