lanto03 / couchdb-python

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

Missing content-length fails for empty put #90

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using couchdb server version 0.9.0
2. Using couchdb-python version 0.6
3. Create a database against server using couchdb-python 'server.create()'

What is the expected output? What do you see instead?

>> This should create a database and return the connection to it.  A server
exception is thrown with status 411, no content length specified.

What version of the product are you using? On what operating system?

>> Couchdb 0.9.0 on Linux, coucdb-python 0.6 on windows, running in jython 2.5.

Please provide any additional information below.

>> Here is a stack trace:

File ".\receipts.py" in open_receipts
  20.         conn = SERVER.create('receipts')
File
"...\jython-2.5\Lib\site-packages\couchdb-0.6-py2.5.egg\couchdb\client.py"
in create
  200.         self.resource.put(validate_dbname(name))
File
"...\jython-2.5\Lib\site-packages\couchdb-0.6-py2.5.egg\couchdb\client.py"
in put
  984.         return self._request('PUT', path, content=content,
headers=headers,
File
"...\jython-2.5\Lib\site-packages\couchdb-0.6-py2.5.egg\couchdb\client.py"
in _request
  1031.                 raise ServerError((status_code, error))

Exception Type: ServerError at /select
Exception Value: (411, '<html>\r\n<head><title>411 Length
Required</title></head>\r\n<body bgcolor="white">\r\n<center><h1>411 Length
Required</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n')

>> Firstly I assume that creating a new database is a simple 'put' without
any body.  In this case it should be appropriate to include a
content-length of '0'.  Perhaps change Resource._request to call
headers.setdefault('Content-Length', '0') when the conditional at line 994
has 'content' of None.  My knowledge of couchdb is limited, but it may also
require the content-type to be set, even if the content is empty.

Original issue reported on code.google.com by david.co...@gmail.com on 16 Sep 2009 at 3:53

GoogleCodeExporter commented 8 years ago
This seems bogus. It works for other people, and CouchDB would never return 
HTML as
an error message. Please re-open if you still think something's wrong on our 
end.

Original comment by djc.ochtman on 8 Dec 2009 at 5:52