diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-19 00:18:03 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-04-23 17:39:51 +0200 |
commit | 6946a3be953446b2838857de5e9c2002843499b3 (patch) | |
tree | 2bb5ad852c8bfd9dded0afb14904052889394edc /src/tls_stream.c | |
parent | 6bb54cbff3636e42ae2523afeee08079e5bd1d5f (diff) | |
download | libgit2-6946a3be953446b2838857de5e9c2002843499b3.tar.gz |
Abstract away the TLS stream implementation
Instead, provide git_tls_stream_new() to ask for the most appropriate
encrypted stream and use it in our HTTP transport.
Diffstat (limited to 'src/tls_stream.c')
-rw-r--r-- | src/tls_stream.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tls_stream.c b/src/tls_stream.c new file mode 100644 index 000000000..d44709af4 --- /dev/null +++ b/src/tls_stream.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ + +#include "git2/errors.h" +#include "common.h" + +#include "openssl_stream.h" +#include "stransport_stream.h" + +int git_tls_stream_new(git_stream **out, const char *host, const char *port) +{ +#ifdef GIT_SECURE_TRANSPORT + return git_stransport_stream_new(out, host, port); +#elif defined(GIT_SSL) + return git_openssl_stream_new(out, host, port); +#else + GIT_UNUSED(out); + GIT_UNUSED(host); + GIT_UNUSED(port); + + giterr_set(GITERR_SSL, "there is no TLS stream available"); + return -1; +#endif +} |