javascript error in list function causes "curl: (56) Received problem 2 in the 
chunky parser"
---------------------------------------------------------------------------------------------

                 Key: COUCHDB-1122
                 URL: https://issues.apache.org/jira/browse/COUCHDB-1122
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
    Affects Versions: 1.0.2
         Environment: MS Windows 7 64-bit, running CouchDB 1.0.2 from the 
unofficial binary installer mentioned on 
http://wiki.apache.org/couchdb/Windows_binary_installer
            Reporter: Egbert Teeselink


I get the behaviour that in some cases, if after doing all getRow()s in a list 
function a javascript error occurs, this is not nicely reported but instead the 
connection appears to somehow break. Curl reports a " (56) Received problem 2 
in the chunky parser".

I've tried to minimize the problem, so I made an empty database, with only the 
following design document:

{
   "_id":"_design/bug",
   "_rev":"9-9eb0a83e4e22be8c914cec3432d6c6cf",
   "views":{
      "empty":{
         "map":"function(doc) {\r\n\r\n};"
      }
   },
   "lists":{
      "test":"function(head, req) { \r\n  // comment the line below to get a 
normal JS error:\r\n  while(getRow()) {}\r\n  send(moo);\r\n}"
   },
   "couchapp":{
      "signatures":{

      },
      "objects":{

      },
      "manifest":[
         "lists/",
         "lists/test.js",
         "views/",
         "views/empty/",
         "views/empty/map.js"
      ]
   }
}

For readability, here's the list function in non-escaped form:

function(head, req) { 
  // comment the line below to get a normal JS error:
  while(getRow()) {}
  send(moo);
}

'send(moo)' causes the error, because there's no variable called 'moo'.

The following curl call causes the above-mentioned error:
  curl -v http://localhost:5984/test/_design/bug/_list/test/empty?reduce=false 
-u:myusername:mypassword

I doubt it's related, but myusername is stored under the [admins] section, i 
don't have database-level security.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to