curl-users
Re: Remove or replace automatically created ampersand (&) as a separating symbol
Date: Tue, 10 Jan 2012 14:57:09 +0100
On 09/01/2012 at 23:52, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 9 Jan 2012, Lukasz Wrobel wrote:
>
> >I have simple piece of code: curl -v --get --data-urlencode "some
> >data to encode" http://some/target/url=
> >
> >Curl automatically constructs GET from "base" url and encoded data
> >like this: GET /target/url=&some%20data%20to%20encode
> >
> >Insert ampersand (&) as a separating symbol between "base" url and
> >encoded data.
> >
> >How do I remove automatically created separate symbol (&) or
> >possibly replace it with another selected character?
>
> Well, in your particular example curl _doesn't_ add an ampersand so
> it took me a while to figure out what you're talking about.
>
> However, if curl finds a question mark in the URL already present,
> it then adds the data with a prepended ampersand. Like in:
>
> curl --get --data-urlencode "some one" "localhost/url?moo="
Now i now know were problem was. My original URL contained a question
mark like in:
curl -G --data-urlencode "some data" http://domain/render?grid=
So, curl behaviour was completely correct...
My solution is as follows:
curl -G --data-urlencode grid="some data" http://domain/render
In this case GET looks like:
GET render?grid=some%20data
It was my mistake. I should read the docs more thoroughly.
Thanks for your time
Best regards
> I consider it to be a bug to insert that ampersand prepended to the
> data, it is meant to be put as a separator between separate pieces
> of data.
>
> You want to work on fixing the check?
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-10