Package i2p :: Module SimpleHTTPServer
[show private | hide private]
[frames | no frames]

Module i2p.SimpleHTTPServer

Emulation of Python SimpleHTTPServer module using I2P sockets.

The Python module is described at http://www.python.org/doc/current/lib/module-SimpleHTTPServer.html

To get a server going, use:
>>> from i2p import SimpleHTTPServer
>>> SimpleHTTPServer.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, SimpleHTTPServer
>>> session = "mytestxxx.i2p"      # SAM session name
>>> class MyServer(BaseHTTPServer.HTTPServer): pass
>>> class MyRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): pass
>>> httpd = MyServer(session, MyRequestHandler)
>>> httpd.socket.dest
(Base64 Destination of server)

>>> httpd.serve_forever()

Classes
SimpleHTTPRequestHandler Same interface as Python class SimpleHTTPServer.SimpleHTTPRequestHandler.

Function Summary
  test(HandlerClass, ServerClass, session)
Test the HTTP simple request handler class.

Function Details

test(HandlerClass=<class i2p.SimpleHTTPServer.SimpleHTTPRequestHandler at 0..., ServerClass=<class i2p.BaseHTTPServer.HTTPServer at 0x00A2D960>, session='mytestxxx.i2p')

Test the HTTP simple 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.

Generated by Epydoc 2.1 on Mon Aug 02 01:07:41 2004 http://epydoc.sf.net