Why does curl send the command line before the body of the message in HTTP PUT?
I issue the command (the line is broken for readability):
curl -H"X-RequestIsAbsolutePath: F" \
-T /tmp/out \
-H'Content-Type: application/xml' \
"http://localhost:8182/metadata/036-Rotated.JPG"
I am sending post body from XML. I am getting a complaint from the XML parser on the server that content is not allowed in the prologue. I added the -trace-acii parameter 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 string itself as part of the message body? Of course the XML parser will complain. How can I get curl to stop doing this and only send the contents of the file passed as an argument to the -T option?
FYI: I have captured the raw text being sent to the server and yes indeed the command line is being sent. FYI # 2: I am using the latest curl (7.19.4) on Mac OS X.
source to share
Why is curl sending the command line itself as part of the message body?
This is not true. Are you sure you haven't put the command in somehow /tmp/out
?
curl doesn't even have command line access as shown in your ascii trace, as things like quote marks are interpreted by the shell before being passed to the program.
source to share