First, I wanted to thank Andrew Kuchling for taking upon the maintenance of
Medusa. It brought back fond memories of days passed debugging the bowels of
Zope, wrestling with IIS and the MIME RFC... but that's a story for another
day, sorry for digressing. :^)
I installed Medusa, configured medusa_http.py and presto, everything worked.
Soon I noticed that it wasn't using the logs, so I added the needed calls to
the main() function. Then I stumbled into a small bug, and copied a line
from Publisher.parse_request to squash it, don't know if it's the correct
way, but it worked.
Please find all the above mods into the attached patch to medusa_http.py .
Two things I noticed: Quixote behind Medusa records the errors in the debug
log instead of the error log; furthermore, one needs to restart Medusa every
time the code is modified, since it seems to keep the compiled Python code
cached in memory. It may be obvious, but for a while I was mystified.
One last thing. Running under Medusa, a way to send out static files is
needed. Two implementations are present in the mailing list archive, at
these URLs:
http://mail.mems-exchange.org/pipermail/quixote-users/2002-September/000788.html
(courtesy of Hamish Lawson)
http://mail.mems-exchange.org/pipermail/quixote-users/2002-September/000792.html
(courtesy of Jon Corbet, from whom we're all still awaiting some fragment of
the LWN code ;^) )
Any chance of something similar landing into the codebase?
--
"We should forget about small efficiencies, about 97% of the time.
Premature optimization is the root of all evil." Donald Knuth
Nicola Larosa - nico@tekNico.net
--- medusa_http.py Mon Aug 5 18:41:57 2002
+++ medusa_http.py.new Mon Nov 4 14:56:10 2002
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
"""quixote.server.medusa_http
An HTTP handler for Medusa that publishes a Quixote application.
@@ -7,7 +9,7 @@
# A simple HTTP server, using Medusa, that publishes a Quixote application.
-import asyncore, rfc822, socket
+import asyncore, rfc822, socket, time
from StringIO import StringIO
from medusa import http_server, xmlrpc_handler
from quixote.http_request import HTTPRequest
@@ -63,6 +65,7 @@
stdin = StringIO(data)
qreq = HTTPRequest(stdin, environ)
+ self.publisher.start_time = time.time()
qreq.process_inputs()
output = self.publisher.process_request(qreq, environ)
if output:
@@ -100,6 +103,8 @@
print 'Now serving the Quixote demo on port 8080'
server = http_server.http_server('', 8080)
publisher = Publisher('quixote.demo')
+ publisher.read_config("demo.conf")
+ publisher.setup_logs()
dh = QuixoteHandler(publisher, 'Quixote/demo', server)
server.install_handler(dh)
asyncore.loop()