[Twisted-Python] Custom webserver

Vijay Rao vijay at accellion.com
Mon Jun 16 00:27:13 EDT 2003


Hi ,

I am trying to use twisted as a webserver that serves files only for 
requests from the localhost ie the desktop on which it is running by 
mapping localhost(127.0.0.1) to a domain pattern ( thru the hosts file on 
windows ) so that a particular type of URL is served from this webserver.

Can anyone help me with these :

1) How do I refuse to serve any request from any other machine on the 
network ( external or internal ) ie is there any way of finding out from 
where the request originated ( or is it possible to use something like 
.htaccess ) . Currently the directory listing is exposed to any other 
machine that can access the machine.

2) It is easy to set up a web.tap file using mktap web --path 
<pathtoRootDirectory> to serve files but I dont want to map the URL to a 
path on disk directly. Is it possible to override the getChild function of 
static.File ( which is doing the publishing part ) so that certain 
components of the URL can be ignored or re-mapped to a different path on 
local storage. I tried using a .rpy but that seems to be ignored as I guess 
that given the --path argument mktap creates a root Resource which is used 
by the application.

Thanks,
E.Vijay Rao
vijay at accellion.com
http://www.accellion.com









More information about the Twisted-Python mailing list