Mat
unread,Feb 6, 2009, 11:56:51 AM2/6/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scrapy-users
Amazing how you fix the problem immediately after posting about it. A
short walk does wonders for fixing problems!
It seems that Twisted's HTTPClientFactory sets Content-Length unless
body is None. Scrapy explicitly changes a Request body from None to an
empty string in scrapy.http.request. Patch to resolve this follows,
but I am unsure of its wider effect.
Index: __init__.py
===================================================================
--- __init__.py (revision 826)
+++ __init__.py (working copy)
@@ -49,7 +49,7 @@
elif isinstance(body, unicode):
self._body = body.encode(self.encoding)
elif body is None:
- self._body = ''
+ self._body = None
else:
raise TypeError("Request body must either str or unicode.
Got: '%s'" % type(body).__name__)
body = property(lambda x: x._body, set_body)