You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
When I pass host as a config option with the protocol scheme, the Client configuration breaks the url. For example https://foo.bar.com becomes http://https.
The source of this issue is this line
The way this code is written assumes that (1) the developer is passing protocol, host, andport, and that (2) host does not include the protocol scheme. So these strings work as expected: foo.com or foo.com:5011
But this does not work: https://foo.com
I think this code is confusing because if all 3 options are required there shouldn't be a need to .split(':') on a colon at all.
Potential solutions would be:
More explicit explanation of what should be passed in documentation
Throw an error if only 1 of the 3 options are set
Eliminate these options and just use url instead
Steps to reproduce the error:
ipfsClient({host: 'https://foo.com',port: 5011});
FetchError: request to http://https:5011/api/v0/dag/put failed, reason: connect ETIMEDOUT
The text was updated successfully, but these errors were encountered:
ps. I agree that splitting in mentioned line does not make much sense, unless we leverage [1] in port.
It is a cosmetic thing, but feel free to open a PR with a fix if you have time and will to clean this up.
I've merged #3478 which should hopefully make the constructor args clearer, thanks for pointing out the lack of docs.
But yes, TLDR is that you can't include a protocol in the host field, specify it in the protocol field instead, or pass the whole URL in as a string, multiaddr or URL, or use the url field of the options object.
"ipfs-http-client": "^48.1.2"
Mac OSX
ipfs-http-client
Severity:
Medium
Description:
When I pass host as a config option with the protocol scheme, the Client configuration breaks the url. For example
https://foo.bar.com
becomeshttp://https
.The source of this issue is this line
js-ipfs/packages/ipfs-http-client/src/lib/core.js
Line 39 in fe93ba0
The way this code is written assumes that (1) the developer is passing
protocol
,host
, andport
, and that (2)host
does not include the protocol scheme. So these strings work as expected:foo.com
orfoo.com:5011
But this does not work:
https://foo.com
I think this code is confusing because if all 3 options are required there shouldn't be a need to
.split(':')
on a colon at all.Potential solutions would be:
url
insteadSteps to reproduce the error:
The text was updated successfully, but these errors were encountered: