cURL / Mailing Lists / curl-users / Single Mail


Re: Found out why the 60K request is failing but unsure how to fix it

From: Daniel Stenberg <>
Date: Thu, 1 May 2003 20:00:16 +0200 (CEST)

On Thu, 1 May 2003, M D wrote:

[again, this is libcurl-related and is better discussed on the libcurl list]

> In the 60k of XML string there are tag values like "<movie>The King &amp;
> I</movie>"
> When the the string hits the server it is truncated to "<movie>The King "
> and it fails with an invalid XML error.

What do you mean "it is truncated" ? curl certainly does not truncate any
data at any time.

To me, it sounds as if you've tried to pass that XML over a command line and
the &-letter was eaten by your shell.

> The documentation suggests that specifing CURLOPT_POSTFIELDSIZE will allow
> for binary data.

It does, but the only reason you'd need to set that option is if you have
binary zero in the data. curl doesn't truncate data at &-letters, using that
option or not.

> headers = curl_slist_append(headers, "Content-Type: text/xml");
> curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
> The server didn't recognize any parms being sent when I put that in.

Many servers require you to do something like this, yes.

> Btw, if I replace the "&amp;" with "" it works (but this is not what we
> want)

This is not affected by libcurl. You can use a debugger and set a break-point
just before you set the CURLOPT_URL option to libcurl and you'll see that the
string you pass to libcurl is the same string you'll get over the "wire"
across the net to the server.

If it *is* correct when you send it to libcurl, then I'll be interested to
see some kind of capture/snoop of the network traffic that shows what libcurl
*did* send over the net.

> (I am using curl-7.10.3.tar for windows, running a MS visual C++ program on
> W2K)

If the problem remains, I'd appreciate if you can write up an as small source
code (as a complete program) as possible that I can use in my end to repeat
this problem. (And I don't use windows.)

 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2003-05-01