plugins/carddav: accept "carddavs" and "carddav+insecure" URL schemes

This commit is contained in:
Simon Ser 2020-02-05 13:56:18 +01:00
parent ad256906e0
commit 3263a89185
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -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 == "" {