braid-http 1.3.54 → 1.3.56
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-client.js +11 -0
- package/braid-http-server.js +2 -0
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -947,12 +947,23 @@ async function create_multiplexer(origin, mux_key, params, mux_params, attempt)
|
|
|
947
947
|
if (!try_deleting.has(request)) {
|
|
948
948
|
try_deleting.add(request)
|
|
949
949
|
try {
|
|
950
|
+
var mux_was_done = await promise_done(mux_promise)
|
|
951
|
+
|
|
950
952
|
var r = await braid_fetch(`${origin}/.well-known/multiplexer/${multiplexer}/${request}`, {
|
|
951
953
|
method: 'DELETE',
|
|
952
954
|
headers: { 'Multiplex-Version': multiplex_version },
|
|
953
955
|
retry: true
|
|
954
956
|
})
|
|
955
957
|
|
|
958
|
+
// if we know the multiplexer was created,
|
|
959
|
+
// but it isn't there now,
|
|
960
|
+
// and our client doesn't realize it,
|
|
961
|
+
// then shut it down ourselves
|
|
962
|
+
if (r.status === 404 && r.headers.get('Bad-Multiplexer')
|
|
963
|
+
&& mux_was_done && !mux_error) {
|
|
964
|
+
cleanup_multiplexer(new Error('multiplexer detected to be closed'))
|
|
965
|
+
}
|
|
966
|
+
|
|
956
967
|
if (!r.ok) throw new Error('status not ok: ' + r.status)
|
|
957
968
|
if (r.headers.get('Multiplex-Version') !== multiplex_version)
|
|
958
969
|
throw new Error('wrong multiplex version: '
|
package/braid-http-server.js
CHANGED
|
@@ -374,6 +374,7 @@ function braidify (req, res, next) {
|
|
|
374
374
|
':status': 293,
|
|
375
375
|
'Multiplex-Through': req.headers['multiplex-through'],
|
|
376
376
|
'Multiplex-Version': multiplex_version,
|
|
377
|
+
'Cache-Control': 'no-store',
|
|
377
378
|
...Object.fromEntries(cors_headers)
|
|
378
379
|
})
|
|
379
380
|
og_stream.write('Ok.')
|
|
@@ -382,6 +383,7 @@ function braidify (req, res, next) {
|
|
|
382
383
|
og_socket.write('HTTP/1.1 293 Responded via multiplexer\r\n')
|
|
383
384
|
og_socket.write(`Multiplex-Through: ${req.headers['multiplex-through']}\r\n`)
|
|
384
385
|
og_socket.write(`Multiplex-Version: ${multiplex_version}\r\n`)
|
|
386
|
+
og_socket.write(`Cache-Control: no-store\r\n`)
|
|
385
387
|
cors_headers.forEach(([key, value]) =>
|
|
386
388
|
og_socket.write(`${key}: ${value}\r\n`))
|
|
387
389
|
og_socket.write('\r\n')
|