Package: pyblosxom
Version: 1.2.1-2
Severity: normal
Tags: patch

When handling HTTP POST requests, PyBlosxom doesn't honor CONTENT_LENGTH
CGI variable and expects EOF.  Some HTTP servers (like bozohttpd)
doesn't send EOF at the end of the body.  Although inconvenient, this
behaviour is compliant to CGI 1.1 specification [1]:

    The server will send CONTENT_LENGTH bytes on this file
    descriptor. Remember that it will give the CONTENT_TYPE of the data
    as well. The server is in no way obligated to send end-of-file after
    the script reads CONTENT_LENGTH bytes.

PyBosxom hangs (seems to wait for EOF forever) when handling POST
requests -- a very common case when comments plugin is used.  This is
the same problem described in SF.net bug #1184799 [2], just experienced
with different HTTP server -- bozohttpd instead of Twisted.

[1] http://hoohoo.ncsa.uiuc.edu/cgi/in.html
[2] 
http://sourceforge.net/tracker/index.php?func=detail&aid=1184799&group_id=67445&atid=517918

So, I suggest the following patch:

--- pyblosxom.py
+++ pyblosxom.py
@@ -413,5 +413,5 @@
         if self.getHttp()["REQUEST_METHOD"] == "POST":
             input = self.getHttp()['wsgi.input']
-            self._in.write(input.read())
+            self._in.write(input.read(int(self.getHttp()["CONTENT_LENGTH"])))
         elif self.getHttp()["REQUEST_METHOD"] == "GET":
             self._in.write(self.getHttp()["QUERY_STRING"])


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-1-686
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)

Versions of packages pyblosxom depends on:
ii  bozohttpd [httpd]             20050410-2 Bozotic HTTP server
ii  python                        2.3.5-3    An interactive high-level object-o
ii  python2.3                     2.3.5-8    An interactive high-level object-o

pyblosxom recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to