From efc696a2e09225bfeab4e7efea61a4e416d66cba Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 23 Sep 2018 09:20:26 +0000 Subject: docs/examples: URL updates - also update two URLs outside of docs/examples - fix spelling of filename persistant.c - fix three long lines that started failing checksrc.pl Closes https://github.com/curl/curl/pull/3036 --- docs/examples/.gitignore | 2 +- docs/examples/10-at-a-time.c | 97 ++++++++++++++++++------------------- docs/examples/Makefile.inc | 12 ++--- docs/examples/Makefile.netware | 2 +- docs/examples/cookie_interface.c | 4 +- docs/examples/debug.c | 4 +- docs/examples/getinfo.c | 4 +- docs/examples/getinmemory.c | 2 +- docs/examples/getredirect.c | 4 +- docs/examples/href_extractor.c | 2 +- docs/examples/htmltidy.c | 2 +- docs/examples/multi-app.c | 4 +- docs/examples/multi-debugcallback.c | 4 +- docs/examples/multi-double.c | 4 +- docs/examples/multi-formadd.c | 4 +- docs/examples/multi-post.c | 4 +- docs/examples/multi-single.c | 4 +- docs/examples/multi-uv.c | 2 +- docs/examples/multithread.c | 2 +- docs/examples/persistant.c | 68 -------------------------- docs/examples/persistent.c | 68 ++++++++++++++++++++++++++ docs/examples/postinmemory.c | 2 +- docs/examples/postit2-formadd.c | 4 +- docs/examples/postit2.c | 4 +- docs/examples/progressfunc.c | 2 +- docs/examples/resolve.c | 6 +-- docs/examples/rtsp.c | 3 +- docs/examples/sampleconv.c | 4 +- docs/examples/sendrecv.c | 4 +- docs/examples/sepheaders.c | 4 +- docs/examples/simple.c | 4 +- docs/examples/simplepost.c | 4 +- docs/examples/smooth-gtk-thread.c | 2 +- docs/examples/synctime.c | 6 ++- docs/examples/xmlstream.c | 4 +- 35 files changed, 177 insertions(+), 175 deletions(-) delete mode 100644 docs/examples/persistant.c create mode 100644 docs/examples/persistent.c (limited to 'docs/examples') diff --git a/docs/examples/.gitignore b/docs/examples/.gitignore index 36cececc4..f04f246d8 100644 --- a/docs/examples/.gitignore +++ b/docs/examples/.gitignore @@ -46,7 +46,7 @@ multi-double multi-formadd multi-post multi-single -persistant +persistent pop3-dele pop3-list pop3-multi diff --git a/docs/examples/10-at-a-time.c b/docs/examples/10-at-a-time.c index 1da0ee210..638f425f2 100644 --- a/docs/examples/10-at-a-time.c +++ b/docs/examples/10-at-a-time.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -35,54 +35,53 @@ #include static const char *urls[] = { - "http://www.microsoft.com", - "http://www.opensource.org", - "http://www.google.com", - "http://www.yahoo.com", - "http://www.ibm.com", - "http://www.mysql.com", - "http://www.oracle.com", - "http://www.ripe.net", - "http://www.iana.org", - "http://www.amazon.com", - "http://www.netcraft.com", - "http://www.heise.de", - "http://www.chip.de", - "http://www.ca.com", - "http://www.cnet.com", - "http://www.news.com", - "http://www.cnn.com", - "http://www.wikipedia.org", - "http://www.dell.com", - "http://www.hp.com", - "http://www.cert.org", - "http://www.mit.edu", - "http://www.nist.gov", - "http://www.ebay.com", - "http://www.playstation.com", - "http://www.uefa.com", - "http://www.ieee.org", - "http://www.apple.com", - "http://www.symantec.com", - "http://www.zdnet.com", - "http://www.fujitsu.com", - "http://www.supermicro.com", - "http://www.hotmail.com", - "http://www.ecma.com", - "http://www.bbc.co.uk", - "http://news.google.com", - "http://www.foxnews.com", - "http://www.msn.com", - "http://www.wired.com", - "http://www.sky.com", - "http://www.usatoday.com", - "http://www.cbs.com", - "http://www.nbc.com", - "http://slashdot.org", - "http://www.bloglines.com", - "http://www.techweb.com", - "http://www.newslink.org", - "http://www.un.org", + "https://www.microsoft.com", + "https://opensource.org", + "https://www.google.com", + "https://www.yahoo.com", + "https://www.ibm.com", + "https://www.mysql.com", + "https://www.oracle.com", + "https://www.ripe.net", + "https://www.iana.org", + "https://www.amazon.com", + "https://www.netcraft.com", + "https://www.heise.de", + "https://www.chip.de", + "https://www.ca.com", + "https://www.cnet.com", + "https://www.mozilla.org", + "https://www.cnn.com", + "https://www.wikipedia.org", + "https://www.dell.com", + "https://www.hp.com", + "https://www.cert.org", + "https://www.mit.edu", + "https://www.nist.gov", + "https://www.ebay.com", + "https://www.playstation.com", + "https://www.uefa.com", + "https://www.ieee.org", + "https://www.apple.com", + "https://www.symantec.com", + "https://www.zdnet.com", + "https://www.fujitsu.com/global/", + "https://www.supermicro.com", + "https://www.hotmail.com", + "https://www.ietf.org", + "https://www.bbc.co.uk", + "https://news.google.com", + "https://www.foxnews.com", + "https://www.msn.com", + "https://www.wired.com", + "https://www.sky.com", + "https://www.usatoday.com", + "https://www.cbs.com", + "https://www.nbc.com/", + "https://slashdot.org", + "https://www.informationweek.com", + "https://apache.org", + "https://www.un.org", }; #define MAX 10 /* number of simultaneous transfers */ diff --git a/docs/examples/Makefile.inc b/docs/examples/Makefile.inc index d0f55eebb..f51871f06 100644 --- a/docs/examples/Makefile.inc +++ b/docs/examples/Makefile.inc @@ -24,7 +24,7 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \ fopen ftpget ftpgetresp ftpupload getinfo getinmemory http-post httpput \ https multi-app multi-debugcallback multi-double multi-post multi-single \ - persistant post-callback postit2 sepheaders simple simplepost simplessl \ + persistent post-callback postit2 sepheaders simple simplepost simplessl \ sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard \ smtp-mail smtp-mime smtp-multi smtp-ssl smtp-tls smtp-vrfy smtp-expn \ rtsp externalsocket resolve progressfunc pop3-retr pop3-list pop3-uidl \ @@ -38,9 +38,9 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \ # These examples require external dependencies that may not be commonly # available on POSIX systems, so don't bother attempting to compile them here. -COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ - ghiper.c hiperfifo.c htmltidy.c multithread.c opensslthreadlock.c \ - sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ - smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp \ - multi-uv.c xmlstream.c usercertinmem.c sessioninfo.c \ +COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cpp cacertinmem.c \ + ghiper.c hiperfifo.c htmltidy.c multithread.c opensslthreadlock.c \ + sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \ + smooth-gtk-thread.c version-check.pl href_extractor.c asiohiper.cpp \ + multi-uv.c xmlstream.c usercertinmem.c sessioninfo.c \ threaded-shared-conn.c crawler.c ephiperfifo.c diff --git a/docs/examples/Makefile.netware b/docs/examples/Makefile.netware index 9ff6d9498..8aca32558 100644 --- a/docs/examples/Makefile.netware +++ b/docs/examples/Makefile.netware @@ -3,7 +3,7 @@ ## Makefile for building curl.nlm (NetWare version - gnu make) ## Use: make -f Makefile.netware ## -## Comments to: Guenter Knauf http://www.gknw.net/phpbb +## Comments to: Guenter Knauf # ################################################################# diff --git a/docs/examples/cookie_interface.c b/docs/examples/cookie_interface.c index 2af0619b5..32e9a1d1e 100644 --- a/docs/examples/cookie_interface.c +++ b/docs/examples/cookie_interface.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -71,7 +71,7 @@ main(void) if(curl) { char nline[256]; - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* start cookie engine */ res = curl_easy_perform(curl); diff --git a/docs/examples/debug.c b/docs/examples/debug.c index 79250146d..884184a5e 100644 --- a/docs/examples/debug.c +++ b/docs/examples/debug.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -140,7 +140,7 @@ int main(void) /* example.com is redirected, so we tell libcurl to follow redirection */ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); res = curl_easy_perform(curl); /* Check for errors */ if(res != CURLE_OK) diff --git a/docs/examples/getinfo.c b/docs/examples/getinfo.c index 5585564ce..d5a820d1f 100644 --- a/docs/examples/getinfo.c +++ b/docs/examples/getinfo.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -33,7 +33,7 @@ int main(void) curl = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/"); res = curl_easy_perform(curl); if(CURLE_OK == res) { diff --git a/docs/examples/getinmemory.c b/docs/examples/getinmemory.c index a21a2aafc..130d821da 100644 --- a/docs/examples/getinmemory.c +++ b/docs/examples/getinmemory.c @@ -73,7 +73,7 @@ int main(void) curl_handle = curl_easy_init(); /* specify URL to get */ - curl_easy_setopt(curl_handle, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(curl_handle, CURLOPT_URL, "https://www.example.com/"); /* send all data to this function */ curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); diff --git a/docs/examples/getredirect.c b/docs/examples/getredirect.c index 347b1e9bc..64157f9cd 100644 --- a/docs/examples/getredirect.c +++ b/docs/examples/getredirect.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -35,7 +35,7 @@ int main(void) curl = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); /* example.com is redirected, figure out the redirection! */ diff --git a/docs/examples/href_extractor.c b/docs/examples/href_extractor.c index 16f50c0ec..aa2b43816 100644 --- a/docs/examples/href_extractor.c +++ b/docs/examples/href_extractor.c @@ -26,7 +26,7 @@ * */ /* - * The HTML parser is found at http://code.google.com/p/htmlstreamparser/ + * The HTML parser is found at https://github.com/arjunc77/htmlstreamparser */ #include diff --git a/docs/examples/htmltidy.c b/docs/examples/htmltidy.c index 44af0c51e..02d01f40b 100644 --- a/docs/examples/htmltidy.c +++ b/docs/examples/htmltidy.c @@ -24,7 +24,7 @@ * */ /* - * LibTidy => http://tidy.sourceforge.net + * LibTidy => https://www.html-tidy.org/ */ #include diff --git a/docs/examples/multi-app.c b/docs/examples/multi-app.c index fc31f5e68..78867d835 100644 --- a/docs/examples/multi-app.c +++ b/docs/examples/multi-app.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -59,7 +59,7 @@ int main(void) handles[i] = curl_easy_init(); /* set the options (I left out a few, you'll get the point anyway) */ - curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "http://example.com"); + curl_easy_setopt(handles[HTTP_HANDLE], CURLOPT_URL, "https://example.com"); curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_URL, "ftp://example.com"); curl_easy_setopt(handles[FTP_HANDLE], CURLOPT_UPLOAD, 1L); diff --git a/docs/examples/multi-debugcallback.c b/docs/examples/multi-debugcallback.c index fa95179de..59f72442a 100644 --- a/docs/examples/multi-debugcallback.c +++ b/docs/examples/multi-debugcallback.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -136,7 +136,7 @@ int main(void) http_handle = curl_easy_init(); /* set the options (I left out a few, you'll get the point anyway) */ - curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(http_handle, CURLOPT_URL, "https://www.example.com/"); curl_easy_setopt(http_handle, CURLOPT_DEBUGFUNCTION, my_trace); curl_easy_setopt(http_handle, CURLOPT_VERBOSE, 1L); diff --git a/docs/examples/multi-double.c b/docs/examples/multi-double.c index 79e44ca88..644e64b13 100644 --- a/docs/examples/multi-double.c +++ b/docs/examples/multi-double.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -48,7 +48,7 @@ int main(void) http_handle2 = curl_easy_init(); /* set options */ - curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(http_handle, CURLOPT_URL, "https://www.example.com/"); /* set options */ curl_easy_setopt(http_handle2, CURLOPT_URL, "http://localhost/"); diff --git a/docs/examples/multi-formadd.c b/docs/examples/multi-formadd.c index 975cb605e..c1bb13557 100644 --- a/docs/examples/multi-formadd.c +++ b/docs/examples/multi-formadd.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -73,7 +73,7 @@ int main(void) if(curl && multi_handle) { /* what URL that receives this POST */ - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/upload.cgi"); + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/upload.cgi"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); diff --git a/docs/examples/multi-post.c b/docs/examples/multi-post.c index fe543312a..fe66ca901 100644 --- a/docs/examples/multi-post.c +++ b/docs/examples/multi-post.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -69,7 +69,7 @@ int main(void) headerlist = curl_slist_append(headerlist, buf); /* what URL that receives this POST */ - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/upload.cgi"); + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/upload.cgi"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); diff --git a/docs/examples/multi-single.c b/docs/examples/multi-single.c index 3dca0f1af..530a5f501 100644 --- a/docs/examples/multi-single.c +++ b/docs/examples/multi-single.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -59,7 +59,7 @@ int main(void) http_handle = curl_easy_init(); /* set the options (I left out a few, you'll get the point anyway) */ - curl_easy_setopt(http_handle, CURLOPT_URL, "http://www.example.com/"); + curl_easy_setopt(http_handle, CURLOPT_URL, "https://www.example.com/"); /* init a multi stack */ multi_handle = curl_multi_init(); diff --git a/docs/examples/multi-uv.c b/docs/examples/multi-uv.c index 1d8c96f58..8ca4b9096 100644 --- a/docs/examples/multi-uv.c +++ b/docs/examples/multi-uv.c @@ -29,7 +29,7 @@ Requires libuv and (of course) libcurl. - See https://nikhilm.github.com/uvbook/ for more information on libuv. + See https://nikhilm.github.io/uvbook/ for more information on libuv. */ #include diff --git a/docs/examples/multithread.c b/docs/examples/multithread.c index e3ae8e671..83ed3f589 100644 --- a/docs/examples/multithread.c +++ b/docs/examples/multithread.c @@ -42,7 +42,7 @@ const char * const urls[NUMT]= { "https://curl.haxx.se/", "ftp://cool.haxx.se/", - "http://www.contactor.se/", + "https://www.cag.se/", "www.haxx.se" }; diff --git a/docs/examples/persistant.c b/docs/examples/persistant.c deleted file mode 100644 index a1e614bdb..000000000 --- a/docs/examples/persistant.c +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2015, 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 https://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. - * - ***************************************************************************/ -/* - * re-using handles to do HTTP persistent connections - * - */ -#include -#include -#include - -int main(void) -{ - CURL *curl; - CURLcode res; - - curl_global_init(CURL_GLOBAL_ALL); - - curl = curl_easy_init(); - if(curl) { - curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); - curl_easy_setopt(curl, CURLOPT_HEADER, 1L); - - /* get the first document */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); - - /* 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)); - - /* get another document from the same server using the same - connection */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/docs/"); - - /* 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)); - - /* always cleanup */ - curl_easy_cleanup(curl); - } - - return 0; -} diff --git a/docs/examples/persistent.c b/docs/examples/persistent.c new file mode 100644 index 000000000..723b68b8b --- /dev/null +++ b/docs/examples/persistent.c @@ -0,0 +1,68 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2018, 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 https://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. + * + ***************************************************************************/ +/* + * re-using handles to do HTTP persistent connections + * + */ +#include +#include +#include + +int main(void) +{ + CURL *curl; + CURLcode res; + + curl_global_init(CURL_GLOBAL_ALL); + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_HEADER, 1L); + + /* get the first document */ + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); + + /* 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)); + + /* get another document from the same server using the same + connection */ + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/docs/"); + + /* 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)); + + /* always cleanup */ + curl_easy_cleanup(curl); + } + + return 0; +} diff --git a/docs/examples/postinmemory.c b/docs/examples/postinmemory.c index 176f24af3..25a1e8eae 100644 --- a/docs/examples/postinmemory.c +++ b/docs/examples/postinmemory.c @@ -68,7 +68,7 @@ int main(void) curl = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.org/"); + curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.org/"); /* send all data to this function */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); diff --git a/docs/examples/postit2-formadd.c b/docs/examples/postit2-formadd.c index 0ac09f259..a501ce964 100644 --- a/docs/examples/postit2-formadd.c +++ b/docs/examples/postit2-formadd.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) headerlist = curl_slist_append(headerlist, buf); if(curl) { /* what URL that receives this POST */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/examplepost.cgi"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/examplepost.cgi"); if((argc == 2) && (!strcmp(argv[1], "noexpectheader"))) /* only disable 100-continue header if explicitly requested */ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); diff --git a/docs/examples/postit2.c b/docs/examples/postit2.c index 49391e1cd..2808f7a4e 100644 --- a/docs/examples/postit2.c +++ b/docs/examples/postit2.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) wanted */ headerlist = curl_slist_append(headerlist, buf); /* what URL that receives this POST */ - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/examplepost.cgi"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/examplepost.cgi"); if((argc == 2) && (!strcmp(argv[1], "noexpectheader"))) /* only disable 100-continue header if explicitly requested */ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); diff --git a/docs/examples/progressfunc.c b/docs/examples/progressfunc.c index 51d75366c..86ad0d9ca 100644 --- a/docs/examples/progressfunc.c +++ b/docs/examples/progressfunc.c @@ -108,7 +108,7 @@ int main(void) prog.lastruntime = 0; prog.curl = curl; - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); #if LIBCURL_VERSION_NUM >= 0x072000 /* xferinfo was introduced in 7.32.0, no earlier libcurl versions will diff --git a/docs/examples/resolve.c b/docs/examples/resolve.c index 15e343f9e..c3b52d6f0 100644 --- a/docs/examples/resolve.c +++ b/docs/examples/resolve.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -38,12 +38,12 @@ int main(void) PORT is the port number of the service where libcurl wants to connect to the HOST and ADDRESS is the numerical IP address */ - host = curl_slist_append(NULL, "example.com:80:127.0.0.1"); + host = curl_slist_append(NULL, "example.com:443:127.0.0.1"); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_RESOLVE, host); - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); res = curl_easy_perform(curl); /* always cleanup */ diff --git a/docs/examples/rtsp.c b/docs/examples/rtsp.c index 32084e9ef..75b5d396c 100644 --- a/docs/examples/rtsp.c +++ b/docs/examples/rtsp.c @@ -192,7 +192,8 @@ int main(int argc, char * const argv[]) char *base_name = NULL; printf("\nRTSP request %s\n", VERSION_STR); - printf(" Project web site: http://code.google.com/p/rtsprequest/\n"); + printf(" Project web site: " + "https://github.com/BackupGGCode/rtsprequest\n"); printf(" Requires curl V7.20 or greater\n\n"); /* check command line */ diff --git a/docs/examples/sampleconv.c b/docs/examples/sampleconv.c index 96eff4669..7bfaa51c6 100644 --- a/docs/examples/sampleconv.c +++ b/docs/examples/sampleconv.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -94,7 +94,7 @@ int main(void) curl = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); /* use platform-specific functions for codeset conversions */ curl_easy_setopt(curl, CURLOPT_CONV_FROM_NETWORK_FUNCTION, diff --git a/docs/examples/sendrecv.c b/docs/examples/sendrecv.c index eedaf4cde..cf764be43 100644 --- a/docs/examples/sendrecv.c +++ b/docs/examples/sendrecv.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); /* Do not do the transfer - only connect to host */ curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1L); res = curl_easy_perform(curl); diff --git a/docs/examples/sepheaders.c b/docs/examples/sepheaders.c index a865d5796..8f3a5ff0f 100644 --- a/docs/examples/sepheaders.c +++ b/docs/examples/sepheaders.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -49,7 +49,7 @@ int main(void) curl_handle = curl_easy_init(); /* set URL to get */ - curl_easy_setopt(curl_handle, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl_handle, CURLOPT_URL, "https://example.com"); /* no progress meter please */ curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, 1L); diff --git a/docs/examples/simple.c b/docs/examples/simple.c index 7226f4b94..c61227054 100644 --- a/docs/examples/simple.c +++ b/docs/examples/simple.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -33,7 +33,7 @@ int main(void) curl = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); /* example.com is redirected, so we tell libcurl to follow redirection */ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); diff --git a/docs/examples/simplepost.c b/docs/examples/simplepost.c index e366f001b..8ec537b54 100644 --- a/docs/examples/simplepost.c +++ b/docs/examples/simplepost.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2017, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2018, 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 @@ -36,7 +36,7 @@ int main(void) curl = curl_easy_init(); if(curl) { - curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); + curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis); /* if we don't provide POSTFIELDSIZE, libcurl will strlen() by diff --git a/docs/examples/smooth-gtk-thread.c b/docs/examples/smooth-gtk-thread.c index 8451743a6..5a4f18fd9 100644 --- a/docs/examples/smooth-gtk-thread.c +++ b/docs/examples/smooth-gtk-thread.c @@ -64,7 +64,7 @@ size_t write_file(void *ptr, size_t size, size_t nmemb, FILE *stream) return fwrite(ptr, size, nmemb, stream); } -/* http://xoap.weather.com/weather/local/46214?cc=*&dayf=5&unit=i */ +/* https://weather.com/weather/today/l/46214?cc=*&dayf=5&unit=i */ void *pull_one_url(void *NaN) { CURL *curl; diff --git a/docs/examples/synctime.c b/docs/examples/synctime.c index 596962dc2..d84cea913 100644 --- a/docs/examples/synctime.c +++ b/docs/examples/synctime.c @@ -63,8 +63,10 @@ * webserver provide Cache-Control to prevent caching. * * References: - * https://web.archive.org/web/20100228012139/tf.nist.gov/timefreq/service/its.htm - * https://web.archive.org/web/20100409024302/tf.nist.gov/timefreq/service/firewall.htm + * https://web.archive.org/web/20100228012139/ \ + * tf.nist.gov/timefreq/service/its.htm + * https://web.archive.org/web/20100409024302/ \ + * tf.nist.gov/timefreq/service/firewall.htm * * Usage: * This software will synchronise your computer clock only when you issue diff --git a/docs/examples/xmlstream.c b/docs/examples/xmlstream.c index 296ae3b26..8036e480d 100644 --- a/docs/examples/xmlstream.c +++ b/docs/examples/xmlstream.c @@ -25,7 +25,7 @@ */ /* Written by David Strauss * - * Expat => http://www.libexpat.org/ + * Expat => https://libexpat.github.io/ * * gcc -Wall -I/usr/local/include xmlstream.c -lcurl -lexpat -o xmlstream * @@ -131,7 +131,7 @@ int main(void) curl_global_init(CURL_GLOBAL_DEFAULT); curl_handle = curl_easy_init(); curl_easy_setopt(curl_handle, CURLOPT_URL, - "http://www.w3schools.com/xml/simple.xml"); + "https://www.w3schools.com/xml/simple.xml"); curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, parseStreamCallback); curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)parser); -- cgit v1.2.3