Files
i2p.itoopie/apps/sam/python/doc/guide/i2p.SimpleHTTPServer.html

88 lines
2.5 KiB
HTML
Raw Normal View History

<!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.SimpleHTTPServer - 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.SimpleHTTPServer</h1><p class='subtitle'>From Python-I2P.
<div class='bodytext'>
Emulates Python SimpleHTTPServer 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-SimpleHTTPServer.html" class='printable' title="http://www.python.org/doc/current/lib/module-SimpleHTTPServer.html">http://www.python.org/doc/current/lib/module-SimpleHTTPServer.html</a>
<p>
To get a server going, use:
<p>
<ul ><pre>
&gt;&gt;&gt; from i2p import SimpleHTTPServer
&gt;&gt;&gt; SimpleHTTPServer.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>
&gt;&gt;&gt; from i2p import BaseHTTPServer, SimpleHTTPServer
&gt;&gt;&gt; session = &quot;mytestxxx.i2p&quot; # SAM session name
&gt;&gt;&gt; class MyServer(BaseHTTPServer.HTTPServer): pass
&gt;&gt;&gt; class MyRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): pass
&gt;&gt;&gt; httpd = MyServer(session, MyRequestHandler)
&gt;&gt;&gt; httpd.socket.dest
(Base64 Destination of server)
&gt;&gt;&gt; httpd.serve_forever()
</pre>
</ul >
<p>
<h2><a name="Classes"> Classes </a></h2>
<p>
class <strong>SimpleHTTPRequestHandler</strong>
<ul ><pre>
Same interface as Python class SimpleHTTPServer.SimpleHTTPRequestHandler.
</pre>
</ul >
<p>
<h2><a name="Functions"> Functions </a></h2>
<p>
<strong>test</strong>(HandlerClass=SimpleHTTPRequestHandler, ServerClass= i2p.BaseHTTPServer.HTTPServer, session='mytestxxx.i2p')
<ul ><pre>
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.
</pre>
</ul >
<p>
</div>
</body></html>