cURL / Mailing Lists / curl-users / Single Mail

curl-users

curl_formadd producing page faults on some computers and not others!?!! help!

From: Timothy B. Ward <tbwjobs_at_yahoo.com>
Date: Mon, 10 Dec 2001 08:18:21 -0500

Hello,

I'm just trying to hack something together here and I'm getting some weird errors and I have no idea where to turn.

I've narrowed down the source of my problem ( or at least what I believe to be the source of my problem) to curl_formadd function.

I'm running all this on the win32 platform and the oddity here is that the program functions perfectly on some machines and yields a page fault on a set of 30 laptops I'm supporting.

This code is copied from an example I found somewhere, and it works flawlessly on most machines.
The code in question is:
   
  CURL *curl;
  CURLcode res;

  struct HttpPost *formpost=NULL;
  struct HttpPost *lastptr=NULL;
  struct curl_slist *headerlist=NULL;
  char buf[] = "Expect:";
     
curl = curl_easy_init();

// THIS IS WHERE THE ERROR OCCURS
curl_formadd(&formpost, &lastptr, CURLFORM_COPYNAME, "name",CURLFORM_COPYCONTENTS, pszBuffer, CURLFORM_END);

headerlist = curl_slist_append(headerlist, buf);
  

 if(curl) {

    curl_easy_setopt(curl, CURLOPT_URL, http://my.web.host);
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
    curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
    res = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
    curl_formfree(formpost);
    curl_slist_free_all (headerlist);
}

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Received on 2001-12-10