Commit Graph

5 Commits

Author SHA1 Message Date
Sunny 3d4b9b97d1
Add option to configure http/s managed transport
This change introduces NewRegisterSmartTransportWithOptions() to help
configure the smart transport with SmartSubtransportOptions. If the
default smart subtransport client needs to be configured, a newly
configured smart transport can be registered and used.
The SmartSubtransportOptions includes CABundle only for now.

This enables creating and using new transport with secrets that can be
deleted and not shared with subsequent operations.

The http client from httpSmartSubtransport is now shared with the
underlying httpSmartSubtransportStream, reusing the client and its
configurations.

It also fixes the error during cloning:
```
unable to clone: Post "http://test-user:***@127.0.0.1:40463/bar/test-reponame/git-upload-pack": io: read/write on closed pipe
```
by using credentials if available and avoiding failure due to
unauthorized request.

A user of the smart transport who needs to add a CA bundle in the
http client can do the following to setup the smart transport before
cloning:

```
stOpts := &git2go.SmartSubtransportOptions{CABundle: opts.CAFile}
rst, err := git2go.NewRegisterSmartTransportWithOptions("https", stOpts)
if err != nil {
	return err
}
if rst != nil {
	defer rst.Free()
}
```
2021-11-22 19:56:43 +05:30
Yashodhan Ghadge 0e8009f00a
bugfix: HTTPS Clone fails with remote pointer not found using Go transport (#836) (#842)
Fixes: #836 

Changes:

* adding a weak bool param for Remote
* create a new remote in the smartTransportCallback incase one is not found
2021-10-23 10:33:10 -07:00
lhchavez dcc9331226
Expose the ssh.PublicKey into the CertificateCheckCallback (#818)
This change exposes the raw SSH hostkey and the ssh.PublicKey into the
CertificateCheckCallback, so that callers can do better validations.
2021-09-05 19:00:59 -07:00
lhchavez b983e1daeb
Add support for managed HTTP/S transports (#810)
This change uses the newly-exposed Transport interface to use Go's
implementation of http.Client instead of httpclient via libgit2.
2021-09-05 16:39:07 -07:00
lhchavez f1fa96c7b7
Add support for custom smart transports (#806)
This change adds support for git smart transports. This will be then
used to implement http, https, and ssh transports that don't rely on the
libgit2 library.
2021-09-05 15:44:18 -07:00