Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

undici

Package Overview
Dependencies
Maintainers
3
Versions
225
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 7.0.0-alpha.9 to 7.0.0-alpha.10

45

lib/dispatcher/client-h2.js

@@ -30,3 +30,4 @@ 'use strict'

kHTTPContext,
kClosed
kClosed,
kBodyTimeout
} = require('../core/symbols.js')

@@ -94,3 +95,7 @@

createConnection: () => socket,
peerMaxConcurrentStreams: client[kMaxConcurrentStreams]
peerMaxConcurrentStreams: client[kMaxConcurrentStreams],
settings: {
// TODO(metcoder95): add support for PUSH
enablePush: false
}
})

@@ -134,3 +139,2 @@

} else {
// Destroying the socket will trigger the session close
socket.destroy(err).on('close', callback)

@@ -287,2 +291,3 @@ }

function writeH2 (client, request) {
const requestTimeout = request.bodyTimeout ?? client[kBodyTimeout]
const session = client[kHTTP2Session]

@@ -386,2 +391,3 @@ const { method, path, host, upgrade, expectContinue, signal, headers: reqHeaders } = request

})
stream.setTimeout(requestTimeout)

@@ -460,2 +466,3 @@ return true

// TODO(metcoder95): add support for sending trailers
const shouldEndStream = method === 'GET' || method === 'HEAD' || body === null

@@ -478,2 +485,3 @@ if (expectContinue) {

++session[kOpenStreams]
stream.setTimeout(requestTimeout)

@@ -512,4 +520,5 @@ stream.once('response', headers => {

// Do not complete the request if it was aborted
if (!request.aborted) {
request.onComplete([])
// Not prone to happen for as safety net to avoid race conditions with 'trailers'
if (!request.aborted && !request.completed) {
request.onComplete({})
}

@@ -557,14 +566,22 @@

// stream.on('timeout', () => {
// // TODO(HTTP/2): Support timeout
// })
stream.on('timeout', () => {
const err = new InformationalError(`HTTP/2: "stream timeout after ${requestTimeout}"`)
stream.removeAllListeners('data')
session[kOpenStreams] -= 1
// stream.on('push', headers => {
// // TODO(HTTP/2): Support push
// })
if (session[kOpenStreams] === 0) {
session.unref()
}
// stream.on('trailers', headers => {
// // TODO(HTTP/2): Support trailers
// })
abort(err)
})
stream.once('trailers', trailers => {
if (request.aborted || request.completed) {
return
}
request.onComplete(trailers)
})
return true

@@ -571,0 +588,0 @@

@@ -30,2 +30,6 @@ 'use strict'

#checkContentType (contentType) {
return this.#contentType.indexOf(contentType) === 0
}
onHeaders (statusCode, rawHeaders, resume, statusMessage, headers = parseHeaders(rawHeaders)) {

@@ -40,3 +44,3 @@ this.#statusCode = statusCode

if (this.#contentType === 'application/json' || this.#contentType === 'text/plain') {
if (this.#checkContentType('application/json') || this.#checkContentType('text/plain')) {
this.#decoder = new TextDecoder('utf-8')

@@ -58,3 +62,3 @@ }

if (this.#contentType === 'application/json') {
if (this.#checkContentType('application/json')) {
try {

@@ -61,0 +65,0 @@ this.#body = JSON.parse(this.#body)

{
"name": "undici",
"version": "7.0.0-alpha.9",
"version": "7.0.0-alpha.10",
"description": "An HTTP/1.1 client, written from scratch for Node.js",

@@ -5,0 +5,0 @@ "homepage": "https://undici.nodejs.org",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc