Cannot use self signed certificate
Created by: jeremy-clerc
- Sourcegraph version: 3.3.0
- Platform information: Docker sourcegraph/server:3.3.0
Steps to reproduce:
- Add GitLab projects external service, set "certificate"
Expected behavior:
Created! / Updated!
Actual behavior:
19:35:06 repo-updater | t=2019-04-20T19:35:06+0000 lvl=eror msg=migrate error="migrate.repos-enabled-state-deprecation.list-sources: 1 error occurred:\n\t* httpcli.NewCertPoolOpt: http.Client.Transport is not an *http.Transport\n\n" waiting=5s
https://github.com/sourcegraph/sourcegraph/blob/master/pkg/httpcli/client.go#L120
http.Client.Transport
is nil
Digging a bit, the Factory comes from:
repos.NewHTTPClientFactory
(https://github.com/sourcegraph/sourcegraph/blob/master/cmd/repo-updater/repos/util.go#L41)
With a custom certificate, because of the order in https://github.com/sourcegraph/sourcegraph/blob/master/pkg/httpcli/client.go#L69, NewCertPoolOpt
is called first and http.Client.Transport
is nil.
I am creating a PR to init http.Client.Transport
to http.DefaultTransport
, like in httpcli.NewCachedTransportOpt
and TracedTransportOpt
.
If you think NewFactory should append common options before base options, let me know, and I will close the PR in favor of a new one to invert NewFactory options order to first append common, then base.