lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

Failure when creating empty attachments #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The following trace occurs when trying to create an empty attachment:

ERROR: test_empty_attachment (couchdb.tests.client.DatabaseTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jason/src/couchdb-python/couchdb/tests/client.py", line 89,
in test_empty_attachment
    self.db.put_attachment(doc, '', 'empty.txt')
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 442, in
put_attachment
    }, rev=doc['_rev'])
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 834, in put
    **params)
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 860, in
_request
    resp, data = _make_request()
  File "/home/jason/src/couchdb-python/couchdb/client.py", line 855, in
_make_request
    body=body, headers=headers)
  File "build/bdist.linux-i686/egg/httplib2/__init__.py", line 1050, in request
  File "build/bdist.linux-i686/egg/httplib2/__init__.py", line 854, in _request
  File "build/bdist.linux-i686/egg/httplib2/__init__.py", line 824, in
_conn_request
  File "/usr/lib/python2.5/httplib.py", line 928, in getresponse
    response.begin()
  File "/usr/lib/python2.5/httplib.py", line 385, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.5/httplib.py", line 349, in _read_status
    raise BadStatusLine(line)
BadStatusLine

It seems that httplib doesn't send a Content-Length header when the content
body is ''.  The attached patch contains a test and also a one-line fix
that simply adds the Content-Length header.

Original issue reported on code.google.com by jason.da...@gmail.com on 25 Nov 2008 at 7:47

Attachments:

GoogleCodeExporter commented 8 years ago
Note: this patch is needed for my CouchDB-FUSE filesystem stuff to work; 
otherwise it
has no way to create empty files.

Original comment by jason.da...@gmail.com on 26 Nov 2008 at 8:22

GoogleCodeExporter commented 8 years ago
Patch applied in r125. Thanks!

Original comment by cmlenz on 26 Nov 2008 at 8:20

GoogleCodeExporter commented 8 years ago
This issue was closed by revision ec96955ec2.

Original comment by djc.ochtman on 3 Dec 2009 at 9:51