Roundup Tracker - Issues

Message8257

Author cmeerw
Recipients cmeerw, rouilj
Date 2025-01-11.18:00:26
Message-id <1736618427.26.0.360003187294.issue2551387@roundup.psfhosted.org>
In-reply-to
Didn't think it would make a difference how I am running it, but it apparently does. Using 
roundup 2.4.0 with wsgi_handler (via flup). I don't see the issue with the built-in server 
from demo.py.

So the reason appears to be that in wsgi_handler.py we have

        if environ['REQUEST_METHOD'] in ("OPTIONS", "DELETE"):
            # these methods have no data. When we init tracker.Client
            # set form to None to get a properly initialized empty
            # form.
            form = None
        else:
            form = BinaryFieldStorage(fp=environ['wsgi.input'], environ=environ)

but in client.py we have

        # see if we need to re-parse the environment for the form (eg Zope)
        if form is None:
            # cgi.FieldStorage doesn't special case OPTIONS, DELETE or
            # PATCH verbs. They are processed like POST. So FieldStorage
            # hangs on these verbs trying to read posted data that
            # will never arrive.
            # If not defined, set CONTENT_LENGTH to 0 so it doesn't
            # hang reading the data.
            if self.env['REQUEST_METHOD'] in ['OPTIONS', 'DELETE', 'PATCH'] \
                and 'CONTENT_LENGTH' not in self.env:
                self.env['CONTENT_LENGTH'] = 0
                logger.debug("Setting CONTENT_LENGTH to 0 for method: %s",
                             self.env['REQUEST_METHOD'])

            # cgi.FieldStorage must save all data as
            # binary/bytes. Subclass BinaryFieldStorage does this.
            # It's a workaround for a bug in cgi.FieldStorage. See class
            # def for details.
            self.form = BinaryFieldStorage(fp=request.rfile, environ=env)
            # In some case (e.g. content-type application/xml), cgi
            # will not parse anything. Fake a list property in this case
            if self.form.list is None:
                self.form.list = []
        else:
            self.form = form

So in the wsgi case we end up with self.form.list == None, but in the demo.py case that's 
being set to self.form.list = []

And then we get the exception in the wsgi case only.
History
Date User Action Args
2025-01-11 18:00:27cmeerwsetmessageid: <1736618427.26.0.360003187294.issue2551387@roundup.psfhosted.org>
2025-01-11 18:00:27cmeerwsetrecipients: + cmeerw, rouilj
2025-01-11 18:00:27cmeerwlinkissue2551387 messages
2025-01-11 18:00:26cmeerwcreate