cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl.exe command in libcurl

From: Adrian Keller <a.keller_at_interact.ch>
Date: Wed, 3 Sep 2003 10:34:30 +0200

Hi everybody,

Daniel, thanks for your help. I read through the manual and the example.
See the following code I made. I renamed all functions like curl_tralala
to CurlTralala etc. I made a Wrapper so that I can use the libcurl as
c-dll in my project. However now I have the problem, that my dll is not
supporting HTTPS and I have to send the request to the following url:
https://tcdss.someserver.com/cgi-sbin/upload

I made everything in Borland5. If it helps, I can post the entire project.
What I do not know is, how to compile the dll to support HTTPS. Any input?
Can someone help me? Where can I find more about this subject?

Thanks for your great help,

Adrian Keller

---------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
   CURL *curl;
   CURLcode res;
 
   struct HttpPost *formpost=NULL;
   struct HttpPost *lastptr=NULL;
   struct curl_slist *headerlist=NULL;
   char buf[] = "Expect:";
 
   /* Fill in the file upload field */
   CurlFormadd(&formpost,
                &lastptr,
                CURLFORM_COPYNAME, "data",
                CURLFORM_FILE, "Readme.txt",
                CURLFORM_END);

   /* Fill in the mode upload field */
   CurlFormadd(&formpost,
                &lastptr,
                CURLFORM_COPYNAME, "mode",
                CURLFORM_COPYCONTENTS, "synchron",
                CURLFORM_END);

   /* Fill in the signtype upload field */
   CurlFormadd(&formpost,
                &lastptr,
                CURLFORM_COPYNAME, "signtype",
                CURLFORM_COPYCONTENTS, "encapsulated",
                CURLFORM_END);

   curl = CurlEasyInit();
   /* initalize custom header list (stating that Expect: 100-continue is
not
      wanted */
   headerlist = CurlSlistAppend(headerlist, buf);
   if(curl) {
     /* what URL that receives this POST */
     CurlEasySetopt(curl, CURLOPT_URL,
"https://tcdss.someserver.com/cgi-sbin/upload");
     CurlEasySetopt(curl, CURLOPT_USERPWD, "interact:myPassword");

     CurlEasySetopt(curl, CURLOPT_HTTPPOST, formpost);
     res = CurlEasyPerform(curl);

     /* always cleanup */
     CurlEasyCleanup(curl);

     /* then cleanup the formpost chain */
     CurlFormfree(formpost);
     /* free slist */
     CurlSlistFreeAll (headerlist);
   }
   return;
}
---------------------------

Daniel Stenberg <daniel_at_haxx.se>
Sent by: curl-library-admin_at_lists.sourceforge.net
02.09.2003 08:53
Please respond to curl-library

 
        To: libcurl Mailing list <curl-library_at_lists.sourceforge.net>
        cc: (bcc: Adrian Keller/Interact/CH)
        Subject: Re: curl.exe command in libcurl

On Mon, 1 Sep 2003, Adrian Keller wrote:

> Using curl-command-prompt utility I can upload a page with the following
> command
>
> curl -Fdata=@Readme.txt -Fmode=asynchron -Fsigntype=encapsulated -u
> username:"pass!word" -o Readme.txt.sign
> https://www.destinationserver.com/cgi-sbin/upload
>
> As result I get a signed file named readme.txt.sign (the
destinationserver
> holds a service where documents are signed)
>
> Now, how do I implement the same using libcurl? I guess I might use the
> curl-fromadd() Method

Yes, curl_formadd() is the key.

> Can someone help me with this?

Here's an example: http://curl.haxx.se/lxr/source/docs/examples/postit2.c

Here's the man page: http://curl.haxx.se/libcurl/c/curl_formadd.html

Please read these and ask more specific questions on what details that are
still unclear.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-09-04