braid-http 1.3.18 → 1.3.19
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 +2 -8
- package/braid-http-server.js +2 -3
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -859,10 +859,7 @@ async function multiplex_fetch(url, params) {
|
|
|
859
859
|
|
|
860
860
|
// attempt to establish a multiplexed connection
|
|
861
861
|
try {
|
|
862
|
-
|
|
863
|
-
var r = await braid_fetch(`${origin}/MULTIPLEX/${multiplexer}`, {retry: true})
|
|
864
|
-
else
|
|
865
|
-
var r = await braid_fetch(`${origin}/${multiplexer}`, {method: 'MULTIPLEX', retry: true})
|
|
862
|
+
var r = await braid_fetch(`${origin}/${multiplexer}`, {method: 'MULTIPLEX', retry: true})
|
|
866
863
|
} catch (e) {
|
|
867
864
|
// fallback to normal fetch if multiplexed connection fails
|
|
868
865
|
console.error(`Could not establish multiplexed connection.\nGot error: ${e}.\nFalling back to normal connection.`)
|
|
@@ -925,10 +922,7 @@ async function multiplex_fetch(url, params) {
|
|
|
925
922
|
stream_error = e
|
|
926
923
|
bytes_available()
|
|
927
924
|
try {
|
|
928
|
-
|
|
929
|
-
await braid_fetch(`${origin}/MULTIPLEX${params.headers.get('multiplexer')}`, {retry: true})
|
|
930
|
-
else
|
|
931
|
-
await braid_fetch(`${origin}${params.headers.get('multiplexer')}`, {method: 'MULTIPLEX', retry: true})
|
|
925
|
+
await braid_fetch(`${origin}${params.headers.get('multiplexer')}`, {method: 'MULTIPLEX', retry: true})
|
|
932
926
|
} catch (e) {
|
|
933
927
|
console.error(`Could not cancel multiplexed connection:`, e)
|
|
934
928
|
throw e
|
package/braid-http-server.js
CHANGED
|
@@ -243,10 +243,9 @@ function braidify (req, res, next) {
|
|
|
243
243
|
req.subscribe = subscribe
|
|
244
244
|
|
|
245
245
|
// Multiplexer stuff
|
|
246
|
-
if (
|
|
247
|
-
(braidify.use_multiplexing === 'USE GET' && req.url.startsWith('/MULTIPLEX/'))) {
|
|
246
|
+
if (braidify.use_multiplexing && req.method === 'MULTIPLEX') {
|
|
248
247
|
// parse the multiplexer id and stream id from the url
|
|
249
|
-
var [multiplexer, stream] = req.url.slice(1).
|
|
248
|
+
var [multiplexer, stream] = req.url.slice(1).split('/')
|
|
250
249
|
|
|
251
250
|
// if there's just a multiplexer, then we're creating a multiplexer..
|
|
252
251
|
if (!stream) {
|