Curl and multi-line get parameter

curl

I am trying to pass a url-encoded multi-line string as parameter of a GET call to an existing web-service. I think I am getting quite close to the solution with the following:

echo -e 'p_message=a\nb\nc\n' | curl -v -G --data-urlencode @- http://localhost/service
> GET /service?p_message%3Da%0Ab%0Ac%0A%0A HTTP/1.1

It seems that the only thing that is going wrong is that the '=' is getting url-encoded. I am running the latest version of curl (7.33).

Best Answer

Got it, the following seems to work:

echo -e "a\nb\nc\n'" | curl -v -G --data-urlencode p_message@- http://localhost/service
> GET /service?p_message=a%0Ab%0Ac%0A%27%0A HTTP/1.1