cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Error: "failure when receiving data from the peer"

From: Young,Jim <Jim.Young_at_cerner.com>
Date: Wed, 20 Dec 2006 22:27:12 -0600

Blush - Never mind. I've found the problem and it's in my WRITEFUNCTION code.

(A slightly embarrased)

Jim Young

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se on behalf of Young,Jim
Sent: Wed 12/20/2006 5:11 PM
To: curl-library_at_cool.haxx.se
Subject: Error: "failure when receiving data from the peer"
 
I'm getting an error from an HTTP request that returns a long reply.
Requests that receive short replies seem to work OK but this longer one
fails consistently. The request does a GET with an XML request embedded
in the URL. The reply comes back as an XML string with the usual HTTP
headers.

I've tracked down the error a bit to see where it's being generated
from. What I've found so far is that a CHUNKE_BAD_CHUNK error is coming
from function Curl_httpchunk_read() in http_chunks.c at line 244. This
is the section labeled case CHUNK_POSTCR: where expects a cr/lf
combination. Chunks are 0x8000 (32768) bytes long. The problem appears
that as it reads the end of the first chunk and the first part of the
second chunk. On entry to Curl_httpchunk_read() the data lengths point
to the end of the first chunk. After the call to Curl_client_write() at
line 194, the byte that used to contain a '\r' character now contains
'\0'. The state is set to CHUNK_POSTCR which then causes the error.

When I submit this same request via the curl command rather than via the
library, it works correctly. On return from Curl_client_write() the
byte still contains a '\r'.

So is there an option setting I'm missing that causes this?

I'm running curl 7.16.0 compiled & running on UNIX, (IBM AIX 5.2) I
believe the remote server is a Java J2EE application running under
WebSphere on a Windows 2003 Server system.

Jim Young | Program Analyst IV | Cerner Corporation | 612-676-8641 |
Jim.Young_at_Cerner.com | www.cerner.com

-----------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments
are from Cerner Corporation and are intended only for the
addressee. The information contained in this message is
confidential and may constitute inside or non-public information
under international, federal, or state securities laws.
Unauthorized forwarding, printing, copying, distribution, or use of
such information is strictly prohibited and may be unlawful. If you
are not the addressee, please promptly delete this message and
notify the sender of the delivery error by e-mail or you may call
Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1)
(816)221-1024. -------------------------------------------
Received on 2006-12-21