One Time Web Server

OneTimeWebServer holds a single "page" in memory, serves it to the first visitor, and evaporates.

Let's try to remake OneTimeWebServer products. And let's enjoy the variety of OneTimeWebServer.

 #!/usr/bin/env python2.3

from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import sys,os class handler(BaseHTTPRequestHandler): def do_GET(self): global t self.send_response(200) self.send_header('content-length',len(t)) self.send_header('content-encoding','UTF-8') self.send_header('content-type',('text/plain','text/html')[t[0] == '<']) self.end_headers() print >>self.wfile,t os._exit(0)

t = or 'one time web server' try: p = int(sys.argv[1]) except: p = 0 httpd = HTTPServer(('',p),handler) print '> http://%s:%d/' % (httpd.server_name,httpd.server_port) httpd.serve_forever()

Anyone want to provide a C version?

Very nice. I'm not sure how much use it is, but it's very nice.

Sounds like a hacker/security pattern. Perhaps. Could be used to provide very specific, personal, and confidential information to a single browser.

Do you mean "cracker"? I don't think so, although I suppose there is a use in such a realm.

Not cracker - because this would be setup server-side, right? So some sysadmin might want a disappearing backdoor for something - just in case - maybe it lets you issue one command-line command, and then disappears until you can set up the vanishing web server locally. . . Hacker in that context means "someone who needs/makes a quick hack to get something to work" - not someone who breaks into others' systems.

Couple this with ZeroConf and we have something...
What is the term for this kind of technique? It's not quite a pattern, maybe a trick, not really a feature. . .What are neat little pattern/feature/tricks like this called?

Seems to fall into the same category as NullObject and MockObjects? where you more or less hack an object to temporarily stand in for something greater, which just now simply is not (yet) there.

View edit of September 6, 2005 or FindPage with title or text search