Add option to configure http/s managed transport #870
Loading…
Reference in New Issue
No description provided.
Delete Branch "darkowlzz/http-go-transport-fix-2"
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 change introduces
NewRegisterSmartTransportWithOptions()
to helpconfigure the smart transport with
SmartSubtransportOptions
. If thedefault 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 in
httpSmartSubtransport
is now shared with theunderlying
httpSmartSubtransportStream
, reusing the client and itsconfigurations.
It also fixes the error during cloning:
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:
NOTE: This is a rewrite of the fix in #858 to avoid creating a global cert pool. Similar to #858, I would like to have some guidance in understanding if this implementation is the right approach and addressing any possible issues due to this change.
Refer #858 for background and more information about this change.
@darkowlzz if you replace
req, err = http.NewRequest("POST", url+"/info/refs?service=git-receive-pack", nil)
withreq, err = http.NewRequest("POST", url+"/git-receive-pack", nil)
everything works for me. Thank you very much for your work!we're getting
Post ...: io: read/write on closed pipe
when fetching over https with basic auth, does this PR suggest it is not currently supported?fwiw it was working on version v31.4.14
@tylerphelan I experienced the same and this PR is an attempt to fix that. It's documented in https://github.com/libgit2/git2go/pull/858 how I attempted to fix the closed pipe error.
Do you get the same error with this fix? I thought I did test it with basic auth.
@darkowlzz worked for me, thanks for this PR!
Curious if this is going to be merged?
Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.