Socket
Socket
Sign inDemoInstall

fastify

Package Overview
Dependencies
47
Maintainers
3
Versions
282
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.29.1 to 3.29.2

4

fastify.js
'use strict'
const VERSION = '3.29.1'
const VERSION = '3.29.2'

@@ -587,3 +587,3 @@ const Avvio = require('avvio')

// If the socket is not writable, there is no reason to try to send data.
if (socket.writable && socket.bytesWritten === 0) {
if (socket.writable) {
socket.write(`HTTP/1.1 400 Bad Request\r\nContent-Length: ${body.length}\r\nContent-Type: application/json\r\n\r\n${body}`)

@@ -590,0 +590,0 @@ }

{
"name": "fastify",
"version": "3.29.1",
"version": "3.29.2",
"description": "Fast and low overhead web framework, for Node.js",

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

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

const t = require('tap')
const semver = require('semver')
const test = t.test

@@ -157,3 +158,3 @@ const Fastify = require('..')

test('default clientError handler destroys sockets in writable state', t => {
t.plan(1)
t.plan(2)

@@ -174,2 +175,5 @@ const fastify = Fastify({

t.pass('destroy should be called')
},
write (response) {
t.match(response, /^HTTP\/1.1 400 Bad Request/)
}

@@ -195,2 +199,5 @@ })

t.pass('destroy should be called')
},
write (response) {
t.fail('write should not be called')
}

@@ -280,1 +287,40 @@ })

})
const skip = semver.lt(process.versions.node, '11.0.0')
test('default clientError replies with bad request on reused keep-alive connection', { skip }, t => {
t.plan(2)
let response = ''
const fastify = Fastify({
bodyLimit: 1,
keepAliveTimeout: 100
})
fastify.get('/', (request, reply) => {
reply.send('OK\n')
})
fastify.listen({ port: 0 }, function (err) {
t.error(err)
fastify.server.unref()
const client = connect(fastify.server.address().port)
client.on('data', chunk => {
response += chunk.toString('utf-8')
})
client.on('end', () => {
t.match(response, /^HTTP\/1.1 200 OK.*HTTP\/1.1 400 Bad Request/s)
})
client.resume()
client.write('GET / HTTP/1.1\r\n')
client.write('\r\n\r\n')
client.write('GET /?a b HTTP/1.1\r\n')
client.write('Connection: close\r\n')
client.write('\r\n\r\n')
})
})
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc