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
The multiaddrToHttpUrl function fails to correctly parse DNS-based multiaddresses that don't include a TCP port segment, which is a valid format according to the multiaddr spec.
When attempting to parse addresses like /dns/f03303347-market.duckdns.org/https, the function throws an error because it expects a TCP protocol and port before the HTTP/HTTPS scheme.
Reproduction Steps
This issue occurs when processing retrieval requests from certain providers that use the direct DNS format in their multiaddresses. For example, when attempting to fetch content identified by CID bafyreiaxqptvdcxmyiwhb5kpvkmaxv5e3svniomf6ptvxvl7ypnmlrs22a from a provider using this address format, we see the following error:
Uh oh!
There was an error while loading. Please reload this page.
Description
The
multiaddrToHttpUrl
function fails to correctly parse DNS-based multiaddresses that don't include a TCP port segment, which is a valid format according to the multiaddr spec.When attempting to parse addresses like
/dns/f03303347-market.duckdns.org/https
, the function throws an error because it expects a TCP protocol and port before the HTTP/HTTPS scheme.Reproduction Steps
This issue occurs when processing retrieval requests from certain providers that use the direct DNS format in their multiaddresses. For example, when attempting to fetch content identified by CID
bafyreiaxqptvdcxmyiwhb5kpvkmaxv5e3svniomf6ptvxvl7ypnmlrs22a
from a provider using this address format, we see the following error:Expected Behavior
For a multiaddr like
/dns/f03303347-market.duckdns.org/https
, the function should return the URLhttps://f03303347-market.duckdns.org
.Proposed Solution
Add support for DNS-based direct HTTP/HTTPS format by modifying the
multiaddrToHttpUrl
function to handle this case. The solution should:/dns/
,/dns4/
, or/dns6/
) followed directly by an HTTP or HTTPS protocol identifierAdditional Test Cases
To verify the solution, we should add test cases for this direct format:
These would complement our existing tests for the TCP-based format and HTTP path format.
Related to #112 and CheckerNetwork/roadmap#231
The text was updated successfully, but these errors were encountered: