cURL / Mailing Lists / curl-library / Single Mail

curl-library

Unable to send/receive messages using curl (version 7.28.1)

From: subrahmanya <sum.sagar_at_gmail.com>
Date: Fri, 22 Mar 2013 17:43:01 +0530

Hi

We've an application that uses CURL to exchange data with a Java-based HTTP
server. Till now we were using very older version of CURL (7.15.1). Now we
are trying to move to the version 7.28.1. But after moving to 7.28.1 our
application does not work. It fails in "curl_easy_perform" function with
error "couldn't open/read from file". What would be the reason for the
failure? Is there any change in the way we have to use APIs between these
versions?

I tried my application against 7.19.6 it does not work with this version as
well. The reason for the failure looks to be because of the changes done in
version "7.18.0". In the below piece of code the lines marked in RED are
added freshly in 7.18.0 in "Curl_fillreadbuffer" function.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  if(nread == CURL_READFUNC_ABORT) {
    failf(data, "operation aborted by callback");
    *nreadp = 0;
    return CURLE_ABORTED_BY_CALLBACK;
  }
  else if(nread == CURL_READFUNC_PAUSE) {
    struct SingleRequest *k = &data->req;
    /* CURL_READFUNC_PAUSE pauses read callbacks that feed socket writes */
    k->keepon |= KEEP_SEND_PAUSE; /* mark socket send as paused */
    if(data->req.upload_chunky) {
      /* Back out the preallocation done above */
      data->req.upload_fromhere -= (8 + 2);
    }
    *nreadp = 0;
    return CURLE_OK; /* nothing was read */
  }
  else if((size_t)nread > buffersize) {
    /* the read function returned a too large value */
    *nreadp = 0;
    failf(data, "read function returned funny value");
    return CURLE_READ_ERROR;
  }
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

When I run my application I get the value "-1" for "nread". This was not
considered as error till 7.18.0 release. From release 7.18.0 onwards this
value is treated as error because of the condition "if((size_t)nread >
buffersize)". And hence my application breaks.

Is it a bug in CURL? Or does it require my code to be modified?

Thanks
Subrahmanya

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-03-22