Socket
Socket
Sign inDemoInstall

undici

Package Overview
Dependencies
Maintainers
2
Versions
212
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 1.2.5 to 1.2.6

2

lib/client-stream.js

@@ -106,3 +106,3 @@ 'use strict'

? this.res.write(chunk.slice(offset, offset + length))
: null
: true
}

@@ -109,0 +109,0 @@

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

} else if (util.isStream(request.body)) {
// Wait a tick in case stream is ended in the same tick.
this[kResuming] = true

@@ -446,3 +447,3 @@ process.nextTick(resume, this)

// https://github.com/mcollina/undici/issues/269
this.socket._unrefTimer()
socket._unrefTimer()
}

@@ -465,8 +466,8 @@

[HTTPParser.kOnMessageComplete] () {
const { client, socket, statusCode, headers, resumeSocket } = this
const { client, socket, statusCode, headers } = this
assert(statusCode >= 100)
const request = client[kQueue][client[kRunningIdx]]
assert(statusCode >= 100)
this.statusCode = null

@@ -476,2 +477,3 @@ this.headers = null

if (statusCode < 200) {
assert(!socket.isPaused())
return

@@ -500,3 +502,3 @@ }

resumeSocket()
socket.resume()
}

@@ -503,0 +505,0 @@

@@ -165,3 +165,5 @@ 'use strict'

const { [kTimeout]: timeout } = this
const {
[kTimeout]: timeout
} = this

@@ -191,3 +193,6 @@ if (timeout) {

const { [kSignal]: signal, body } = this
const {
body,
[kSignal]: signal
} = this

@@ -194,0 +199,0 @@ if (body) {

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

const { kDestroyed } = require('./symbols')
const { IncomingMessage } = require('http')

@@ -39,3 +40,5 @@ function nop () {}

if (typeof stream.destroy === 'function') {
stream.destroy(err)
if (err || Object.getPrototypeOf(stream).constructor !== IncomingMessage) {
stream.destroy(err)
}
} else if (err) {

@@ -42,0 +45,0 @@ process.nextTick((stream, err) => {

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

@@ -38,4 +38,4 @@ "main": "index.js",

"snazzy": "^8.0.0",
"standard": "^14.0.0",
"tap": "^14.0.0"
"standard": "^14.3.4",
"tap": "^14.10.8"
},

@@ -42,0 +42,0 @@ "pre-commit": [

@@ -35,1 +35,40 @@ 'use strict'

})
test('IncomingMessage', { only: true }, (t) => {
t.plan(2)
const server = createServer((req, res) => {
res.end()
})
t.teardown(server.close.bind(server))
server.listen(0, () => {
const proxyClient = new Client(`http://localhost:${server.address().port}`)
t.teardown(proxyClient.destroy.bind(proxyClient))
const proxy = createServer((req, res) => {
proxyClient.request({
path: '/',
method: 'PUT',
body: req
}, (err, data) => {
t.error(err)
data.body.pipe(res)
})
})
t.teardown(proxy.close.bind(proxy))
proxy.listen(0, () => {
const client = new Client(`http://localhost:${proxy.address().port}`)
t.teardown(client.destroy.bind(client))
client.request({
path: '/',
method: 'PUT',
body: 'hello world'
}, (err, data) => {
t.error(err)
})
})
})
})
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