curl-users
Re: command line completely broken re. arguments
Date: Fri, 6 Oct 2006 03:58:45 -0500
On 10/5/06, clemens fischer <ino-news_at_spotteswoode.dnsalias.org> wrote:
> 'uname -rms'
> FreeBSD 6.2-PRERELEASE i386
>
> 'curl --version'
> curl 7.15.5 (i386-portbld-freebsd6.2) libcurl/7.15.5 OpenSSL/0.9.7e zlib/1.2.2 libidn/0.6.7
> Protocols: tftp ftp telnet dict ldap http file https ftps
> Features: IDN IPv6 Largefile NTLM SSL libz
>
> consider this (additional `-F' arguments deleted for brevity):
>
> curl -F "action=flexsend" -s -A 'Lynx/2.8.5 (Compatible; ELinks)' --trace-ascii - http://www.spamcop.net/sc
>
> #== Info: getaddrinfo(3) failed for (Compatible;:80
> #== Info: Couldn't resolve host '(Compatible;'
> #== Info: Closing connection #0
> #== Info: getaddrinfo(3) failed for ELinks)':80
> #== Info: Couldn't resolve host 'ELinks)''
> #== Info: Closing connection #0
>
> curl parses halfway into the option value of `-A' (user agent) and tries
> to connect to the "host" after the first blank within this value, which
> is completely wrong and fails.
>
> #== Info: About to connect() to www.spamcop.net port 80
> #== Info: Trying 212.105.197.134... == Info: connected
> #== Info: Connected to www.spamcop.net (212.105.197.134) port 80
> #=> Send header, 212 bytes (0xd4)
> #0000: POST /sc HTTP/1.1
> #0013: User-Agent: 'Lynx/2.8.5
> #002c: Host: www.spamcop.net
> #0043: Accept: */*
> #0050: Content-Length: 2563
> #0066: Expect: 100-continue
> #007c: Content-Type: multipart/form-data; boundary=--------------------
> #00bc: --------5d71db5c1ef8
> #00d2:
> #=> Send data, 2563 bytes (0xa03)
> #0000: ------------------------------5d71db5c1ef8
> #002c: Content-Disposition: form-data; name=""action"
> #005c:
> #005e: flexsend"
>
> incorrect: the bourne shell gives a quoted value to the `-F' option.
> curl leaves the leading quotes attached to the form elements name and
> adds the trailing one to the form elements value, thereby invalidating
> both.
>
> apart from a much needed bug fix, is there a workaround?
As a workaround, try doing the same in a different shell, such as
/bin/ksh. It looks like your bourne shell is not handling single
quotes properly... To test it, try this:
for n in '(a b c d)'
do
echo $n
done
The output I get is:
(a b c d)
from /bin/bash & /bin/ksh in Gentoo, as well as /usr/bin/sh in Solaris
5.6. I don't have a FreeBSD system handy
I suspect the output you'll get in your FreeBSD bourne shell is:
'(a
b
c
d)'
which is absolutely not curl's problem...
Ralph Mitchell
Received on 2006-10-06