Sun 31 Aug 2003 07:43:51 PM UTC, original submission:
Observable 'effects': Some feeds (although otherwise perfectly valid) are 'empty' (e.g. bug #4958) and some feeds make Straw hang (e.g. bug #4369). Most probably this happens when using a proxy.
(partial) Diagnosis: Described problem manifests itself when a feed data is being sent without 'Content-length' HTTP header field (happens with generated content). After receiving the full header, Straw assumes (URLFetch.py, Consumer::http_header()) there is no more data to read and calls ProxyConsumer::finished_callback(), with effect of parsing empty body data and no items to display. If we change this behaviour, (see solution below) to not to call finished_callback() when 'Content-length' is not present, the function could never be called if proxy (was present, and) decided to keep connection alive...
Solution: This is actually a quick hack to show what the problem is and how to temporally resolve it. And I have never written in Python before... ;)
File: URLFetch.py, Class: Consumer, method: http_header()
line:
if header.getheader('content-length', '0') == '0':
changed to:
if header.getheader('content-length', '-1') == '0':
(It's unlikely that HTTP server will return '-1' as content length, so the value will be compared against when 'Content-length' is not defined)
File: httplib_async.py, Class: HTTPConnection_async, method: request()
before the lines:
if self.proxy and self.proxy_port:
self.path = "http://%s%s" % (self.host, path)
added line:
headers['Proxy-Connection'] = 'Close'
In fact, I do use proxy, and the changes work quite nicely for me, but I didn't consider every possible situation, so this is more an idea of the solution than anything else...
I'm using Debian package 0.19-2, so the part of code in question is practically identical with CVS code.
|