jsgar 4.6.0 → 4.6.2
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/dist/gar.umd.js +8 -2
- package/gar.js +8 -2
- package/package.json +1 -1
package/dist/gar.umd.js
CHANGED
|
@@ -92,6 +92,10 @@
|
|
|
92
92
|
// (or jsgar's connect path) handles fallback if it's unreachable.
|
|
93
93
|
async function optimalEndpoint(inetEndpoint) {
|
|
94
94
|
if (_garAfUnixDisabled()) return inetEndpoint;
|
|
95
|
+
// Skip AF_UNIX for SSL — OpenSSL's non-blocking handshake over AF_UNIX
|
|
96
|
+
// produces sporadic failures.
|
|
97
|
+
const lower = inetEndpoint.toLowerCase();
|
|
98
|
+
if (lower.startsWith('wss://') || lower.startsWith('https://')) return inetEndpoint;
|
|
95
99
|
if (!(await _garLoadNodeModules())) return inetEndpoint;
|
|
96
100
|
let parsed;
|
|
97
101
|
try { parsed = new URL(inetEndpoint); } catch { return inetEndpoint; }
|
|
@@ -321,9 +325,12 @@
|
|
|
321
325
|
// Prefer AF_UNIX abstract-namespace transport for local destinations.
|
|
322
326
|
// Falls back to TCP automatically (next reconnect iteration) if the
|
|
323
327
|
// listener disappears between probe and real connect.
|
|
328
|
+
// Skip AF_UNIX for SSL — OpenSSL's non-blocking handshake over
|
|
329
|
+
// AF_UNIX produces sporadic failures.
|
|
330
|
+
const useSSL = this.wsEndpoint.toLowerCase().startsWith('wss://');
|
|
324
331
|
let unixAbstractPath = null;
|
|
325
332
|
let sniHost = null;
|
|
326
|
-
if (isNode) {
|
|
333
|
+
if (isNode && !useSSL) {
|
|
327
334
|
unixAbstractPath = await _garUnixAbstractPathForEndpoint(this.wsEndpoint);
|
|
328
335
|
if (unixAbstractPath) {
|
|
329
336
|
try { sniHost = new URL(this.wsEndpoint).hostname; } catch { /* ignore */ }
|
|
@@ -334,7 +341,6 @@
|
|
|
334
341
|
|
|
335
342
|
const connectionPromise = new Promise((resolve, reject) => {
|
|
336
343
|
let websocket;
|
|
337
|
-
const useSSL = this.wsEndpoint.toLowerCase().startsWith('wss://');
|
|
338
344
|
const wsOpts = {};
|
|
339
345
|
if (this.allowSelfSignedCertificate && isNode && useSSL) {
|
|
340
346
|
// Node.js 'ws' supports options for TLS; browsers do not.
|
package/gar.js
CHANGED
|
@@ -86,6 +86,10 @@ function _garLocalIPv4Set() {
|
|
|
86
86
|
// (or jsgar's connect path) handles fallback if it's unreachable.
|
|
87
87
|
async function optimalEndpoint(inetEndpoint) {
|
|
88
88
|
if (_garAfUnixDisabled()) return inetEndpoint;
|
|
89
|
+
// Skip AF_UNIX for SSL — OpenSSL's non-blocking handshake over AF_UNIX
|
|
90
|
+
// produces sporadic failures.
|
|
91
|
+
const lower = inetEndpoint.toLowerCase();
|
|
92
|
+
if (lower.startsWith('wss://') || lower.startsWith('https://')) return inetEndpoint;
|
|
89
93
|
if (!(await _garLoadNodeModules())) return inetEndpoint;
|
|
90
94
|
let parsed;
|
|
91
95
|
try { parsed = new URL(inetEndpoint); } catch { return inetEndpoint; }
|
|
@@ -315,9 +319,12 @@ class GARClient {
|
|
|
315
319
|
// Prefer AF_UNIX abstract-namespace transport for local destinations.
|
|
316
320
|
// Falls back to TCP automatically (next reconnect iteration) if the
|
|
317
321
|
// listener disappears between probe and real connect.
|
|
322
|
+
// Skip AF_UNIX for SSL — OpenSSL's non-blocking handshake over
|
|
323
|
+
// AF_UNIX produces sporadic failures.
|
|
324
|
+
const useSSL = this.wsEndpoint.toLowerCase().startsWith('wss://');
|
|
318
325
|
let unixAbstractPath = null;
|
|
319
326
|
let sniHost = null;
|
|
320
|
-
if (isNode) {
|
|
327
|
+
if (isNode && !useSSL) {
|
|
321
328
|
unixAbstractPath = await _garUnixAbstractPathForEndpoint(this.wsEndpoint);
|
|
322
329
|
if (unixAbstractPath) {
|
|
323
330
|
try { sniHost = new URL(this.wsEndpoint).hostname; } catch { /* ignore */ }
|
|
@@ -328,7 +335,6 @@ class GARClient {
|
|
|
328
335
|
|
|
329
336
|
const connectionPromise = new Promise((resolve, reject) => {
|
|
330
337
|
let websocket;
|
|
331
|
-
const useSSL = this.wsEndpoint.toLowerCase().startsWith('wss://');
|
|
332
338
|
const wsOpts = {};
|
|
333
339
|
if (this.allowSelfSignedCertificate && isNode && useSSL) {
|
|
334
340
|
// Node.js 'ws' supports options for TLS; browsers do not.
|