Skip to content

there is no TLS stream available using http:// or https://` #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lytico opened this issue Feb 11, 2021 · 5 comments
Closed

there is no TLS stream available using http:// or https://` #3

lytico opened this issue Feb 11, 2021 · 5 comments

Comments

@lytico
Copy link
Member

lytico commented Feb 11, 2021

Checks out repo OK using git:// protocol, but fails with error there is no TLS stream available using http:// or https:// protocols.

Reproduction steps

dotdevelop/dotdevelop#52 (comment)

or

run tests with http-checkout
see: https://github.com/dotdevelop/libgit2sharp/runs/1770928010?check_suite_focus=true

Expected behavior

Actual behavior

Version of LibGit2Sharp (release number or SHA1)

[3a544af]

Operating system(s) tested; .NET runtime tested

Arch

.NET Core SDK Version: 3.1.403

@hwthomas
Copy link

Same behaviour No TLS Stream available confirmed on Mint and fedora.

@hwthomas
Copy link

hwthomas commented Mar 8, 2021

The error text "there is no TLS stream available" occurs only in libgit2/src/tls_stream.c -

int git_tls_stream_new(git_stream **out, const char *host, const char *port)
{
    if (tls_ctor)
        return tls_ctor(out, host, port);

    #ifdef GIT_SECURE_TRANSPORT
        return git_stransport_stream_new(out, host, port);
    #elif defined(GIT_OPENSSL)
        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
}

the #ifdefs check compile-time constants GIT_SECURE_TRANSPORT and GIT_OPENSSL which are set by the first pass of cmake .. as it tests the build environment, so an error is set only if these constants are not defined. This suggests that VersionControl->Checkout is displaying the error message with http or https protocols not because of a bug but because libgit2sharp.nativebinaries are being built without them.

A dis-assembly of libgit2-6777db8.so confirms that there is no call to git_stransport_stream_new or git_open_ssl_stream_new in git_tls_stream_new.

I've not yet looked in detail into building the nuget package for LibGit2Sharp.Nativebinaries, and why (eg) GIT_OPENSSL is not being set by cmake at compile time. The openssl 1.1.1j-1 package is definitely on my machine, so I would expect it to be detected.

@lytico - any thoughts?

@lytico
Copy link
Member Author

lytico commented Mar 12, 2021

cloning from https://github.com/libgit2/libgit2sharp/tree/master/ and making some changes,
most of the tests run: https://github.com/dotdevelop/libgit2sharp/actions/runs/646029208
at least no problem with there is no TLS stream available

branch: https://github.com/dotdevelop/libgit2sharp/tree/dd/repos/libgit2/master

so this proves the problem is NOT in LibGit2Sharp.Nativebinaries, cause the package version is the same.

i guess the critical parts are here:

https://github.com/dotdevelop/libgit2sharp/blob/dd/repos/libgit2/master/LibGit2Sharp/Core/NativeMethods.cs

and try adding

https://github.com/dotdevelop/libgit2sharp/blob/dd/repos/libgit2/master/LibGit2Sharp/Core/ManagedHttpSmartSubtransport.cs

maybe more changes are needed.

@lytico
Copy link
Member Author

lytico commented Mar 12, 2021

@lytico
Copy link
Member Author

lytico commented Mar 12, 2021

solved, and in dotdevelop/dotdevelop

@lytico lytico closed this as completed Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants