90 lines
2.5 KiB
HTML
90 lines
2.5 KiB
HTML
![]() |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||
|
<html lang="en"><head><title>User's Guide:i2p.CGIHTTPServer - Wikipedia</title>
|
||
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||
|
<meta name="robots" content="index,follow">
|
||
|
<link rel="shortcut icon" href="/favicon.ico">
|
||
|
<style type='text/css'><!--
|
||
|
/*/*/
|
||
|
a.new, #quickbar a.new { color: #CC2200; }
|
||
|
#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }
|
||
|
#article { margin-left: 152px; margin-right: 4px; }
|
||
|
/* */
|
||
|
//--></style>
|
||
|
</head>
|
||
|
|
||
|
<body bgcolor='#FFFFFF' onload=''>
|
||
|
<h1 class='pagetitle'>User's Guide:i2p.CGIHTTPServer</h1><p class='subtitle'>From Python-I2P.
|
||
|
|
||
|
|
||
|
<div class='bodytext'>
|
||
|
Module <code >i2p.CGIHTTPServer</code > emulates the Python CGIHTTPServer module using I2P sockets.
|
||
|
|
||
|
|
||
|
<p>
|
||
|
|
||
|
<h2><a name="Overview"> Overview </a></h2>
|
||
|
|
||
|
<p>
|
||
|
The Python module is described at <a href="http://www.python.org/doc/current/lib/module-CGIHTTPServer.html" class='printable' title="http://www.python.org/doc/current/lib/module-CGIHTTPServer.html">http://www.python.org/doc/current/lib/module-CGIHTTPServer.html</a>
|
||
|
|
||
|
<p>
|
||
|
To get a server going, use:
|
||
|
|
||
|
<p>
|
||
|
<ul ><pre>
|
||
|
>>> from i2p import CGIHTTPServer
|
||
|
>>> CGIHTTPServer.test().
|
||
|
</pre>
|
||
|
</ul >
|
||
|
|
||
|
<p>
|
||
|
Consult the documentation for function test() to change basic server settings, such as the session name.
|
||
|
|
||
|
<p>
|
||
|
A fully customizable example:
|
||
|
|
||
|
<p>
|
||
|
<ul ><pre>
|
||
|
>>> from i2p import BaseHTTPServer, CGIHTTPServer
|
||
|
>>> session = "mytestxxx.i2p" # SAM session name
|
||
|
>>> class MyServer(BaseHTTPServer.HTTPServer): pass
|
||
|
>>> class MyRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler): pass
|
||
|
>>> httpd = MyServer(session, MyRequestHandler)
|
||
|
>>> httpd.socket.dest
|
||
|
(Base64 Destination of server)
|
||
|
>>> httpd.serve_forever()
|
||
|
</pre>
|
||
|
</ul >
|
||
|
|
||
|
<p>
|
||
|
|
||
|
<h2><a name="Classes"> Classes </a></h2>
|
||
|
|
||
|
<p>
|
||
|
class <strong>CGIHTTPRequestHandler</strong>
|
||
|
<ul ><pre>
|
||
|
Same interface as Python class CGIHTTPServer.CGIHTTPRequestHandler.
|
||
|
</pre>
|
||
|
</ul >
|
||
|
|
||
|
<p>
|
||
|
|
||
|
<h2><a name="Functions"> Functions </a></h2>
|
||
|
|
||
|
<p>
|
||
|
|
||
|
<strong>test</strong>(HandlerClass=CGIHTTPRequestHandler,
|
||
|
ServerClass=i2p.BaseHTTPServer.HTTPServer,
|
||
|
session='mytestxxx.i2p')
|
||
|
<ul ><pre>
|
||
|
Test the HTTP CGI 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.
|
||
|
</pre>
|
||
|
</ul >
|
||
|
|
||
|
<p>
|
||
|
</div>
|
||
|
</body></html>
|