Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
3154f04f
Commit
3154f04f
authored
17 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
now builds and runs with GnuTLS-built libcurls too
parent
6982ed4d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/examples/threaded-ssl.c
+25
-4
25 additions, 4 deletions
docs/examples/threaded-ssl.c
with
25 additions
and
4 deletions
docs/examples/threaded-ssl.c
+
25
−
4
View file @
3154f04f
...
...
@@ -8,20 +8,26 @@
* $Id$
*
* A multi-threaded example that uses pthreads and fetches 4 remote files at
* once over HTTPS. The lock callbacks and stuff assume OpenSSL
so far.
*
Should be expanded to do optional GnuTLS style locking
.
* once over HTTPS. The lock callbacks and stuff assume OpenSSL
or GnuTLS
*
(libgcrypt) so far
.
*
* OpenSSL docs for this: http://www.openssl.org/docs/crypto/threads.html
* OpenSSL docs for this:
* http://www.openssl.org/docs/crypto/threads.html
* gcrypt docs for this:
* http://gnupg.org/documentation/manuals/gcrypt/Multi_002dThreading.html
*/
#define USE_OPENSSL
/* or USE_GNUTLS accordingly */
#include
<stdio.h>
#include
<pthread.h>
#include
<curl/curl.h>
#include
<openssl/crypto.h>
/* we have this global to let the callback get easy access to it */
static
pthread_mutex_t
*
lockarray
;
#ifdef USE_OPENSSL
#include
<openssl/crypto.h>
static
void
lock_callback
(
int
mode
,
int
type
,
char
*
file
,
int
line
)
{
(
void
)
file
;
...
...
@@ -66,6 +72,21 @@ static void kill_locks(void)
OPENSSL_free
(
lockarray
);
}
#endif
#ifdef USE_GNUTLS
#include
<gcrypt.h>
#include
<errno.h>
GCRY_THREAD_OPTION_PTHREAD_IMPL
;
void
init_locks
(
void
)
{
gcry_control
(
GCRYCTL_SET_THREAD_CBS
);
}
#define kill_locks()
#endif
/* List of URLs to fetch.*/
const
char
*
urls
[]
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment