Hi all,
I spent some time today bashing on a rewrite of the PyWX adapter for
Webware (which none of you have ever seen, anyway ;). I have some
questions for y'all.
Some background: PyWX is an embedding of Python in AOLserver, a
high-performance multi-threaded Web server. The goal of the PyWX
adapter for Webware is to run an actual ApplicationServer inside of
PyWX, so that you avoid the latencies of communicating with the AppServer.
The main code is below. This code goes in a file that is imported once, at
the start of the Web server; 'handle' is called once for every connection
under '/w/' on the server.
============================================
class PyWXAppServer(AppServer):
def isPersistent(self):
return 1
def dispatchRawRequest(self, newRequestDict, strmOut):
return self._app.dispatchRawRequest(newRequestDict, strmOut)
appServer = PyWXAppServer() # start the AppServer
def handle(conn):
# get a handle to the AOLserver connection that looks like a file handle
buff = PyWX_buffer.GetBuff()
# Create a fake CGI-like environment to pass in to Webware:
env = {}
ns_setup.create_cgi_environ(conn, env)
env['SCRIPT_NAME'] = '/w'
env['PATH_INFO'] = conn.request.url[2:]
# Create the dictionary that 'we
d = {}
d['format'] = 'CGI'
d['time'] = asctime(localtime(time()))
d['environ'] = env
d['input'] = buff.read()
# Create an output stream for the app server:
out = ASStreamOut()
# Call the app server
appServer.dispatchRawRequest(d, out)
# Output the results!
buff.write(out._buffer)
buff.close()
============================================
OK, so a couple of questions (because I'm lazy and sick of reading
code today ;):
* what's the most efficient way to pass information in to Webware? What
are the various formats (d['format'], above) that can be used,
and which one should I use?
* what the hell is ASStreamOut for? (OK, that's somewhat rhetorical - I know
what it's for, but if someone could give me a one-paragraph history
of why it's needed, I would appreciate it.)
* I can't get PushServlet to work. What is it supposed to do? What am I
screwing up?
Err, I guess that's it. I would welcome any suggestions; I sort of hacked
this together today after working on some other things, and so I'm aware it's
probably not optimal. Let's make it optimal! -- this should easily be faster
than any other Webware adapter, because it's all running in-process...
--titus
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss