Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Https address adds incorrectly to preload addreses #2333

Closed
MicrowaveDev opened this issue Aug 5, 2019 · 1 comment · Fixed by #2377
Closed

Https address adds incorrectly to preload addreses #2333

MicrowaveDev opened this issue Aug 5, 2019 · 1 comment · Fixed by #2377

Comments

@MicrowaveDev
Copy link
Contributor

  • Version: 0.35
  • Platform: Browser
  • Subsystem: Chrome

Type: Bug

Severity: High

Description:

I'm trying to add https preload address with specific port as described in multiaddr tests:
https://github.com/multiformats/js-mafmt/blob/master/test/index.spec.js#L79
by following code:

const ipfsPromise = new Promise((resolve, reject) => {
    const ipfs = window['Ipfs'].createNode({
          preload: {
            enabled: true,
            addresses: ['/dnsaddr/ipfs.io/tcp/3456/https/']
         }
    });
   ipfs.once('ready', () => resolve(ipfs))
   ipfs.once('error', err => reject(err))
});

But when i'm requesting for ipld:

ipfsPromise.then((ipfs) => {
    ipfs.dag.get('bafyreicxal2jgaej7ihlzhlw34ficxhjcuw43omrtlw2jcymxj7lnptjs4');
});

I see in Network tab of developer console that ipfs trying to fetch:

http://https//ipfs.io:3456/api/v0/refs?r=true&arg=zdpuArH6ZmDNgCauNuoUCgzHurvCbZ9DQdoEAvftDNsAZM5Ui

With incorrect http://https// protocol.

@MicrowaveDev
Copy link
Contributor Author

MicrowaveDev commented Aug 5, 2019

Just found the problem:

if (!(addr.endsWith('http') || addr.endsWith('https'))) {

There is no check for slash at the end of https.

Without slash at the end all working fine:
addresses: ['/dnsaddr/ipfs.io/tcp/3456/https']

lidel added a commit that referenced this issue Aug 14, 2019
- moves path utils to upstream utils
- closes #2333

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
lidel added a commit that referenced this issue Aug 21, 2019
Switches to latest multiaddr-to-uri and removes code that is no longer
needed (the lib assumes http by default now:
multiformats/js-multiaddr-to-uri#7)

Closes #2333

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
alanshaw pushed a commit that referenced this issue Aug 21, 2019
Switches to latest multiaddr-to-uri and removes code that is no longer
needed (the lib assumes http by default now:
multiformats/js-multiaddr-to-uri#7)

Closes #2333

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant