Loading docs/examples/cacertinmem.c +16 −16 Original line number Diff line number Diff line Loading @@ -123,26 +123,26 @@ int main(void) CURL *ch; CURLcode rv; rv = curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); ch = curl_easy_init(); rv = curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); rv = curl_easy_setopt(ch, CURLOPT_HEADER, 0L); rv = curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); rv = curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); rv = curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, *writefunction); rv = curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); rv = curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, *writefunction); rv = curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); rv = curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 1L); rv = curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); curl_easy_setopt(ch, CURLOPT_HEADER, 0L); curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, *writefunction); curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, *writefunction); curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 1L); curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); /* Turn off the default CA locations, otherwise libcurl will load CA * certificates from the locations that were detected/specified at * build-time */ rv = curl_easy_setopt(ch, CURLOPT_CAINFO, NULL); rv = curl_easy_setopt(ch, CURLOPT_CAPATH, NULL); curl_easy_setopt(ch, CURLOPT_CAINFO, NULL); curl_easy_setopt(ch, CURLOPT_CAPATH, NULL); /* first try: retrieve page without ca certificates -> should fail * unless libcurl was built --with-ca-fallback enabled at build-time Loading @@ -162,13 +162,13 @@ int main(void) * handle. normally you would set the ssl ctx function before making * any transfers, and not use this option. */ rv = curl_easy_setopt(ch, CURLOPT_FRESH_CONNECT, 1L); curl_easy_setopt(ch, CURLOPT_FRESH_CONNECT, 1L); /* second try: retrieve page using cacerts' certificate -> will succeed * load the certificate by installing a function doing the necessary * "modifications" to the SSL CONTEXT just before link init */ rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); rv = curl_easy_perform(ch); if(rv == CURLE_OK) printf("*** transfer succeeded ***\n"); Loading docs/examples/resolve.c +2 −2 Original line number Diff line number Diff line Loading @@ -31,14 +31,14 @@ int main(void) { CURL *curl; CURLcode res = CURLE_OK; struct curl_slist *host = NULL; /* Each single name resolve string should be written using the format HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, 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:443:127.0.0.1"); struct curl_slist *host = curl_slist_append(NULL, "example.com:443:127.0.0.1"); curl = curl_easy_init(); if(curl) { Loading docs/examples/sftpuploadresume.c +1 −2 Original line number Diff line number Diff line Loading @@ -49,9 +49,8 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile) { CURLcode result = CURLE_GOT_NOTHING; curl_off_t remoteFileSizeByte = -1; CURL *curlHandlePtr = NULL; CURL *curlHandlePtr = curl_easy_init(); curlHandlePtr = curl_easy_init(); curl_easy_setopt(curlHandlePtr, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curlHandlePtr, CURLOPT_URL, i_remoteFile); Loading docs/examples/usercertinmem.c +15 −15 Original line number Diff line number Diff line Loading @@ -177,25 +177,25 @@ int main(void) CURL *ch; CURLcode rv; rv = curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); ch = curl_easy_init(); rv = curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); rv = curl_easy_setopt(ch, CURLOPT_HEADER, 0L); rv = curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); rv = curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); rv = curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, writefunction); rv = curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); rv = curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, writefunction); rv = curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); rv = curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); curl_easy_setopt(ch, CURLOPT_HEADER, 0L); curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, writefunction); curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, writefunction); curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); /* both VERIFYPEER and VERIFYHOST are set to 0 in this case because there is no CA certificate*/ rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L); rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0L); rv = curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); rv = curl_easy_setopt(ch, CURLOPT_SSLKEYTYPE, "PEM"); curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); curl_easy_setopt(ch, CURLOPT_SSLKEYTYPE, "PEM"); /* first try: retrieve page without user certificate and key -> will fail */ Loading @@ -211,7 +211,7 @@ int main(void) * load the certificate and key by installing a function doing the necessary * "modifications" to the SSL CONTEXT just before link init */ rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); rv = curl_easy_perform(ch); if(rv == CURLE_OK) { printf("*** transfer succeeded ***\n"); Loading Loading
docs/examples/cacertinmem.c +16 −16 Original line number Diff line number Diff line Loading @@ -123,26 +123,26 @@ int main(void) CURL *ch; CURLcode rv; rv = curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); ch = curl_easy_init(); rv = curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); rv = curl_easy_setopt(ch, CURLOPT_HEADER, 0L); rv = curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); rv = curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); rv = curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, *writefunction); rv = curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); rv = curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, *writefunction); rv = curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); rv = curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 1L); rv = curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); curl_easy_setopt(ch, CURLOPT_HEADER, 0L); curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, *writefunction); curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, *writefunction); curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 1L); curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); /* Turn off the default CA locations, otherwise libcurl will load CA * certificates from the locations that were detected/specified at * build-time */ rv = curl_easy_setopt(ch, CURLOPT_CAINFO, NULL); rv = curl_easy_setopt(ch, CURLOPT_CAPATH, NULL); curl_easy_setopt(ch, CURLOPT_CAINFO, NULL); curl_easy_setopt(ch, CURLOPT_CAPATH, NULL); /* first try: retrieve page without ca certificates -> should fail * unless libcurl was built --with-ca-fallback enabled at build-time Loading @@ -162,13 +162,13 @@ int main(void) * handle. normally you would set the ssl ctx function before making * any transfers, and not use this option. */ rv = curl_easy_setopt(ch, CURLOPT_FRESH_CONNECT, 1L); curl_easy_setopt(ch, CURLOPT_FRESH_CONNECT, 1L); /* second try: retrieve page using cacerts' certificate -> will succeed * load the certificate by installing a function doing the necessary * "modifications" to the SSL CONTEXT just before link init */ rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); rv = curl_easy_perform(ch); if(rv == CURLE_OK) printf("*** transfer succeeded ***\n"); Loading
docs/examples/resolve.c +2 −2 Original line number Diff line number Diff line Loading @@ -31,14 +31,14 @@ int main(void) { CURL *curl; CURLcode res = CURLE_OK; struct curl_slist *host = NULL; /* Each single name resolve string should be written using the format HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, 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:443:127.0.0.1"); struct curl_slist *host = curl_slist_append(NULL, "example.com:443:127.0.0.1"); curl = curl_easy_init(); if(curl) { Loading
docs/examples/sftpuploadresume.c +1 −2 Original line number Diff line number Diff line Loading @@ -49,9 +49,8 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile) { CURLcode result = CURLE_GOT_NOTHING; curl_off_t remoteFileSizeByte = -1; CURL *curlHandlePtr = NULL; CURL *curlHandlePtr = curl_easy_init(); curlHandlePtr = curl_easy_init(); curl_easy_setopt(curlHandlePtr, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curlHandlePtr, CURLOPT_URL, i_remoteFile); Loading
docs/examples/usercertinmem.c +15 −15 Original line number Diff line number Diff line Loading @@ -177,25 +177,25 @@ int main(void) CURL *ch; CURLcode rv; rv = curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL); ch = curl_easy_init(); rv = curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); rv = curl_easy_setopt(ch, CURLOPT_HEADER, 0L); rv = curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); rv = curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); rv = curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, writefunction); rv = curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); rv = curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, writefunction); rv = curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); rv = curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); curl_easy_setopt(ch, CURLOPT_VERBOSE, 0L); curl_easy_setopt(ch, CURLOPT_HEADER, 0L); curl_easy_setopt(ch, CURLOPT_NOPROGRESS, 1L); curl_easy_setopt(ch, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, writefunction); curl_easy_setopt(ch, CURLOPT_WRITEDATA, stdout); curl_easy_setopt(ch, CURLOPT_HEADERFUNCTION, writefunction); curl_easy_setopt(ch, CURLOPT_HEADERDATA, stderr); curl_easy_setopt(ch, CURLOPT_SSLCERTTYPE, "PEM"); /* both VERIFYPEER and VERIFYHOST are set to 0 in this case because there is no CA certificate*/ rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L); rv = curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0L); rv = curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); rv = curl_easy_setopt(ch, CURLOPT_SSLKEYTYPE, "PEM"); curl_easy_setopt(ch, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(ch, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt(ch, CURLOPT_URL, "https://www.example.com/"); curl_easy_setopt(ch, CURLOPT_SSLKEYTYPE, "PEM"); /* first try: retrieve page without user certificate and key -> will fail */ Loading @@ -211,7 +211,7 @@ int main(void) * load the certificate and key by installing a function doing the necessary * "modifications" to the SSL CONTEXT just before link init */ rv = curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); curl_easy_setopt(ch, CURLOPT_SSL_CTX_FUNCTION, *sslctx_function); rv = curl_easy_perform(ch); if(rv == CURLE_OK) { printf("*** transfer succeeded ***\n"); Loading