Module i2p.BaseHTTPServer
Emulation of Python BaseHTTPServer module using I2P sockets.
The Python module is described at
http://www.python.org/doc/current/lib/module-BaseHTTPServer.html
To get a server going, use:
>>> from i2p import BaseHTTPServer
>>> BaseHTTPServer.test().
Consult the documentation for function test() to change basic server
settings, such as the session name.
A fully customizable example:
>>> from i2p import BaseHTTPServer
>>> session = "mytestxxx.i2p"
>>> class MyServer(BaseHTTPServer.HTTPServer): pass
>>> class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): pass
>>> httpd = MyServer(session, MyRequestHandler)
>>> httpd.socket.dest
(Base64 Destination of server)
>>> httpd.serve_forever()
Classes |
BaseHTTPRequestHandler |
Same interface as Python class
BaseHTTPServer.BaseHTTPRequestHandler. |
HTTPServer |
Same interface as Python class BaseHTTPServer.HTTPServer. |
Function Summary |
|
test (HandlerClass,
ServerClass,
protocol,
session)
Test the HTTP request handler class. |
test(HandlerClass=<class i2p.BaseHTTPServer.BaseHTTPRequestHandler at 0x00A...,
ServerClass=<class i2p.BaseHTTPServer.HTTPServer at 0x00A2D960>,
protocol='HTTP/1.0',
session='mytestxxx.i2p')
Test the HTTP request handler class.
This runs an I2P TCP server under SAM session 'session'. If a single
command line argument is given, the argument is used instead as the SAM
session name.
-
|
__version__
-
- Type:
-
str
- Value:
|
DEFAULT_ERROR_MESSAGE
-
- Type:
-
str
- Value:
'''<head>
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code %(code)d.
<p>Message: %(message)s.
<p>Error code explanation: %(code)s = %(explain)s.
...
|
|