diff options
| author | Jean Barkhuysen <jean.barkhuysen@gmail.com> | 2025-07-02 09:52:29 -0400 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2025-07-11 14:35:51 -0700 |
| commit | d4fd0614134092087d2d5b43811ff9e7daefa894 (patch) | |
| tree | 515a28d3a24386a8c634ebe1dc96a6c31f555d21 | |
| parent | 5832fae199582fcbb9ba1736cb194631d0667737 (diff) | |
| download | go-x-pkgsite-d4fd0614134092087d2d5b43811ff9e7daefa894.tar.xz | |
internal/worker: don't require https index URLs
Sometimes the golang index has a good reason to have an http address:
- It's running locally on your dev machine.
- It's running in production, but on a network-local address.
This removes the https requirement that we have to patch in at the moment.
Change-Id: Ib6577a63463c5b2e7cc537532a9ca20ac63fd1d4
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/685456
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
| -rw-r--r-- | internal/index/index.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/internal/index/index.go b/internal/index/index.go index cba8b4fd..f331d753 100644 --- a/internal/index/index.go +++ b/internal/index/index.go @@ -31,17 +31,13 @@ type Client struct { } // New constructs a *Client using the provided rawurl, which is expected to -// be an absolute URI that can be directly passed to http.Get. +// be able to be passed to http.Get. func New(rawurl string) (_ *Client, err error) { defer derrors.Add(&err, "index.New(%q)", rawurl) - u, err := url.Parse(rawurl) - if err != nil { + if _, err := url.Parse(rawurl); err != nil { return nil, fmt.Errorf("url.Parse(%q): %v", rawurl, err) } - if u.Scheme != "https" { - 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 } |
