On Wed, Feb 8, 2012 at 9:31 PM, Bob Dionne <[email protected]> wrote:
> Hi Filipe,
>
> I ran into a possible issue replicating from BC 0.4 to CouchDB 1.2.x (someone 
> needs to verify this is a problem and not my local setup).
>
> The issue seems to be the treatment of sequence numbers like [2,<<"foo">>]. 
> The latest in 1.2.x of couch_replicator_httpc:send_req runs 
> ?b2l(iolist_to_binary(...)) over that seq and eventually full_url trundles on 
> down to mochiweb_util:quote_plus which loses the brackets and converts the 2 
> to a %02

Hi Bob,

I'm assuming this is related to _changes feed request "since" parameter.
In general, couch_replicator_httpc doesn't do query parameter value
encoding (other then percent encoding), that task is left to
couch_replicator_api_wrap.erl - for e.g. some requests require JSON
encoded values, like open_revs for doc GETs, and others not, like the
feed parameter for _changes.

If it applies only for that request, I would go for something less
abstract like (untested) for example:

http://friendpaste.com/6aWgbQaBjMeR9pIshWr5rl

And you can't replace the list comprehension in couch_replicator_httpc
because there the goal is only to make sure the values are
lists/strings - when OAuth auth is used, the OAuth signature must be
computed with the query parameter values unencoded and as
strings/lists - percent encoding must happen after computing the OAuth
signature.

regards,

>
> I can get around this [1] by converting [2,<<"foo">>] to "2-foo" which is the 
> old format, but this is clearly a workaround. Perhaps this should be fixed in 
> mochiweb_util ?
>
> As an aside I noticed mochiweb_util:urlencode  does exactly what you have in 
> query_to_str_args so those funs can probably go away.
>
> Cheers,
>
> Bob
>
> [1] https://gist.github.com/1772911



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Reply via email to