(My sincere apologies—I didn't mean to sound impatient! Rather, I was just trying to clarify my question, which I can now sum up as: am I doing something fundamentally wrong or is CouchDB acting funny?)
Now, onto Jan's suggestion, I've tried setting Transfer-Encoding to both null and 'foo', but the response always seems to have chunked for the header value. So my initial guess is that I'm unable to override it for some reason... I couldn't determine any other values from the spec worth trying: http://tools.ietf.org/html/rfc2616#section-14.41 Assuming that this is a bug, I've created the following on JIRA: https://issues.apache.org/jira/browse/COUCHDB-513 On Fri, Sep 25, 2009 at 2:56 AM, Jan Lehnardt <[email protected]> wrote: > Hi Zach, > > On 25 Sep 2009, at 05:50, Zachary Zolton wrote: > >> So, can anyone give a reason why this _list function shouldn't work? > > (you wrote the initial message not even five hours earlier, be patient ;) > > -- > > The chunky-parser error message occurs when curl expects a chunked > HTTP response body and then doesn't get one. Your reply sends the > `Transfer-Encoding: chunked` header, so curl expects to see a body > chunked according to RFC2616 and it doesn't get one. > > Obviously, a redirect shouldn't have a response body or even the > `Transfer-Encoding` header to begin with. You could try overriding > the header, but maybe CouchDB inserts it unconditional in which > case we should fix that, if you find out you can't override the > `Transfer-Encoding` header, can you file a bug report? > > Cheers > Jan > -- > > > > > > >> On Thu, Sep 24, 2009 at 5:34 PM, Zachary Zolton >> <[email protected]> wrote: >>> >>> Hello, >>> >>> Should I be able to do a redirect from a _list function? >>> >>> I ask because I've tried defining the following _list function: >>> >>> function(head, req) { >>> return { >>> 'code': 301, >>> 'headers': { 'Location': 'http://www.google.com/' } >>> }; >>> } >>> >>> And, here's what happens when I try to hit it: >>> >>> $ curl -i >>> 'http://localhost:5984/db/_design/ddoc/_list/test-redirect/some-view?key=%22foo%22' >>> HTTP/1.1 200 OK >>> Vary: Accept >>> Transfer-Encoding: chunked >>> Server: CouchDB/0.11.0a9fd42dc1-git (Erlang OTP/R12B) >>> Etag: "46014W5JDRLKZF5SECP2D44YH" >>> Date: Thu, 24 Sep 2009 22:23:14 GMT >>> Content-Type: application/json >>> >>> curl: (56) Received problem 2 in the chunky parser >>> >>> Obviously, this does not look like a redirect. :^( Do I seem to be >>> doing anything wrong here? >>> >>> >>> Thanks! >>> >>> Zach >>> >> > >
