cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl script to post to pastie.org

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 18 Feb 2010 10:34:32 +0100 (CET)

On Tue, 16 Feb 2010, Scott Haneda wrote:

>> The data like that will no doubt fail depending on the file contents. I
>> would instead suggest you tell curl to get the contents off the file. Like
>> this:
>>
>> curl http://pastie.caboo.se/pastes/create -H 'Expect:' -F
>> 'paste[parser]=plaintext' -F "paste[body]=<filename" -F
>> 'paste[authorization]=burger' -s -L -o /dev/null -w '%{url_effective}'
>>
>> ... where 'filename' is ~/Desktop/curly.txt or suitable.

> If you have a spare second, could you tell me why sending the data in a
> variable would fail, but pushing it in via < works? I am not following what
> magic happens when taking the different approach.

Since the file can contain any letters, it could just as well contain
single or double quotes, backticks etc that makes them alter the command line
in unwanted ways. Or just if you started the text with a '<' or '@' as they
have a special meaning to curl.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
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 2010-02-18