cURL / Mailing Lists / curl-library / Single Mail

curl-library

Plea for help

From: Paul Johnson <paul_at_applewoodhouse.com>
Date: Wed, 16 Jul 2003 12:23:24 +0100

OK, this is doing my head in now. I've spent the last four days looking at
this 52 problem and everything I've changed makes no difference. The server
guy keeps telling me no data is being sent via my post and curl only seems
to come back after the post when I do a raindance.

Looks like I was very wrong about me spending my time writing the app
instead of the transport layer. I've even run all this through
BoundsChecker.

I turned on verbose output and called AllocConsole() and don't see anything
at all in the console window. I'm starting to think I'm jinxed.

I'm a complete novice at this so anything could be going wrong. I've
attached some code below that is my latest incarnation. If some kind soul
can find a glaring mistake in this I'd be eternally grateful.

I tried doing a single part post using the postfields options (an no
formadd) but with the same odd result btw.

The alleged posting code:

 curl_easy_setopt(curl,CURLOPT_READFUNCTION,ReadBody);
 curl_easy_setopt(curl,CURLOPT_UPLOAD,TRUE);
// curl_easy_setopt(curl,CURLOPT_POSTFIELDSIZE,FileSize);
// curl_easy_setopt(curl,CURLOPT_POSTFIELDS,MoveFileMem);

    curl_formadd(&post, &last,
                 CURLFORM_COPYNAME,"move file",
                 CURLFORM_CONTENTSLENGTH,FileSize,
                 CURLFORM_PTRCONTENTS,MoveFileMem,
     CURLFORM_END);

 curl_easy_setopt(curl,CURLOPT_HTTPPOST,post);

 ReadPtr=NULL;
 BytesLeft=FileSize;
 res=curl_easy_perform(curl);

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

size_t ReadBody (void *buffer, size_t size, size_t nmemb, void *userp)
{
tS32 Size;

 Size=size*nmemb;

 BytesLeft-=Size;
 if (BytesLeft<0)
  {
  Size+=BytesLeft;
  BytesLeft=0;
  }

 if (!ReadPtr)
  ReadPtr=MoveFileMem;

 if (Size)
  {
  KickProgressBar(Size);
  memcpy(buffer,ReadPtr,Size);
  ReadPtr+=Size;
  }

 if (Size)
  return (Size);
 else
  return (0);
}

Regards,
Paul Johnson
Applewood House
www.applewoodhouse.com

-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
Received on 2003-07-16