Skip to content

Commit

Permalink
feat: move to @npmcli/agent
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this changes the underlying http agents to those
provided by `@npmcli/agent`.  Backwards compatibility should be fully
implemented but due to the scope of this change it was made a breaking
change out of an abundance of caution.
  • Loading branch information
wraithgar committed Jul 27, 2023
1 parent 5493550 commit 7c25367
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 921 deletions.
214 changes: 0 additions & 214 deletions lib/agent.js

This file was deleted.

49 changes: 0 additions & 49 deletions lib/dns.js

This file was deleted.

10 changes: 8 additions & 2 deletions lib/remote.js
Expand Up @@ -4,7 +4,7 @@ const promiseRetry = require('promise-retry')
const ssri = require('ssri')

const CachingMinipassPipeline = require('./pipeline.js')
const getAgent = require('./agent.js')
const { getAgent } = require('@npmcli/agent')
const pkg = require('../package.json')

const USER_AGENT = `${pkg.name}/${pkg.version} (+https://npm.im/${pkg.name})`
Expand All @@ -14,9 +14,15 @@ const RETRY_ERRORS = [
'ECONNREFUSED', // remote host refused to open connection
'EADDRINUSE', // failed to bind to a local port (proxy?)
'ETIMEDOUT', // someone in the transaction is WAY TOO SLOW
'ERR_SOCKET_TIMEOUT', // same as above, but this one comes from agentkeepalive
// from @npmcli/agent
'ECONNECTIONTIMEOUT',
'EIDLETIMEOUT',
'ERESPONSETIMEOUT',
'ETRANSFERTIMEOUT',
// Known codes we do NOT retry on:
// ENOTFOUND (getaddrinfo failure. Either bad hostname, or offline)
// EINVALIDPROXY // invalid protocol from @npmcli/agent
// EINVALIDRESPONSE // invalid status code from @npmcli/agent
]

const RETRY_TYPES = [
Expand Down

0 comments on commit 7c25367

Please sign in to comment.