tests.start_relay_server
index
start_relay_server.py

This is a really basic CGI server that allows you to test the really basic
Relay CGI script, by specifying the following region in your scripts:
 
    region='relay=http://localhost:8000/cgi-bin/fgcp_relay.py'
 
In order to use this CGI server for relay testing, you need to adapt the lines
    pem_file = '../client.pem'
    region = 'de'
at the bottom of this script, and specify your own certificate and
region there

 
Modules
       
http
future.standard_library

 
Classes
       
CGIHTTPServer.CGIHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler)
FGCPRelayHTTPRequestHandler
future.types.newobject.newobject(__builtin__.object)
FGCPRelayConfig

 
class FGCPRelayConfig(future.types.newobject.newobject)
    The actual relay configuration is specified at startup
 
 
Method resolution order:
FGCPRelayConfig
future.types.newobject.newobject
__builtin__.object

Data and other attributes defined here:
key_file = 'client.pem'
region = 'uk'

Methods inherited from future.types.newobject.newobject:
__long__(self)
__native__(self)
Hook for the future.utils.native() function
__nonzero__(self)
__unicode__(self)
next(self)

Data descriptors inherited from future.types.newobject.newobject:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class FGCPRelayHTTPRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler)
    Override the default CGIHTTPRequestHandler to run the relay script here
 
 
Method resolution order:
FGCPRelayHTTPRequestHandler
CGIHTTPServer.CGIHTTPRequestHandler
SimpleHTTPServer.SimpleHTTPRequestHandler
BaseHTTPServer.BaseHTTPRequestHandler
SocketServer.StreamRequestHandler
SocketServer.BaseRequestHandler

Methods defined here:
do_POST(self)
Version of do_POST() that runs the relay script in place
is_cgi(self)
Version of is_cgi() that only supports the relay CGI script
run_cgi_local(self)
Version of run_cgi() that runs the relay script in place
send_head(self)
Version of send_head() that only supports CGI scripts

Methods inherited from CGIHTTPServer.CGIHTTPRequestHandler:
is_executable(self, path)
Test whether argument path is an executable file.
is_python(self, path)
Test whether argument path is a Python script.
run_cgi(self)
Execute a CGI script.

Data and other attributes inherited from CGIHTTPServer.CGIHTTPRequestHandler:
cgi_directories = ['/cgi-bin', '/htbin']
have_fork = False
have_popen2 = True
have_popen3 = True
rbufsize = 0

Methods inherited from SimpleHTTPServer.SimpleHTTPRequestHandler:
copyfile(self, source, outputfile)
Copy all data between two file objects.
 
The SOURCE argument is a file object open for reading
(or anything with a read() method) and the DESTINATION
argument is a file object open for writing (or
anything with a write() method).
 
The only reason for overriding this would be to change
the block size or perhaps to replace newlines by CRLF
-- note however that this the default server uses this
to copy binary data as well.
do_GET(self)
Serve a GET request.
do_HEAD(self)
Serve a HEAD request.
guess_type(self, path)
Guess the type of a file.
 
Argument is a PATH (a filename).
 
Return value is a string of the form type/subtype,
usable for a MIME Content-type header.
 
The default implementation looks the file's extension
up in the table self.extensions_map, using application/octet-stream
as a default; however it would be permissible (if
slow) to look inside the data to make a better guess.
list_directory(self, path)
Helper to produce a directory listing (absent index.html).
 
Return value is either a file object, or None (indicating an
error).  In either case, the headers are sent, making the
interface the same as for send_head().
translate_path(self, path)
Translate a /-separated PATH to the local filename syntax.
 
Components that mean special things to the local file system
(e.g. drive or directory names) are ignored.  (XXX They should
probably be diagnosed.)

