tags:

views:

512

answers:

1

I'm issuing the command (line broken for readability):

curl -H"X-RequestIsAbsolutePath: F" \
-T /tmp/out \
-H'Content-Type: application/xml' \
"http://localhost:8182/metadata/036-Rotated.JPG"

I'm sending a message body of XML. I get a complaint from the XML parser on the server about content not being allowed in the prolog. I added a --trace-acii option to the command line and see:

=> Send header, 270 bytes (0x10e)
0000: PUT /metadata/036-Rotated.JPG HTTP/1.1
0028: User-Agent: curl/7.19.4 (i386-apple-darwin9.6.0) libcurl/7.19.4
0068: OpenSSL/0.9.8i zlib/1.2.3
0083: Host: localhost:8182
0099: Accept: */*
00a6: X-RequestIsAbsolutePath: F
00c2: Content-Type: application/xml
00e1: Content-Length: 235
00f6: Expect: 100-continue
010c:
== Info: Done waiting for 100-continue
=> Send data, 235 bytes (0xeb)
0000: curl -v -H"X-RequestIsAbsolutePath: F" "http://localhost:8182/me
0040: tadata/036-Original.JPG".<metadata>.  <Core>.    <ImageOrientati
0080: on editable="1" type="unsignedShort">.      <value raw="3"/>.
00c0:  </ImageOrientation>.  </Core>.</metadata>.

Why is curl sending the command-line itself as part of the message body? Of course the XML parser will complain. How can I get curl to stop doing that and send only the contents of the file passed as an argument to the -T option?

FYI: I've captured the raw text being sent on the server and, yes, the command-line really is being sent. FYI#2: I'm using the latest curl (7.19.4) on Mac OS X.

+2  A: 

Why is curl sending the command-line itself as part of the message body?

It doesn't. Are you sure that you haven't somehow put the command in /tmp/out?

curl doesn't even have access to the command-line as seen in your ascii trace, since things like the quote marks are interpreted by the shell before they are passed to the program.

Miles
Uhm, yeah -- the command was in the file. OK, I feel stupid now. :(
Paul J. Lucas
Happens to everyone! ;)
Miles