You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

braid-http

Package Overview
Dependencies
Maintainers
2
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

braid-http - npm Package Compare versions

Comparing version

to
1.3.78

47

braid-http-client.js

@@ -615,3 +615,3 @@

if (!state.headers) {
var parsed = parse_headers(state.input)
var parsed = parse_headers(state.input, true)

@@ -640,3 +640,3 @@ // If header-parsing fails, send the error upstream

// Parsing helpers
function parse_headers (input) {
function parse_headers (input, check_for_encoding_blocks) {

@@ -648,2 +648,42 @@ // Find the start of the headers

// Check for an "Encoding" block like this:
//
// Encoding: dt
// Length: 411813
// <binary dt file>
//
// Such a block will start with an "e", not an "h"
if (check_for_encoding_blocks &&
(input[start] === 101 || input[start] === 69)) {
// Look for two newlines
var end = start
var count = 0
while (++end) {
if (end > input.length) return {result: 'waiting'}
if (input[end - 1] === 10) count++
if (count === 2) break
}
// Extract the header string
var headers_source = input.slice(start, end).map(x => String.fromCharCode(x)).join('')
// Parse
var m = headers_source.match(/Encoding:\s*(\w+)\r?\nLength:\s*(\d+)\r?\n/i)
if (!m) return {
result: 'error',
message: `Parse error in encoding block: ${JSON.stringify(headers_source)}`
}
var headers = {
encoding: m[1],
length: m[2]
}
// Update the input
input = input.slice(end)
// And return the parsed result
return { result: 'success', headers, input }
}
// Look for the double-newline at the end of the headers.

@@ -720,3 +760,4 @@ var end = start

var content_length = parseInt(state.headers['content-length'])
var content_length = parseInt(state.headers['content-length'] ??
(state.headers.patches === undefined && state.headers['length']))
if (!isNaN(content_length)) {

@@ -723,0 +764,0 @@

2

package.json
{
"name": "braid-http",
"version": "1.3.77",
"version": "1.3.78",
"description": "An implementation of Braid-HTTP for Node.js and Browsers",

@@ -5,0 +5,0 @@ "scripts": {