cURL / Mailing Lists / curl-users / Single Mail

curl-users

[ curl-Bugs-623237 ] GET following a PUT causes a crash

From: <noreply_at_sourceforge.net>
Date: Mon, 14 Oct 2002 14:23:41 -0700

Bugs item #623237, was opened at 2002-10-14 16:23
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=623237&group_id=976

Category: libcurl
Group: crash
Status: Open
Resolution: None
Priority: 5
Submitted By: David Vaughn (dlv_555)
Assigned to: Daniel Stenberg (bagder)
Summary: GET following a PUT causes a crash

Initial Comment:
Using curl-7.10 on either Win2k or AIX I can reliably get
a C app to crash which performs a PUT followed by a
GET. This is because once a call to curl_easy_setopt()
has been made with CURLOPT_UPLOAD=TRUE it is
impossible to actually set it to FALSE. Apparently, this
means that a subsequent get try to upload a non-
existing file.

The problem is in url.c Curl_setopt():

case CURLOPT_UPLOAD:
    /*
     * We want to sent data to the remote host
     */
    data->set.upload = va_arg(param, long)?
TRUE:FALSE;
    if(data->set.upload)
      /* If this is HTTP, PUT is what's needed to "upload"
*/
      data->set.httpreq = HTTPREQ_PUT;
    break;

As is, there's no way to get data->set.httpreq set back
to HTTPREQ_GET. So, I've modified the code to the
following:

case CURLOPT_UPLOAD:
    /*
     * We want to sent data to the remote host
     */
    data->set.upload = va_arg(param, long)?
TRUE:FALSE;
    if(data->set.upload)
      /* If this is HTTP, PUT is what's needed to "upload"
*/
      data->set.httpreq = HTTPREQ_PUT;
        else
                data->set.httpreq =
HTTPREQ_GET;
    break;

This has been tested on Win2k and AIX.

- David Vaughn

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=623237&group_id=976

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-10-14