> On Dec 1, 2007 7:02 PM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote:
>> > > I'm looking for the most minimalist web server ever that does nothing
>> > > else than return a fixed static page for every request. Regardless of
>> > > what the request is, it just needs to be an HTTP request to port 80,
>> > > the web server should return always the same html document. What would
>> > > be the best choice for this? The goal is of course to minimize system
>> > > resources in terms of memory, cpu, etc, etc.
>> >
>> > If you're running linux, maybe you want tux.
>> >
>> > publicfile isn't exactly what you describe, but its description might
>> > be of some interest:
>> >
>> > http://cr.yp.to/publicfile.html
>>
>>
>> Thanks, tux looks good, the only problem is that one needs to
>> recompile the kernel which I really don't want to do (so yes, I'm on
>> linux). Publicfile seems to "know" already too much.
>>
>> The reason I need this is that my current best strategy to avoid ads
>> in web pages is putting all ad server names into /etc/hosts and stick
>> my local ip number next to them (127.0.0.1) so every ad request goes
>> to my machine. I run apache which has an empty page for 404 errors so
>> I'll just see that blank page for every ad. Now I guess apache is a
>> pretty heavy weight guy so I'm looking for a lightweight alternative.
>> Lighttpd, nginx and company are all too complex and "know" too much. I
>> even considered just putting netcat into an infinite loop but I'm
>> afraid if there is a security hole in netcat I might be screwed.
>>
>> Maybe now that I outlined a little more why I need this others can
>> come up with more suggestions.
>>

Running this will start a server on port 80 which will serve files in  
the current folder:

import SimpleHTTPServer
import SocketServer
SocketServer.TCPServer(("",80),SimpleHTTPServer.SimpleHTTPRequestHandler).serve_forever()


Regards,
Ghirai.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to