cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-users Mailing List Archives

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

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET