[WIP] Use a managed HTTP(S) transport implementation #374
Loading…
Reference in New Issue
No description provided.
Delete Branch "cmn/go-http"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a bit like #372 but goes further by replacing the whole HTTP stack and just leaving the logic in libgit2. This lets us use the Go HTTP code as well, instead of the one in the library.
The current state is enough to let the tests work but there is no custom proxy configuration available and we don't currently test that authentication actually works.
Proxy support depends on libgit2/libgit2#4206 or similar getting merged. I guess we'll have to add poxyproxy to our tests as well so it doesn't regress.
While this is useful by itself (by taking us completely away from OpenSSL and libcurl in libgit2), a potentially more exciting outcome might be to build on the lessons from this to build a managed ssh transport, which would eliminate the need for libssh2.
@carlosmn This is pretty exciting, I actually hacked on implementing pure-go transports a few months ago. Would be great to reduce the surface area of C code and potential memory leaks.
We've had issues with
libgit2
memory leaks on long running daemons, thego
heap is rarely over10MB
but the process' resident memory grows to gigabytes.I also explored a more radical approach and hacked together a fairly useable
git2go
compatible lib calledgo2git
that wraps https://github.com/src-d/go-git (so it's 100% go with no C code).@ -0,0 +417,4 @@
header.Data = uintptr(unsafe.Pointer(data))
n, err := stream.Read(p)
if err != nil {
Per https://golang.org/pkg/io/#Reader, this should be
you should also be able to add something along the lines of
Hi! I did a small refactoring of this change and
a) split it between creating a Transport interface and implementing the HTTP/HTTPs transports
b) did what you mentioned in the first commit and did the SSH transport
with that, libgit2 can be compiled without openssh and openssl! with a bit more work, we can probably make it fully static.
you can find the refactor here: https://github.com/lhchavez/git2go/commits/transports what would be the best course of action to move this change forward?
I just landed https://github.com/libgit2/git2go/pull/810, which was heavily based upon this change, with proxy support!
Pull request closed