braid-http 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/braid-http-server.js +14 -2
- package/package.json +1 -1
package/braid-http-server.js
CHANGED
|
@@ -66,8 +66,17 @@ ${patch.content}`
|
|
|
66
66
|
function parse_patches (req, cb) {
|
|
67
67
|
var num_patches = req.headers.patches
|
|
68
68
|
|
|
69
|
-
// Parse a
|
|
70
|
-
if (num_patches
|
|
69
|
+
// Parse a request body as an "everything" patch
|
|
70
|
+
if (!num_patches && !req.headers['content-range']) {
|
|
71
|
+
var body = ''
|
|
72
|
+
req.on('data', chunk => {body += chunk.toString()})
|
|
73
|
+
req.on('end', () => {
|
|
74
|
+
cb([{unit: 'everything', range: '', content: body}])
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Parse a single patch, lacking Patches: N
|
|
79
|
+
else if (num_patches === undefined && req.headers['content-range']) {
|
|
71
80
|
|
|
72
81
|
// We only support range patches right now, so there must be a
|
|
73
82
|
// Content-Range header.
|
|
@@ -231,6 +240,9 @@ function braidify (req, res, next) {
|
|
|
231
240
|
res.setHeader('cache-control', 'no-cache, no-transform')
|
|
232
241
|
res.setHeader('transfer-encoding', '')
|
|
233
242
|
|
|
243
|
+
// Tell nginx not to buffer the subscription
|
|
244
|
+
res.setHeader('X-Accel-Buffering', 'no')
|
|
245
|
+
|
|
234
246
|
var connected = true
|
|
235
247
|
function disconnected (x) {
|
|
236
248
|
if (!connected) return
|