Data and other attributes inherited from SimpleHTTPServer.SimpleHTTPRequestHandler:
extensions_map = {'': 'application/octet-stream', '.3g2': 'video/3gpp2', '.3gp': 'video/3gpp', '.3gp2': 'video/3gpp2', '.3gpp': 'video/3gpp', '.AAC': 'audio/vnd.dlna.adts', '.ADT': 'audio/vnd.dlna.adts', '.ADTS': 'audio/vnd.dlna.adts', '.AddIn': 'text/xml', '.WMD': 'application/x-ms-wmd', ...}
server_version = 'SimpleHTTP/0.6'

Methods inherited from BaseHTTPServer.BaseHTTPRequestHandler:
address_string(self)
Return the client address formatted for logging.
 
This version looks up the full hostname using gethostbyaddr(),
and tries to find a name that contains at least one dot.
date_time_string(self, timestamp=None)
Return the current date and time formatted for a message header.
end_headers(self)
Send the blank line ending the MIME headers.
handle(self)
Handle multiple requests if necessary.
handle_one_request(self)
Handle a single HTTP request.
 
You normally don't need to override this method; see the class
__doc__ string for information on how to handle specific HTTP
commands such as GET and POST.
log_date_time_string(self)
Return the current time formatted for logging.
log_error(self, format, *args)
Log an error.
 
This is called when a request cannot be fulfilled.  By
default it passes the message on to log_message().
 
Arguments are the same as for log_message().
 
XXX This should go to the separate error log.
log_message(self, format, *args)
Log an arbitrary message.
 
This is used by all other logging functions.  Override
it if you have specific logging wishes.
 
The first argument, FORMAT, is a format string for the
message to be logged.  If the format string contains
any % escapes requiring parameters, they should be
specified as subsequent arguments (it's just like
printf!).
 
The client ip address and current date/time are prefixed to every
message.
log_request(self, code='-', size='-')
Log an accepted request.
 
This is called by send_response().
parse_request(self)
Parse a request (internal).
 
The request should be stored in self.raw_requestline; the results
are in self.command, self.path, self.request_version and
self.headers.
 
Return True for success, False for failure; on failure, an
error is sent back.
send_error(self, code, message=None)
Send and log an error reply.
 
Arguments are the error code, and a detailed message.
The detailed message defaults to the short entry matching the
response code.
 
This sends an error response (so it must be called before any
output has been generated), logs the error, and finally sends
a piece of HTML explaining the error to the user.
send_header(self, keyword, value)
Send a MIME header.
send_response(self, code, message=None)
Send the response header and log the response code.
 
Also send two standard headers with the server software
version and the current date.
version_string(self)
Return the server software version string.

Data and other attributes inherited from BaseHTTPServer.BaseHTTPRequestHandler:
MessageClass = <class mimetools.Message>
default_request_version = 'HTTP/0.9'
error_content_type = 'text/html'
error_message_format = '<head>\n<title>Error response</title>\n</head>\n<bo...ode explanation: %(code)s = %(explain)s.\n</body>\n'
monthname = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
protocol_version = 'HTTP/1.0'
responses = {100: ('Continue', 'Request received, please continue'), 101: ('Switching Protocols', 'Switching to new protocol; obey Upgrade header'), 200: ('OK', 'Request fulfilled, document follows'), 201: ('Created', 'Document created, URL follows'), 202: ('Accepted', 'Request accepted, processing continues off-line'), 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), 204: ('No Content', 'Request fulfilled, nothing follows'), 205: ('Reset Content', 'Clear input form for further input.'), 206: ('Partial Content', 'Partial content follows.'), 300: ('Multiple Choices', 'Object has several resources -- see URI list'), ...}
sys_version = 'Python/2.7.15'
weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']

Methods inherited from SocketServer.StreamRequestHandler:
finish(self)
setup(self)

Data and other attributes inherited from SocketServer.StreamRequestHandler:
disable_nagle_algorithm = False
timeout = None
wbufsize = 0

Methods inherited from SocketServer.BaseRequestHandler:
__init__(self, request, client_address, server)

 
Functions
       
run_relay_server(key_file, region)

 
Data
        FGCP_RELAY_CONFIG = <tests.start_relay_server.FGCPRelayConfig object>
print_function = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 65536)