From 226fe8bdf9c9ff8cb5667a058a6a7b58dc80711c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 18 Dec 2001 10:13:41 +0000 Subject: =?UTF-8?q?G=F6tz=20Babin-Ebell's=20contributed=20"simplessl.c"=20?= =?UTF-8?q?example=20source=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/examples/simplessl.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 docs/examples/simplessl.c (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c new file mode 100644 index 000000000..534fac849 --- /dev/null +++ b/docs/examples/simplessl.c @@ -0,0 +1,110 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * $Id$ + */ + +#include + +#include +#include +#include + + +/* some requirements for this to work: + 1. set pCertFile to the file with the client certificate + 2. if the key is passphrase protected, set pPassphrase to the + passphrase you use + 3. if you are using a crypto engine: + 3.1. set a #define USE_ENGINE + 3.2. set pEngine to the name of the crypto engine you use + 3.3. set pKeyName to the key identifier you want to use + 4. if you don't use a crypto engine: + 4.1. set pKeyName to the file name of your client key + 4.2. if the format of the key file is DER, set pKeyType to "DER" + + !! verify of the server certificate is not implemented here !! +*/ + +int main(int argc, char **argv) +{ + CURL *curl; + CURLcode res; + FILE *headerfile; + + const char *pCertFile = "testcert.pem"; + + const char *pKeyName; + const char *pKeyType; + + const char *pEngine; + +#if USE_ENGINE + pKeyName = "rsa_test"; + pKeyType = "ENG"; + pEngine = "chil"; /* for nChiper HSM... */ +#else + pKeyName = "testkey.pem"; + pKeyType = "PEM"; + pEngine = NULL; +#endif + + const char *pPassphrase = NULL; + + headerfile = fopen("dumpit", "w"); + + curl_global_init(CURL_GLOBAL_DEFAULT); + + curl = curl_easy_init(); + if(curl) { + /* what call to write: */ + curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://curl.haxx.se"); + curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile); + + while(1) /* do some ugly short cut... */ + { + if (pEngine) /* use crypto engine */ + { + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) + { /* load the crypto engine */ + fprintf(stderr,"can't set crypto engine\n"); + break; + } + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK) + { /* set the crypto engine as default */ + /* only needed for the first time you load + a engine in a curl object... */ + fprintf(stderr,"can't set crypto engine as default\n"); + break; + } + } + /* cert is stored PEM coded in file... */ + /* since PEM is default, we needn't set it for PEM */ + curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); + /* set the cert for client authentication */ + curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); + /* sorry, for engine we must set the passphrase + (if the key has one...) */ + if (pPassphrase) + curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase); + /* if we use a key stored in a crypto engine, + we must set the key type to "ENG" */ + curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); + /* set the private key (file or ID in engine) */ + curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); + + res = curl_easy_perform(curl); + break; /* we are done... */ + } + /* always cleanup */ + curl_easy_cleanup(curl); + } + + curl_global_cleanup(); + + return 0; +} -- cgit v1.2.1 From e4866563dedda10047c51747232c2d85fa346be2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 13 Jan 2002 11:32:36 +0000 Subject: =?UTF-8?q?G=F6tz=20Babin-Ebell=20updated=20with=20some=20new=207.?= =?UTF-8?q?9.3=20features?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/examples/simplessl.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 534fac849..285d0cd37 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -37,6 +37,7 @@ int main(int argc, char **argv) FILE *headerfile; const char *pCertFile = "testcert.pem"; + const char *pCACertFile="cacert.pem" const char *pKeyName; const char *pKeyType; @@ -96,6 +97,10 @@ int main(int argc, char **argv) curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); /* set the private key (file or ID in engine) */ curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); + /* set the file with the certs vaildating the server */ + curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile); + /* disconnect if we can't validate server's cert */ + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1); res = curl_easy_perform(curl); break; /* we are done... */ -- cgit v1.2.1 From 12cdfd282d707a35f4738fe54617ec2c583de0e9 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 17 Jan 2002 13:45:19 +0000 Subject: added a comment about this example only works with 7.9.3 and newer libs --- docs/examples/simplessl.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 285d0cd37..9a53603f4 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -28,6 +28,9 @@ 4.2. if the format of the key file is DER, set pKeyType to "DER" !! verify of the server certificate is not implemented here !! + + **** This example only works with libcurl 7.9.3 and later! **** + */ int main(int argc, char **argv) -- cgit v1.2.1 From 9e1123debe5a3fcf3e1d706596f65fc4367658ba Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 22 Nov 2002 07:39:15 +0000 Subject: don't use curl.haxx.se --- docs/examples/simplessl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 9a53603f4..4eedfc78e 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -66,7 +66,7 @@ int main(int argc, char **argv) curl = curl_easy_init(); if(curl) { /* what call to write: */ - curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://curl.haxx.se"); + curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://your.favourite.ssl.site"); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile); while(1) /* do some ugly short cut... */ -- cgit v1.2.1 From 662c6592208abf87652ec98d6482cbcb9d8048bf Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 20 May 2003 12:44:55 +0000 Subject: missing semicolon, by Gisle Vanem --- docs/examples/simplessl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 4eedfc78e..781e06909 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -40,7 +40,7 @@ int main(int argc, char **argv) FILE *headerfile; const char *pCertFile = "testcert.pem"; - const char *pCACertFile="cacert.pem" + const char *pCACertFile="cacert.pem"; const char *pKeyName; const char *pKeyType; -- cgit v1.2.1 From cb8813522083672d408325a11300b91dffd806c3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 12 Aug 2004 07:01:20 +0000 Subject: removed trailing whitespace, indented to curl-style levels --- docs/examples/simplessl.c | 86 +++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 40 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 781e06909..745d6e82c 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -1,8 +1,8 @@ /***************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * $Id$ @@ -71,42 +71,48 @@ int main(int argc, char **argv) while(1) /* do some ugly short cut... */ { - if (pEngine) /* use crypto engine */ - { - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) - { /* load the crypto engine */ - fprintf(stderr,"can't set crypto engine\n"); - break; - } - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK) - { /* set the crypto engine as default */ - /* only needed for the first time you load - a engine in a curl object... */ - fprintf(stderr,"can't set crypto engine as default\n"); - break; - } - } - /* cert is stored PEM coded in file... */ - /* since PEM is default, we needn't set it for PEM */ - curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); - /* set the cert for client authentication */ - curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); - /* sorry, for engine we must set the passphrase - (if the key has one...) */ - if (pPassphrase) - curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase); - /* if we use a key stored in a crypto engine, - we must set the key type to "ENG" */ - curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); - /* set the private key (file or ID in engine) */ - curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); - /* set the file with the certs vaildating the server */ - curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile); - /* disconnect if we can't validate server's cert */ - curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1); - - res = curl_easy_perform(curl); - break; /* we are done... */ + if (pEngine) /* use crypto engine */ + { + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK) + { /* load the crypto engine */ + fprintf(stderr,"can't set crypto engine\n"); + break; + } + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK) + { /* set the crypto engine as default */ + /* only needed for the first time you load + a engine in a curl object... */ + fprintf(stderr,"can't set crypto engine as default\n"); + break; + } + } + /* cert is stored PEM coded in file... */ + /* since PEM is default, we needn't set it for PEM */ + curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM"); + + /* set the cert for client authentication */ + curl_easy_setopt(curl,CURLOPT_SSLCERT,pCertFile); + + /* sorry, for engine we must set the passphrase + (if the key has one...) */ + if (pPassphrase) + curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase); + + /* if we use a key stored in a crypto engine, + we must set the key type to "ENG" */ + curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,pKeyType); + + /* set the private key (file or ID in engine) */ + curl_easy_setopt(curl,CURLOPT_SSLKEY,pKeyName); + + /* set the file with the certs vaildating the server */ + curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile); + + /* disconnect if we can't validate server's cert */ + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1); + + res = curl_easy_perform(curl); + break; /* we are done... */ } /* always cleanup */ curl_easy_cleanup(curl); -- cgit v1.2.1 From 49ce3e5160a9576e797bf87cef012b09d1c54ecb Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 12 Jul 2007 21:11:10 +0000 Subject: Fixed some compile warnings and errors and improved portability in the examples. Removed ftp3rdparty.c since libcurl doesn't support 3rd party FTP transfers any longer. --- docs/examples/simplessl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 745d6e82c..7ad35237c 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -38,9 +38,10 @@ int main(int argc, char **argv) CURL *curl; CURLcode res; FILE *headerfile; + const char *pPassphrase = NULL; - const char *pCertFile = "testcert.pem"; - const char *pCACertFile="cacert.pem"; + static const char *pCertFile = "testcert.pem"; + static const char *pCACertFile="cacert.pem"; const char *pKeyName; const char *pKeyType; @@ -57,8 +58,6 @@ int main(int argc, char **argv) pEngine = NULL; #endif - const char *pPassphrase = NULL; - headerfile = fopen("dumpit", "w"); curl_global_init(CURL_GLOBAL_DEFAULT); -- cgit v1.2.1 From 9f44a95522162c0f4a61093efe1bf1f58b087358 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 30 Aug 2007 20:34:57 +0000 Subject: Renamed several libcurl error codes and options to make them more general and allow reuse by multiple protocols. Several unused error codes were removed. In all cases, macros were added to preserve source (and binary) compatibility with the old names. These macros are subject to removal at a future date, but probably not before 2009. An application can be tested to see if it is using any obsolete code by compiling it with the CURL_NO_OLDIES macro defined. Documented some newer error codes in libcurl-error(3) --- docs/examples/simplessl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 7ad35237c..77da32d08 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -95,7 +95,7 @@ int main(int argc, char **argv) /* sorry, for engine we must set the passphrase (if the key has one...) */ if (pPassphrase) - curl_easy_setopt(curl,CURLOPT_SSLKEYPASSWD,pPassphrase); + curl_easy_setopt(curl,CURLOPT_KEYPASSWD,pPassphrase); /* if we use a key stored in a crypto engine, we must set the key type to "ENG" */ -- cgit v1.2.1 From e664cd5826d43930fcc5b5dbaedbec94af33184b Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Thu, 22 May 2008 21:20:07 +0000 Subject: Fixed a surprising number of example programs that were passing int arguments to curl_easy_setopt instead of long. --- docs/examples/simplessl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 77da32d08..ea9eb5ee7 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -77,7 +77,7 @@ int main(int argc, char **argv) fprintf(stderr,"can't set crypto engine\n"); break; } - if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) != CURLE_OK) + if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1L) != CURLE_OK) { /* set the crypto engine as default */ /* only needed for the first time you load a engine in a curl object... */ @@ -108,7 +108,7 @@ int main(int argc, char **argv) curl_easy_setopt(curl,CURLOPT_CAINFO,pCACertFile); /* disconnect if we can't validate server's cert */ - curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1); + curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1L); res = curl_easy_perform(curl); break; /* we are done... */ -- cgit v1.2.1 From 2309b4e330b96bc2e1f8e36b6184015e59544037 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 24 Mar 2010 11:02:54 +0100 Subject: remove the CVSish $Id$ lines --- docs/examples/simplessl.c | 1 - 1 file changed, 1 deletion(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index ea9eb5ee7..db3accaaa 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -5,7 +5,6 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * $Id$ */ #include -- cgit v1.2.1 From 9583b4af9057c9e35ec3dd3270d4c4813b5f7aaa Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 17 Dec 2010 23:34:26 +0100 Subject: examples: fix compiler warnings --- docs/examples/simplessl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index db3accaaa..a02c2ae32 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -32,7 +32,7 @@ */ -int main(int argc, char **argv) +int main(void) { CURL *curl; CURLcode res; @@ -47,7 +47,7 @@ int main(int argc, char **argv) const char *pEngine; -#if USE_ENGINE +#ifdef USE_ENGINE pKeyName = "rsa_test"; pKeyType = "ENG"; pEngine = "chil"; /* for nChiper HSM... */ -- cgit v1.2.1 From 1aeb635cdd296c16acb375a4a83a78f13166ccab Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 10 Mar 2011 11:48:02 +0100 Subject: sources: update source headers All C and H files now (should) feature the proper project curl source code header, which includes basic info, a copyright statement and some basic disclaimers. --- docs/examples/simplessl.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index a02c2ae32..aeaadce59 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -1,12 +1,24 @@ -/***************************************************************************** +/*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - */ - + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ #include #include -- cgit v1.2.1 From ac28971aa61d28e5dd54888e34e958d1c742b461 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 28 Jun 2011 19:08:51 +0200 Subject: examples: cleanup curl includes Only is needed typically and curl/types.h has been removed --- docs/examples/simplessl.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index aeaadce59..46a378329 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -22,9 +22,6 @@ #include #include -#include -#include - /* some requirements for this to work: 1. set pCertFile to the file with the client certificate -- cgit v1.2.1 From a3dbbcfd2ac7ab8f597e26e76935726279d3fa0c Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Wed, 4 Jul 2012 17:03:52 +0200 Subject: Added error checking for samples. --- docs/examples/simplessl.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 46a378329..b77c276e4 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -118,7 +118,13 @@ int main(void) /* disconnect if we can't validate server's cert */ curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,1L); + /* Perform the request, res will get the return code */ res = curl_easy_perform(curl); + /* Check for errors */ + if(res != CURLE_OK) + fprintf(stderr, "curl_easy_perform() failed: %s\n", + curl_easy_strerror(res)); + break; /* we are done... */ } /* always cleanup */ -- cgit v1.2.1 From e880680fb666f42cbb0cc3457b35c51d23695980 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 10 Dec 2012 17:55:18 +0100 Subject: examples/simplessl.c: fix compiler warning --- docs/examples/simplessl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index b77c276e4..0765e1224 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -76,7 +76,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://your.favourite.ssl.site"); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile); - while(1) /* do some ugly short cut... */ + for(;;) /* do some ugly short cut... */ { if (pEngine) /* use crypto engine */ { -- cgit v1.2.1 From f4b60e7f140d72a052a22a05bc47a0ffdc00725c Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 11 Dec 2012 15:03:17 +0100 Subject: examples/simplessl.c: fix compiler warning --- docs/examples/simplessl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/examples/simplessl.c') diff --git a/docs/examples/simplessl.c b/docs/examples/simplessl.c index 0765e1224..74c58461a 100644 --- a/docs/examples/simplessl.c +++ b/docs/examples/simplessl.c @@ -43,6 +43,7 @@ int main(void) { + int i; CURL *curl; CURLcode res; FILE *headerfile; @@ -76,7 +77,7 @@ int main(void) curl_easy_setopt(curl, CURLOPT_URL, "HTTPS://your.favourite.ssl.site"); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile); - for(;;) /* do some ugly short cut... */ + for(i = 0; i < 1; i++) /* single-iteration loop, just to break out from */ { if (pEngine) /* use crypto engine */ { @@ -125,7 +126,7 @@ int main(void) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); - break; /* we are done... */ + /* we are done... */ } /* always cleanup */ curl_easy_cleanup(curl); -- cgit v1.2.1