couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: Redirect from _list function?
Date Sun, 27 Sep 2009 04:22:18 GMT
On Sat, Sep 26, 2009 at 8:57 PM, Paul Davis <paul.joseph.davis@gmail.com> wrote:
> its been awhile since i studied the Erlang side of this, but IIRC,
> once getRow() returns, the response has started which means that you
> can't send a redirect. To get it working proper then would require a
> bit of a patch to wait on starting the response until the first output
> from the _list function.
>

Yes I think it would be a simple patch, once you understand the
entrails of the _list system. You should read the query_server_spec.rb
to see what gets sent by the query server on first getRow() call.

It may be that this patch can be accomplished just in the javascript side.

Chris

> Paul Davis
>
> On Sat, Sep 26, 2009 at 11:39 PM, Zachary Zolton
> <zachary.zolton@gmail.com> wrote:
>> Hey guys,
>>
>> I need to find a way to do a redirect from a _list function after
>> calling the getRow() function. After looking at render.js for a while
>> I can't see how to solve this without at least adding to the API.
>>
>> Basically, I think that calling getRow() shouldn't cause the view
>> server to send the headers (or awaiting chunks) unless we've already
>> called send() or something like that. That way, we can return from the
>> _list function after iterating to the first row that should redirect.
>> (I'm not sure if this is a breaking change from the current semantics,
>> however...)
>>
>> Would greatly appreciate a little guidance on how to attack this!
>>
>>
>> Cheers,
>>
>> Zach
>>
>>
>> ---------- Forwarded message ----------
>> From: Chris Anderson <jchris@apache.org>
>> Date: Fri, Sep 25, 2009 at 2:15 PM
>> Subject: Re: Redirect from _list function?
>> To: Zachary Zolton <zachary.zolton@gmail.com>
>>
>>
>> On Fri, Sep 25, 2009 at 11:01 AM, Zachary Zolton
>> <zachary.zolton@gmail.com> wrote:
>>> So, now I find that using the send() function to perform the redirect
>>> doesn't work after the first time I call getRow(). Upon checking out
>>> render.js, I see that the getRow() function calls sendStart()—which I
>>> haven't quite yet figured out—but I can tell there's something fishy
>>> going on there...
>>>
>>> Would I be correct to assume that the headers are already set after
>>> calling getRow()?
>>
>> Yes... The headers are sent when the first getRow is called. Fixing
>> this is definitely something I'd support.
>>
>>>
>>> On Fri, Sep 25, 2009 at 12:11 PM, Chris Anderson <jchris@apache.org> wrote:
>>>> On Fri, Sep 25, 2009 at 8:40 AM, Zachary Zolton
>>>> <zachary.zolton@gmail.com> wrote:
>>>>> Okay, I've update this section to differentiate between the 0.9 and
>>>>> 0.10 _list API:
>>>>>
>>>>> http://wiki.apache.org/couchdb/Formatting_with_Show_and_List#Sending_a_Redirect
>>>>>
>>>>> Now, I'm feeling that the Other Fun Things section could use a bit of
>>>>> love. Hmm...  :^)
>>>>
>>>> Thanks for keeping the wiki in mind!
>>>>
>>>>>
>>>>> On Fri, Sep 25, 2009 at 10:19 AM, Zachary Zolton
>>>>> <zachary.zolton@gmail.com> wrote:
>>>>>> Sweet! I'll try to amend the wiki page for the _list API...
>>>>>>
>>>>>> On Fri, Sep 25, 2009 at 10:17 AM, Jason Davies <jason@jasondavies.com>
wrote:
>>>>>>> On 25 Sep 2009, at 16:16, Zachary Zolton wrote:
>>>>>>>
>>>>>>>> Thanks for all the help, guys! Shall I delete that JIRA issue?
>>>>>>>
>>>>>>>
>>>>>>> I already did :-)
>>>>>>>
>>>>>>> --
>>>>>>> Jason Davies
>>>>>>>
>>>>>>> www.jasondavies.com
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Chris Anderson
>>>> http://jchrisa.net
>>>> http://couch.io
>>>>
>>>
>>
>>
>>
>> --
>> Chris Anderson
>> http://jchrisa.net
>> http://couch.io
>>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message