Socket
Socket
Sign inDemoInstall

undici

Package Overview
Dependencies
Maintainers
2
Versions
211
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

undici - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

19

lib/core/client.js

@@ -67,2 +67,11 @@ 'use strict'

function getServerName (client, host) {
return (
util.getServerName(host) ||
(client[kTLSOpts] && client[kTLSOpts].servername) ||
util.getServerName(client[kUrl].host || client[kUrl].hostname) ||
null
)
}
class Client extends EventEmitter {

@@ -155,5 +164,5 @@ constructor (url, {

this[kDestroyed] = false
this[kTLSServerName] = (tls && tls.servername) || null
this[kTLSOpts] = tls
this[kTLSServerName] = getServerName(this)
this[kHost] = null
this[kTLSOpts] = tls
this[kRetryDelay] = 0

@@ -922,7 +931,3 @@ this[kRetryTimeout] = null

const servername = (
request.host &&
!/^\[/.test(request.host) &&
!net.isIP(request.host)
) ? request.host : (client[kTLSOpts] && client[kTLSOpts].servername)
const servername = getServerName(client, request.host)

@@ -929,0 +934,0 @@ if (client[kTLSServerName] !== servername) {

@@ -7,2 +7,3 @@ 'use strict'

const util = require('util')
const net = require('net')

@@ -15,2 +16,23 @@ function nop () {}

function getServerName (host) {
if (!host) {
return null
}
let servername = host
if (servername.startsWith('[')) {
const idx = servername.indexOf(']')
servername = idx === -1 ? servername : servername.substr(1, idx - 1)
} else {
servername = servername.split(':', 1)[0]
}
if (net.isIP(servername)) {
servername = null
}
return servername
}
function bodyLength (body) {

@@ -95,2 +117,3 @@ if (body && typeof body.on === 'function') {

nop,
getServerName,
errnoException,

@@ -97,0 +120,0 @@ isStream,

{
"name": "undici",
"version": "2.2.0",
"version": "2.2.1",
"description": "An HTTP/1.1 client, written from scratch for Node.js",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc