ipfs / go-ipfs-http-client

[archived] Legacy Kubo RPC client, use kubo/client/rpc instead.
MIT License
109 stars 41 forks source link

Using NewApiWithClient uses HTTP even when HTTPS requested #176

Closed rossjones closed 1 year ago

rossjones commented 1 year ago

When using NewApiWithClient and providing a multiaddress, it results in a HTTP request, even if the multiaddress specifies HTTPS.

For example,

api, _ := NewApiWithClient(ma.NewMultiaddr("/dns4/example.com/tcp/443/https"), &http.Client{})
api.url == "example.com:80"

# in request.go we find 
if !strings.HasPrefix(url, "http") {
    url = "http://" + url
}

NewApiWithClient should return a HttpApi whose url contains the url protocol (http or https).

welcome[bot] commented 1 year ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.