durusmail: quixote-users: (Another) patch for medusa_http.py
Patch for medusa_http.py
2002-11-04
2002-11-04
2002-11-04
2002-11-04
2002-11-04
2002-11-05
(Another) patch for medusa_http.py
2002-11-06
2002-11-06
2002-11-06
2002-11-06
2002-11-13
2002-11-20
2002-11-20
2002-12-22
(Another) patch for medusa_http.py
Andrew Kuchling
2002-11-06
>I tried the Lawson implementation, with correction from the Corbet one, but
>could not get it to work well: for some reason, the files always come back
>truncated at the first kbyte. :^(

Two possibilities: if you're on Windows and the files are binary data
like JPEGs, be sure they're being opened in binary mode with open(...,
'rb').  Second and more likely, there's a bug in Medusa 0.5.2 that has
similar symptoms.  Try this patch:

Index: producers.py
===================================================================
RCS file: /cvsroot/oedipus/medusa/producers.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- producers.py        25 Mar 2002 13:26:28 -0000      1.5
+++ producers.py        10 Apr 2002 19:40:11 -0000      1.6
@@ -151,12 +151,12 @@

     def more (self):
         while len(self.producers):
-            p = self.producers.pop(0)
+            p = self.producers[0]
             d = p.more()
             if d:
                 return d
             else:
-                self.producers.pop()
+                self.producers.pop(0)
         else:
             return ''


Someone spank me if I don't make a Medusa 0.5.3 release *tonight* to
get this bugfix out; that's a task that's been dangling too long.

>Instead of trying to solve this problem, it dawned on me that Quixote always
>needs a web server in front of it, be it Apache, Medusa, Twisted or whatever
>else, so it makes sense to serve the static files directly through that,
>instead of through Quixote.

Indeed.  Web servers are usually optimized for serving static files,
too; Apache can be made to mmap() commonly-used files directly into
the web server's address space, for example.

--amk                                                             (www.amk.ca)
FORTINBRAS: Go bid the soldiers shoot.
      -- Last line of _Hamlet_, V, ii

reply