cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cross-platform https

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 20 Jul 2004 09:59:55 -0700

On Tue, Jul 20, 2004 at 11:48:09AM -0400, Daimen Duncan wrote:
> Hi,
>
> I'm new to curl and C in general, so please forgive the basic
> questions (a search in the list archives might be nice ;). I chose to
> work with libcurl because I need to POST data via SSL to a .jsp from a
> C++ program that needs to run on both Windows and OS X. Unfortunately
> I don't have a Mac yet, so I'm developing on Windows, but before I get
> too deep I'm wondering if I could get some info and suggestions on
> what will be required when I try to compile my code on OS X.
>
> So here are my questions:
> 1) Has anyone on this list successfully compiled an https client on OS X?

Given the presence of SSL OS X and Darwin downloads on the downloads page,
I would expect the answer is yes.

> 2) Where do I get the OS X source distribution? The OS X link from
> the libcurl download page takes me to a page with no downloads.

I count 7 links to OS X and Darwin downloads on that page, and all of them
either lead to a file link, or a page with a prominent link to instructions
on how to get the binaries. The page http://curl.haxx.se/docs/osdistribs.html
also states that curl is bundled with OS X.

> 3) How different are the distributions? For example, on Windows,
> there are required dlls... what, if anything, would be required on OS
> X?

It's based on BSD, so libraries are going to be handled similarly.

> 4) Am I correct in assuming that my 'main' code (below) would be the
> same cross platform, only the includes would change?

If you restrict yourself to APIs common to BSD and Windows (i.e. a subset of
the POSIX interface) you should be (for the most part) fine.

> 5) And finally, regarding the below code... while it seems to work
> fine (I get the correct response in res) are there other options I
> should consider when using SSL? (Note: that the HTTPHEADER is

Take a look at the example programs at
http://curl.haxx.se/libcurl/c/example.html

> commented out since for some reason it throws an exception in
> libcurl.dll).
>
> TIA for any help or suggestions!
>
> int main(void)
> {
>
> CURL *curl;
> CURLcode res;
>
> curl = curl_easy_init();
> if(curl) {
> curl_easy_setopt (curl, CURLOPT_URL, "https://localhost/hello.php");
> curl_easy_setopt (curl, CURLOPT_SSL_VERIFYHOST, 1);
> curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 0);
> curl_easy_setopt (curl, CURLOPT_USERAGENT, "NetAuth Client v1.0");
> //curl_easy_setopt (curl, CURLOPT_HTTPHEADER, "Content-Type:
> multipart/form-data;
> boundary=---------------------------0029482318BE");
> curl_easy_setopt (curl, CURLOPT_POST, 1);
> curl_easy_setopt (curl, CURLOPT_POSTFIELDS,
> "myVariable0=daniel&myVariable1=curl");
>
> /* Perform the request, res will get the return code */
> res = curl_easy_perform(curl);
>
> /* always cleanup */
> curl_easy_cleanup(curl);
> }
>
> cin.get();
>
> return 0;
> }

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2004-07-20