diff options
author | Simon Ser <contact@emersion.fr> | 2020-02-05 13:56:18 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-02-05 13:56:18 +0100 |
commit | 3263a89185e27031dbde7007eb4b71db4cd3c54f (patch) | |
tree | 84278eaf9eeecae90289df649d0a56c8bc0d4e2d /plugins/carddav | |
parent | ad256906e0f9f23d97bec268b980154726621e8a (diff) | |
download | alps-3263a89185e27031dbde7007eb4b71db4cd3c54f.tar.gz alps-3263a89185e27031dbde7007eb4b71db4cd3c54f.zip |
plugins/carddav: accept "carddavs" and "carddav+insecure" URL schemes
Diffstat (limited to 'plugins/carddav')
-rw-r--r-- | plugins/carddav/plugin.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/carddav/plugin.go b/plugins/carddav/plugin.go index 5f51069..317a0d0 100644 --- a/plugins/carddav/plugin.go +++ b/plugins/carddav/plugin.go @@ -41,14 +41,17 @@ func (rt *authRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) } func newPlugin(srv *koushin.Server) (koushin.Plugin, error) { - u, err := srv.Upstream("https", "http+insecure") + u, err := srv.Upstream("carddavs", "carddav+insecure", "https", "http+insecure") if _, ok := err.(*koushin.NoUpstreamError); ok { srv.Logger().Print("carddav: no upstream server provided") return nil, nil } else if err != nil { return nil, fmt.Errorf("carddav: failed to parse upstream CardDAV server: %v", err) } - if u.Scheme == "http+insecure" { + switch u.Scheme { + case "carddavs": + u.Scheme = "https" + case "carddav+insecure", "http+insecure": u.Scheme = "http" } if u.Scheme == "" { |