Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: custom import paths not processed from https resource that 404 #13037

Closed
tv42 opened this issue Oct 23, 2015 · 4 comments
Closed

cmd/go: custom import paths not processed from https resource that 404 #13037

tv42 opened this issue Oct 23, 2015 · 4 comments
Milestone

Comments

@tv42
Copy link

tv42 commented Oct 23, 2015

$ go version
go version go1.5.1 linux/amd64

# FAILS
$ go get -v bosun.org/cmd/bosun/cache
Fetching https://bosun.org/cmd/bosun/cache?go-get=1
ignoring https fetch with status code 404
Parsing meta tags from https://bosun.org/cmd/bosun/cache?go-get=1 (status code 404)
import "bosun.org/cmd/bosun/cache": parsing bosun.org/cmd/bosun/cache: http: read on closed response body
package bosun.org/cmd/bosun/cache: unrecognized import path "bosun.org/cmd/bosun/cache"

# WORKS
$ go get -v -insecure bosun.org/cmd/bosun/cache
Fetching https://bosun.org/cmd/bosun/cache?go-get=1
ignoring https fetch with status code 404
Fetching http://bosun.org/cmd/bosun/cache?go-get=1
Parsing meta tags from http://bosun.org/cmd/bosun/cache?go-get=1 (status code 404)
get "bosun.org/cmd/bosun/cache": found meta tag main.metaImport{Prefix:"bosun.org", VCS:"git", RepoRoot:"https://github.com/bosun-monitor/bosun.git"} at http://bosun.org/cmd/bosun/cache?go-get=1
get "bosun.org/cmd/bosun/cache": verifying non-authoritative meta tag
Fetching https://bosun.org?go-get=1
Parsing meta tags from https://bosun.org?go-get=1 (status code 200)
bosun.org (download)
...

$ curl -s 'https://bosun.org/cmd/bosun/cache?go-get=1' |grep go-import
    <meta name="go-import" content="bosun.org git https://github.com/bosun-monitor/bosun.git">

Same thing happens with bazil.org/fuse/fs/fstestutil, which is a 404 but with the correct meta tag.

Looks like an unintended side effect of

932c8ddb (Brad Fitzpatrick    2012-03-05 22:36:15 -0800  85)    urlStr, res, err := fetch("https")
932c8ddb (Brad Fitzpatrick    2012-03-05 22:36:15 -0800  86)    if err != nil || res.StatusCode != 200 {

where the expected action would be to parse even a 404 page for meta tags, because that's what the plaintext version does.

If this is not fixed, one cannot easily serve those meta tags from a secure static site; updating the website every time a package is created, just to avoid the 404, is brittle and just unnecessary busywork.

@captncraig
Copy link

We host bosun.org on github pages, and there is really no way to serve non 404's without generating a static page for each subpackage we have. Parsing meta tags on 404s would definitely help a lot.

@rsc rsc changed the title cmd/go: Custom import paths not processed from https resource that 404 cmd/go: custom import paths not processed from https resource that 404 Oct 24, 2015
@rsc rsc added this to the Go1.6 milestone Oct 24, 2015
@rsc
Copy link
Contributor

rsc commented Nov 5, 2015

Yes, we should fix this.

@gopherbot
Copy link

CL https://golang.org/cl/17944 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/17945 mentions this issue.

@rsc rsc closed this as completed in a227351 Dec 17, 2015
rsc added a commit that referenced this issue Dec 17, 2015
…sponses

Since we allow non-200 responses from HTTPS in normal operation,
it seems odd to reject them in -insecure operation.

Fixes #13037 (again).

Change-Id: Ie232f7544ab192addfad407525888db6b967befe
Reviewed-on: https://go-review.googlesource.com/17945
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Dec 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants