cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: a question about -X

From: Daniel Stenberg <Daniel.Stenberg_at_haxx.nu>
Date: Mon, 29 May 2000 13:49:43 +0200 (MET DST)

> I'm setting a special get command using the -X option.

> curl -o foo.mp3 -I -X 'GET / HTTP/1.0^MHost: 10.0.0.2^MUser-Agent: xmms/
> 1.0.1^MIcy-MetaData:1' http://10.0.0.2:8000/

I don't understand why you're doing it this way.

> But what I'm seeing in the network snoop is actually this:

> GET / HTTP/1.0.Host: 10.0.0.2.User-Agent: xmms/1.0.1.Icy-MetaData:1 /
> HTTP/1.0..User-Agent: curl/6.5 (sparc-sun-solaris2.7) libcurl 6.5..Host:
> 10.0.0.2..Pragma: no-cache..Accept: image/gif, image/x-xbitmap,
> image/jpeg, image/pjpeg,

> Perhaps I'm just not understanding the -X option, but it seems to be
> appending stuff to the get command which seems wrong.

-X lets you *replace* the GET-command. So it enters that string instead of
just 'GET'.

> Is this the right way to do this?

*NO*. You add request headers with -H. I figure you want something like:

curl -o foo.mp3 -I -H "User-Agent: xmms/1.0.1" -H
"Icy-MetaData:1" http://10.0.0.2:8000/

The user-agent string can also be set with -A.

-- 
      Daniel Stenberg - http://daniel.haxx.nu - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
Received on 2000-05-29