Skip to content

Commit

Permalink
fix: skip requests from DNS fixup logic in Firefox
Browse files Browse the repository at this point in the history
Firefox automatically adds 'www.' to TLD+1 names if initial DNS lookup failed.
This produced bogus request+error which recovery  logic should ignore.

Closes #804
  • Loading branch information
lidel committed Oct 30, 2019
1 parent 8f506c2 commit 6c162fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions add-on/src/lib/ipfs-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,13 @@ function createRequestModifier (getState, dnslinkResolver, ipfsPathValidator, ru
if (errorInFlight.has(request.url)) return
errorInFlight.set(request.url, request.requestId)

// Skip additional requests produced by DNS fixup logic in Firefox
// https://github.com/ipfs-shipyard/ipfs-companion/issues/804
if (request.error === 'NS_ERROR_UNKNOWN_HOST' && request.url.includes('://www.')) {
const urlBeforeFixup = request.url.replace('://www.', '://')
if (errorInFlight.has(urlBeforeFixup)) return
}

// Check if error can be recovered via EthDNS
if (isRecoverableViaEthDNS(request, state)) {
const url = new URL(request.url)
Expand Down

0 comments on commit 6c162fe

Please sign in to comment.