cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: curl_easy_recv error handling bug?

From: Jim Freeman <Jim.Freeman_at_nirvanix.com>
Date: Tue, 24 Mar 2009 10:45:10 -0700

That patch looks good, thanks for the quick response. Also note I
noticed the bug by code inspection, I didn't actually hit the bug during
a run.

Jim

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Dan Fandrich
Sent: Monday, March 23, 2009 10:50 PM
To: curl-library_at_cool.haxx.se
Subject: Re: curl_easy_recv error handling bug?

On Mon, Mar 23, 2009 at 01:09:36PM -0700, Jim Freeman wrote:
> curl_easy_recv calls Curl_read which calls Curl_read_plain.
curl_easy_recv
> only assumes an error occurred if Curl_read returns -1. Curl_read
(and
> Curl_read_plain) can return CURLE_RECV_ERROR (56). That error code
gets
> returned to curl_easy_recv which only checks for -1 and thus thinks
there?s no
> error.

Looks like a legitimate problem to me. Does this patch work for you?

--- easy.c 9 Mar 2009 12:21:47 -0000 1.134
+++ easy.c 24 Mar 2009 05:10:01 -0000
@@ -1095,8 +1095,8 @@
   if(ret1 == -1)
     return CURLE_AGAIN;

- if(n1 == -1)
- return CURLE_RECV_ERROR;
+ if(ret1 != CURLE_OK)
+ return ret1;

   *n = (size_t)n1;

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address
service
          Let webmasters know that your web site has moved
___________________________________________________________________
This electronic mail message, including any attachments or embedded documents, is intended 
only for the addressee and may contain privileged and/or confidential information. Unless 
expressly indicated, this electronic mail message is confidential and privileged information 
of Nirvanix, Inc. Any use, dissemination, copying or distribution in any form, and any action 
taken based up this email is strictly prohibited unless expressly indicated. If you have 
received this message by error, please immediately delete it and any copies of it, including 
any attachments hereto, and notify the sender at Nirvanix, Inc. by reply electronic mail 
message or phone. Thank you.
Received on 2009-03-24