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

braid-http

Package Overview
Dependencies
Maintainers
2
Versions
44
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 0.3.14 to 0.3.16

2

braid-http-client.js

@@ -458,3 +458,3 @@ // var peer = Math.random().toString(36).substr(2)

var headers = {},
header_regex = /([\w-_]+):\s?(.*)\r?\n?/gy, // Parses one line a time
header_regex = /(:?[\w-_]+):\s?(.*)\r?\n?/gy, // Parses one line a time
match,

@@ -461,0 +461,0 @@ found_last_match = false

@@ -66,8 +66,18 @@ var assert = require('assert')

// This function reads num_patches in pseudoheader format from a
// ReadableStream and then fires a callback when they're finished.
// Deprecated method for legacy support
function parse_patches (req, cb) {
parse_update(req, update => {
if (update.body)
// Return body as an "everything" patch
cb([{unit: 'everything', range: '', content: update.body}])
else
cb(update.patches)
})
}
// This function reads an update (either a set of patches, or a body) from a
// ReadableStream and then fires a callback when finished.
function parse_update (req, cb) {
var num_patches = req.headers.patches
// Parse a request body as an "everything" patch
if (!num_patches && !req.headers['content-range']) {

@@ -77,3 +87,3 @@ var body = ''

req.on('end', () => {
cb([{unit: 'everything', range: '', content: body}])
cb({ body, patches: undefined })
})

@@ -100,3 +110,3 @@ }

patches = [{unit, range, content: Buffer.concat(buffer).toString('utf8')}]
cb(patches)
cb({ patches, body: undefined })
})

@@ -114,3 +124,3 @@ }

if (num_patches === 0)
return cb([])
return cb({ patches: [], body: undefined })

@@ -157,3 +167,3 @@ req.on('data', function parse (chunk) {

req.pause()
cb(patches)
cb({ patches, body: undefined })
})

@@ -203,2 +213,5 @@ req.on('end', () => {

res.sendVersion = res.sendUpdate
req.parseUpdate = () => new Promise(
(done, err) => parse_update(req, (update) => done(update))
)
req.patches = () => new Promise(

@@ -205,0 +218,0 @@ (done, err) => parse_patches(req, (patches) => done(patches))

{
"name": "braid-http",
"version": "0.3.14",
"version": "0.3.16",
"description": "An implementation of Braid-HTTP for Node.js and Browsers",

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

@@ -132,3 +132,3 @@ # Braid-HTTP

- `req.startSubscription({onClose: cb})`
- `await req.patches()`
- `await req.parseUpdate()`
- `res.sendUpdate()`

@@ -135,0 +135,0 @@

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