cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_recv error handling bug?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 23 Mar 2009 23:50:07 -0600

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
Received on 2009-03-24