cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl damages form data if read from stdin

From: Ralph Mitchell <ralphmitchell_at_gmail.com>
Date: Thu, 16 Jul 2009 09:39:00 -0500

On Thu, Jul 16, 2009 at 9:05 AM, Stefan Klinger <all-lists_at_stefan-klinger.de
> wrote:

> Hello,
>
> I observe the following strange behavior: When form data is passed via
> stdin, a full-stop '.' is appended. This did not happen in a previous
> version. Hard to track down if you pass the password this way.
>
> $ echo foontastic | curl --trace-ascii /tmp/trace -o /tmp/response -F
> 'foo=<-' -F 'bar=barracuda' [url removed]
>
> $ cat /tmp/trace
> [...]
> 00d4: Content-Type: multipart/form-data; boundary=--------------------
> 0114: --------6fff571500e0
> 012a:
> <= Recv header, 23 bytes (0x17)
> 0000: HTTP/1.1 100 Continue
> => Send data, 250 bytes (0xfa)
> 0000: ------------------------------6fff571500e0
> 002c: Content-Disposition: form-data; name="foo"
> 0058:
> 005a: foontastic.
> 0067: ------------------------------6fff571500e0
> 0093: Content-Disposition: form-data; name="bar"
> 00bf:
> 00c1: barracuda
> 00cc: ------------------------------6fff571500e0--
> [...]
>
> Note the full-stop following 'foontastic' in the line marked '005a'. No
> such thinghappens for the 'barracuda' in line '00c1'.
>
> Is this a bug?
>

Are you sure that's a full-stop and not just a non-printable character, such
as a newline?? I tried your curl command line and got the same results, but
when I told 'echo' not to output the trailing newline, I saw 'foontastic'
without the full-stop.

     echo -n foontastic | curl ...........

Ralph Mitchell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-07-16