braid-http 1.3.96 → 1.3.98
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 +8 -6
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -1086,7 +1086,8 @@ async function create_multiplexer(origin, mux_key, params, mux_params, attempt)
|
|
|
1086
1086
|
var mux_created_promise = (async () => {
|
|
1087
1087
|
// attempt to establish a multiplexed connection
|
|
1088
1088
|
try {
|
|
1089
|
-
|
|
1089
|
+
// Disable MULTIPLEX method for now — go straight to POST
|
|
1090
|
+
if (true || mux_params?.via === 'POST'
|
|
1090
1091
|
|| multiplex_fetch.post_only?.has(origin)) throw 'skip multiplex method'
|
|
1091
1092
|
var r = await braid_fetch(`${origin}/${multiplexer}`, {
|
|
1092
1093
|
signal: mux_aborter.signal,
|
|
@@ -1137,7 +1138,7 @@ async function create_multiplexer(origin, mux_key, params, mux_params, attempt)
|
|
|
1137
1138
|
// and send messages to the appropriate requests
|
|
1138
1139
|
parse_multiplex_stream(r.body.getReader(), async (request, bytes) => {
|
|
1139
1140
|
if (requests.has(request)) requests.get(request)(bytes)
|
|
1140
|
-
else try_deleting_request(request)
|
|
1141
|
+
else try_deleting_request(request).catch(e => {})
|
|
1141
1142
|
}, e => cleanup_multiplexer(e))
|
|
1142
1143
|
})()
|
|
1143
1144
|
|
|
@@ -1223,6 +1224,11 @@ async function create_multiplexer(origin, mux_key, params, mux_params, attempt)
|
|
|
1223
1224
|
|
|
1224
1225
|
var res = await normal_fetch(url, params)
|
|
1225
1226
|
|
|
1227
|
+
// The server received our request — if we need to tear it
|
|
1228
|
+
// down later, send a DELETE. (Skip for network errors, where
|
|
1229
|
+
// normal_fetch throws and we never reach here.)
|
|
1230
|
+
established = true
|
|
1231
|
+
|
|
1226
1232
|
if (res.status === 409) {
|
|
1227
1233
|
var e = await res.json()
|
|
1228
1234
|
if (e.error === 'Request already multiplexed') {
|
|
@@ -1269,10 +1275,6 @@ async function create_multiplexer(origin, mux_key, params, mux_params, attempt)
|
|
|
1269
1275
|
+ res.headers.get('Multiplex-Version'),
|
|
1270
1276
|
{ dont_retry: true })
|
|
1271
1277
|
|
|
1272
|
-
// The server acknowledged this request — mark it so we
|
|
1273
|
-
// know to send a DELETE if we need to tear it down later
|
|
1274
|
-
established = true
|
|
1275
|
-
|
|
1276
1278
|
// we want to present the illusion that the connection is still open,
|
|
1277
1279
|
// and therefor closable with "abort",
|
|
1278
1280
|
// so we handle the abort ourselves to close the multiplexed request
|