From 9c62dbf186a6cef6bef5c441b074c3b9f5857e09 Mon Sep 17 00:00:00 2001 From: Jille Timmermans Date: Sat, 19 Aug 2023 15:53:02 +0200 Subject: [PATCH] pkgsite: allow using non-https over localhost for the index --- internal/index/index.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/index/index.go b/internal/index/index.go index cba8b4fd8..4b112ba26 100644 --- a/internal/index/index.go +++ b/internal/index/index.go @@ -39,7 +39,7 @@ func New(rawurl string) (_ *Client, err error) { if err != nil { return nil, fmt.Errorf("url.Parse(%q): %v", rawurl, err) } - if u.Scheme != "https" { + if u.Scheme != "https" && (u.Scheme != "http" || u.Hostname() != "localhost") { return nil, fmt.Errorf("scheme must be https (got %s)", u.Scheme) } return &Client{url: strings.TrimRight(rawurl, "/"), httpClient: &http.Client{Transport: &ochttp.Transport{}}}, nil