hypertube-binaries 3.0.5 → 3.0.6

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.
Files changed (71) hide show
  1. package/Binaries/Clr/Hypertube.Clr.Utils.dll +0 -0
  2. package/Binaries/Jvm/HypertubeJvmRuntime.jar +0 -0
  3. package/Binaries/Native/Linux/ARM64/{_HypertubeNativeErrorLogger_2026-05-13.txt → _HypertubeNativeErrorLogger_2026-05-18.txt} +5 -5
  4. package/Binaries/Native/Linux/ARM64/libHypertubeActivationService.so +0 -0
  5. package/Binaries/Native/Linux/ARM64/libUtils.so +0 -0
  6. package/Binaries/Native/Linux/ARM64/version.txt +1 -1
  7. package/Binaries/Native/Linux/X64/{_HypertubeNativeErrorLogger_2026-05-13.txt → _HypertubeNativeErrorLogger_2026-05-18.txt} +5 -5
  8. package/Binaries/Native/Linux/X64/libHypertubeActivationService.so +0 -0
  9. package/Binaries/Native/Linux/X64/libUtils.so +0 -0
  10. package/Binaries/Native/Linux/X64/version.txt +1 -1
  11. package/Binaries/Native/MacOs/ARM64/{_HypertubeNativeErrorLogger_2026-05-13.txt → _HypertubeNativeErrorLogger_2026-05-18.txt} +5 -5
  12. package/Binaries/Native/MacOs/ARM64/libHypertubeActivationService.dylib +0 -0
  13. package/Binaries/Native/MacOs/ARM64/libHypertubeNodejs2218RuntimeNative.dylib +0 -0
  14. package/Binaries/Native/MacOs/ARM64/libUtils.dylib +0 -0
  15. package/Binaries/Native/MacOs/ARM64/version.txt +1 -1
  16. package/Binaries/Native/MacOs/X64/{_HypertubeNativeErrorLogger_2026-05-13.txt → _HypertubeNativeErrorLogger_2026-05-18.txt} +5 -5
  17. package/Binaries/Native/MacOs/X64/libHypertubeActivationService.dylib +0 -0
  18. package/Binaries/Native/MacOs/X64/libHypertubeNodejs2218RuntimeNative.dylib +0 -0
  19. package/Binaries/Native/MacOs/X64/libUtils.dylib +0 -0
  20. package/Binaries/Native/MacOs/X64/version.txt +1 -1
  21. package/Binaries/Native/Windows/ARM64/Configs.dll +0 -0
  22. package/Binaries/Native/Windows/ARM64/HypertubeActivationService.dll +0 -0
  23. package/Binaries/Native/Windows/ARM64/HypertubeCppRuntimeNative.dll +0 -0
  24. package/Binaries/Native/Windows/ARM64/HypertubeGoRuntimeNative.dll +0 -0
  25. package/Binaries/Native/Windows/ARM64/HypertubeJvmRuntimeNative.dll +0 -0
  26. package/Binaries/Native/Windows/ARM64/HypertubeNetcoreRuntimeNative.dll +0 -0
  27. package/Binaries/Native/Windows/ARM64/HypertubePhpRuntimeNative.dll +0 -0
  28. package/Binaries/Native/Windows/ARM64/HypertubePythonRuntimeNative.dll +0 -0
  29. package/Binaries/Native/Windows/ARM64/HypertubeRubyRuntimeNative.dll +0 -0
  30. package/Binaries/Native/Windows/ARM64/HypertubeTcpClient.dll +0 -0
  31. package/Binaries/Native/Windows/ARM64/HypertubeTcpTlsClient.dll +0 -0
  32. package/Binaries/Native/Windows/ARM64/Utils.dll +0 -0
  33. package/Binaries/Native/Windows/ARM64/{_HypertubeNativeErrorLogger_2026-05-13.txt → _HypertubeNativeErrorLogger_2026-05-18.txt} +5 -5
  34. package/Binaries/Native/Windows/ARM64/version.txt +0 -0
  35. package/Binaries/Native/Windows/X64/Configs.dll +0 -0
  36. package/Binaries/Native/Windows/X64/HypertubeActivationService.dll +0 -0
  37. package/Binaries/Native/Windows/X64/HypertubeClrRuntimeNative.dll +0 -0
  38. package/Binaries/Native/Windows/X64/HypertubeCppRuntimeNative.dll +0 -0
  39. package/Binaries/Native/Windows/X64/HypertubeGoRuntimeNative.dll +0 -0
  40. package/Binaries/Native/Windows/X64/HypertubeJvmRuntimeNative.dll +0 -0
  41. package/Binaries/Native/Windows/X64/HypertubeNetcoreRuntimeNative.dll +0 -0
  42. package/Binaries/Native/Windows/X64/HypertubeNodejs2218RuntimeNative.dll +0 -0
  43. package/Binaries/Native/Windows/X64/HypertubeNodejsRuntimeNative.dll +0 -0
  44. package/Binaries/Native/Windows/X64/HypertubePhp848RuntimeNative.dll +0 -0
  45. package/Binaries/Native/Windows/X64/HypertubePhpRuntimeNative.dll +0 -0
  46. package/Binaries/Native/Windows/X64/HypertubePythonRuntimeNative.dll +0 -0
  47. package/Binaries/Native/Windows/X64/HypertubeRubyRuntimeNative.dll +0 -0
  48. package/Binaries/Native/Windows/X64/HypertubeTcpClient.dll +0 -0
  49. package/Binaries/Native/Windows/X64/HypertubeTcpTlsClient.dll +0 -0
  50. package/Binaries/Native/Windows/X64/Utils.dll +0 -0
  51. package/Binaries/Native/Windows/X64/{_HypertubeNativeErrorLogger_2026-05-13.txt → _HypertubeNativeErrorLogger_2026-05-18.txt} +5 -5
  52. package/Binaries/Native/Windows/X64/version.txt +1 -1
  53. package/Binaries/Netcore/Hypertube.Netcore.Core.dll +0 -0
  54. package/Binaries/Netcore/Hypertube.Netcore.Plugins.dll +0 -0
  55. package/Binaries/Netcore/Hypertube.Netcore.Utils.dll +0 -0
  56. package/Binaries/Php/hypertube/utils/connectiondata/ConnectionData.php +6 -0
  57. package/Binaries/Php/hypertube/utils/connectiondata/IConnectionData.php +1 -0
  58. package/Binaries/Python/hypertube/utils/connectionData/IConnectionData.py +4 -0
  59. package/Binaries/Ruby/core/interpreter/interpreter.rb +4 -4
  60. package/Binaries/Ruby/core/web_socket_client/web_socket_client.rb +50 -10
  61. package/Binaries/Ruby/utils/connection_data.rb +43 -0
  62. package/Binaries/Ruby/utils/http2_connection_data.rb +3 -26
  63. package/Binaries/Ruby/utils/in_memory_connection_data.rb +36 -0
  64. package/Binaries/Ruby/utils/tcp_connection_data.rb +7 -26
  65. package/Binaries/Ruby/utils/ws_connection_data.rb +3 -26
  66. package/Binaries/version.txt +1 -1
  67. package/package.json +1 -1
  68. package/prebuilds/prebuilds-darwin-arm64/HypertubeNodejsRuntimeAddon.node +0 -0
  69. package/prebuilds/prebuilds-darwin-x64/HypertubeNodejsRuntimeAddon.node +0 -0
  70. package/prebuilds/prebuilds-win32-arm64/HypertubeNodejsRuntimeAddon.node +0 -0
  71. package/prebuilds/prebuilds-win32-x64/HypertubeNodejsRuntimeAddon.node +0 -0
@@ -1,20 +1,20 @@
1
- 2026-05-13 13:28:03 Thread ID: 258056486005280 Proxy configuration not found in configuration source. Check your configuration:
1
+ 2026-05-18 12:51:52 Thread ID: 263443666258464 Proxy configuration not found in configuration source. Check your configuration:
2
2
  {
3
3
  "licenseKey": "your-license-key"
4
4
  }
5
- 2026-05-13 13:28:03 Thread ID: 258056486005280 Proxy configuration not found in configuration source. Check your configuration:
5
+ 2026-05-18 12:51:52 Thread ID: 263443666258464 Proxy configuration not found in configuration source. Check your configuration:
6
6
  {
7
7
  "licenseKey": "your-license-key"
8
8
  }
9
- 2026-05-13 13:28:03 Thread ID: 258056486005280 Proxy configuration not found in configuration source. Check your configuration:
9
+ 2026-05-18 12:51:53 Thread ID: 263443666258464 Proxy configuration not found in configuration source. Check your configuration:
10
10
  {
11
11
  "licenseKey": "your-license-key"
12
12
  }
13
- 2026-05-13 13:28:04 Thread ID: 258056486005280 Proxy configuration not found in configuration source. Check your configuration:
13
+ 2026-05-18 12:51:53 Thread ID: 263443666258464 Proxy configuration not found in configuration source. Check your configuration:
14
14
  {
15
15
  "licenseKey": "your-license-key"
16
16
  }
17
- 2026-05-13 13:28:04 Thread ID: 258056486005280 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
17
+ 2026-05-18 12:51:53 Thread ID: 263443666258464 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
18
18
  {
19
19
  "licenseKey": "unit-tests-key",
20
20
  "loggingLevel": "runtimeInfo",
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.0.6
@@ -1,20 +1,20 @@
1
- 2026-05-13 13:32:02 Thread ID: 139855349638976 Proxy configuration not found in configuration source. Check your configuration:
1
+ 2026-05-18 13:08:27 Thread ID: 139824521037632 Proxy configuration not found in configuration source. Check your configuration:
2
2
  {
3
3
  "licenseKey": "your-license-key"
4
4
  }
5
- 2026-05-13 13:32:02 Thread ID: 139855349638976 Proxy configuration not found in configuration source. Check your configuration:
5
+ 2026-05-18 13:08:27 Thread ID: 139824521037632 Proxy configuration not found in configuration source. Check your configuration:
6
6
  {
7
7
  "licenseKey": "your-license-key"
8
8
  }
9
- 2026-05-13 13:32:02 Thread ID: 139855349638976 Proxy configuration not found in configuration source. Check your configuration:
9
+ 2026-05-18 13:08:27 Thread ID: 139824521037632 Proxy configuration not found in configuration source. Check your configuration:
10
10
  {
11
11
  "licenseKey": "your-license-key"
12
12
  }
13
- 2026-05-13 13:32:03 Thread ID: 139855349638976 Proxy configuration not found in configuration source. Check your configuration:
13
+ 2026-05-18 13:08:27 Thread ID: 139824521037632 Proxy configuration not found in configuration source. Check your configuration:
14
14
  {
15
15
  "licenseKey": "your-license-key"
16
16
  }
17
- 2026-05-13 13:32:03 Thread ID: 139855349638976 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
17
+ 2026-05-18 13:08:27 Thread ID: 139824521037632 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
18
18
  {
19
19
  "licenseKey": "unit-tests-key",
20
20
  "loggingLevel": "runtimeInfo",
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.0.6
@@ -1,20 +1,20 @@
1
- 2026-05-13 15:27:35 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
1
+ 2026-05-18 14:51:32 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
2
2
  {
3
3
  "licenseKey": "your-license-key"
4
4
  }
5
- 2026-05-13 15:27:36 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
5
+ 2026-05-18 14:51:33 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
6
6
  {
7
7
  "licenseKey": "your-license-key"
8
8
  }
9
- 2026-05-13 15:27:36 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
9
+ 2026-05-18 14:51:33 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
10
10
  {
11
11
  "licenseKey": "your-license-key"
12
12
  }
13
- 2026-05-13 15:27:37 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
13
+ 2026-05-18 14:51:34 Thread ID: 0x1f84c50c0 Proxy configuration not found in configuration source. Check your configuration:
14
14
  {
15
15
  "licenseKey": "your-license-key"
16
16
  }
17
- 2026-05-13 15:27:37 Thread ID: 0x1f84c50c0 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
17
+ 2026-05-18 14:51:34 Thread ID: 0x1f84c50c0 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
18
18
  {
19
19
  "licenseKey": "unit-tests-key",
20
20
  "loggingLevel": "runtimeInfo",
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.0.6
@@ -1,20 +1,20 @@
1
- 2026-05-13 13:35:25 Thread ID: 0x7ff845ef7840 Proxy configuration not found in configuration source. Check your configuration:
1
+ 2026-05-18 13:08:34 Thread ID: 0x7ff852a1e840 Proxy configuration not found in configuration source. Check your configuration:
2
2
  {
3
3
  "licenseKey": "your-license-key"
4
4
  }
5
- 2026-05-13 13:35:25 Thread ID: 0x7ff845ef7840 Proxy configuration not found in configuration source. Check your configuration:
5
+ 2026-05-18 13:08:35 Thread ID: 0x7ff852a1e840 Proxy configuration not found in configuration source. Check your configuration:
6
6
  {
7
7
  "licenseKey": "your-license-key"
8
8
  }
9
- 2026-05-13 13:35:25 Thread ID: 0x7ff845ef7840 Proxy configuration not found in configuration source. Check your configuration:
9
+ 2026-05-18 13:08:35 Thread ID: 0x7ff852a1e840 Proxy configuration not found in configuration source. Check your configuration:
10
10
  {
11
11
  "licenseKey": "your-license-key"
12
12
  }
13
- 2026-05-13 13:35:26 Thread ID: 0x7ff845ef7840 Proxy configuration not found in configuration source. Check your configuration:
13
+ 2026-05-18 13:08:35 Thread ID: 0x7ff852a1e840 Proxy configuration not found in configuration source. Check your configuration:
14
14
  {
15
15
  "licenseKey": "your-license-key"
16
16
  }
17
- 2026-05-13 13:35:26 Thread ID: 0x7ff845ef7840 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
17
+ 2026-05-18 13:08:36 Thread ID: 0x7ff852a1e840 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
18
18
  {
19
19
  "licenseKey": "unit-tests-key",
20
20
  "loggingLevel": "runtimeInfo",
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.0.6
@@ -1,20 +1,20 @@
1
- 2026-05-13 13:28:16 Thread ID: 8960 Proxy configuration not found in configuration source. Check your configuration:
1
+ 2026-05-18 12:52:08 Thread ID: 3636 Proxy configuration not found in configuration source. Check your configuration:
2
2
  {
3
3
  "licenseKey": "your-license-key"
4
4
  }
5
- 2026-05-13 13:28:16 Thread ID: 8960 Proxy configuration not found in configuration source. Check your configuration:
5
+ 2026-05-18 12:52:08 Thread ID: 3636 Proxy configuration not found in configuration source. Check your configuration:
6
6
  {
7
7
  "licenseKey": "your-license-key"
8
8
  }
9
- 2026-05-13 13:28:16 Thread ID: 8960 Proxy configuration not found in configuration source. Check your configuration:
9
+ 2026-05-18 12:52:08 Thread ID: 3636 Proxy configuration not found in configuration source. Check your configuration:
10
10
  {
11
11
  "licenseKey": "your-license-key"
12
12
  }
13
- 2026-05-13 13:28:16 Thread ID: 8960 Proxy configuration not found in configuration source. Check your configuration:
13
+ 2026-05-18 12:52:08 Thread ID: 3636 Proxy configuration not found in configuration source. Check your configuration:
14
14
  {
15
15
  "licenseKey": "your-license-key"
16
16
  }
17
- 2026-05-13 13:28:16 Thread ID: 8960 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
17
+ 2026-05-18 12:52:09 Thread ID: 3636 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
18
18
  {
19
19
  "licenseKey": "unit-tests-key",
20
20
  "loggingLevel": "runtimeInfo",
@@ -1,20 +1,20 @@
1
- 2026-05-13 13:36:32 Thread ID: 1568 Proxy configuration not found in configuration source. Check your configuration:
1
+ 2026-05-18 13:09:09 Thread ID: 3804 Proxy configuration not found in configuration source. Check your configuration:
2
2
  {
3
3
  "licenseKey": "your-license-key"
4
4
  }
5
- 2026-05-13 13:36:33 Thread ID: 1568 Proxy configuration not found in configuration source. Check your configuration:
5
+ 2026-05-18 13:09:09 Thread ID: 3804 Proxy configuration not found in configuration source. Check your configuration:
6
6
  {
7
7
  "licenseKey": "your-license-key"
8
8
  }
9
- 2026-05-13 13:36:33 Thread ID: 1568 Proxy configuration not found in configuration source. Check your configuration:
9
+ 2026-05-18 13:09:09 Thread ID: 3804 Proxy configuration not found in configuration source. Check your configuration:
10
10
  {
11
11
  "licenseKey": "your-license-key"
12
12
  }
13
- 2026-05-13 13:36:33 Thread ID: 1568 Proxy configuration not found in configuration source. Check your configuration:
13
+ 2026-05-18 13:09:09 Thread ID: 3804 Proxy configuration not found in configuration source. Check your configuration:
14
14
  {
15
15
  "licenseKey": "your-license-key"
16
16
  }
17
- 2026-05-13 13:36:33 Thread ID: 1568 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
17
+ 2026-05-18 13:09:09 Thread ID: 3804 Runtime config default not found in configuration source for runtime invalid_runtime_name. Check your configuration:
18
18
  {
19
19
  "licenseKey": "unit-tests-key",
20
20
  "loggingLevel": "runtimeInfo",
@@ -1 +1 @@
1
- '3.0.5'
1
+ '3.0.6'
@@ -31,6 +31,12 @@ abstract class ConnectionData implements IConnectionData
31
31
  }
32
32
  }
33
33
 
34
+ public function setHeaders(array $headers): void
35
+ {
36
+ $this->headers = [];
37
+ $this->addHeaders($headers);
38
+ }
39
+
34
40
  public function toString(): string
35
41
  {
36
42
  return $this->connectionTypeAsString() . '|' . $this->getHostname();
@@ -14,6 +14,7 @@ interface IConnectionData
14
14
  public function getHeaders(): array;
15
15
  public function addHeader(string $key, string $value): void;
16
16
  public function addHeaders(array $headers): void;
17
+ public function setHeaders(array $headers): void;
17
18
  public function toString(): string;
18
19
  public function toCanonicalKey(): string;
19
20
  }
@@ -39,6 +39,10 @@ class IConnectionData(ABC):
39
39
  for key, value in headers.items():
40
40
  self._headers[key] = value
41
41
 
42
+ def set_headers(self, headers):
43
+ self._headers = {}
44
+ self.add_headers(headers)
45
+
42
46
  def get_headers(self):
43
47
  return dict(self._headers)
44
48
 
@@ -6,15 +6,15 @@ module Hypertube
6
6
  module Core
7
7
  module Interpreter
8
8
  class Interpreter
9
- def self.execute(command, connection_type, connection_data)
9
+ def self.execute(command, connection_data)
10
10
  message_byte_array = Hypertube::Core::Protocol::CommandSerializer.serialize(command, connection_data)
11
- if connection_type == Hypertube::Utils::ConnectionType::WEB_SOCKET
11
+ if connection_data.connection_type == Hypertube::Utils::ConnectionType::WEB_SOCKET
12
12
  require_relative '../web_socket_client/web_socket_client'
13
13
  response_byte_array = Hypertube::Core::WebSocketClient::WebSocketClient.send_message(connection_data, message_byte_array)
14
- elsif connection_type == Hypertube::Utils::ConnectionType::HTTP2
14
+ elsif connection_data.connection_type == Hypertube::Utils::ConnectionType::HTTP2
15
15
  require_relative '../http2_client/http2_client'
16
16
  response_byte_array = Hypertube::Core::Http2Client::Http2Client.send_message(connection_data, message_byte_array)
17
- elsif command.runtime_name == Hypertube::Utils::RuntimeNameHt::RUBY && connection_type == Hypertube::Utils::ConnectionType::IN_MEMORY
17
+ elsif command.runtime_name == Hypertube::Utils::RuntimeNameHt::RUBY && connection_data.connection_type == Hypertube::Utils::ConnectionType::IN_MEMORY
18
18
  require_relative '../receiver/receiver'
19
19
  response_byte_array = Hypertube::Core::Receiver::Receiver.send_command(message_byte_array)[1]
20
20
  else
@@ -1,6 +1,7 @@
1
1
  require 'uri'
2
2
  require 'socket'
3
3
  require 'openssl'
4
+ require 'timeout'
4
5
  require 'websocket'
5
6
 
6
7
  module Hypertube
@@ -9,6 +10,16 @@ module Hypertube
9
10
  class WebSocketClient
10
11
  MAX_ATTEMPTS = 2
11
12
  DEFAULT_TIMEOUT_SECONDS = 60
13
+ TRANSIENT_ERRORS = [
14
+ Errno::EPIPE,
15
+ Errno::ECONNRESET,
16
+ Errno::ETIMEDOUT,
17
+ IOError,
18
+ SystemCallError,
19
+ Timeout::Error,
20
+ OpenSSL::SSL::SSLError,
21
+ WebSocket::Error
22
+ ].freeze
12
23
 
13
24
  # Cache: URI(string) -> Hypertube::Core::WebSocketClient::WebSocketClient
14
25
  @clients = {}
@@ -32,9 +43,9 @@ module Hypertube
32
43
  client.send_bytes(message)
33
44
  return client.receive_bytes
34
45
  end
35
- rescue Errno::EPIPE, Errno::ECONNRESET, Errno::ETIMEDOUT, IOError, SystemCallError,
36
- WebSocket::Error => ex
46
+ rescue *TRANSIENT_ERRORS => ex
37
47
  last_ex = ex
48
+ client.mark_closed
38
49
  break if attempt == MAX_ATTEMPTS - 1
39
50
 
40
51
  # Recreate semantics: only replace if the cached instance equals the one that failed
@@ -108,8 +119,10 @@ module Hypertube
108
119
  @clients[key] = created
109
120
  created
110
121
  else
111
- # recreate semantics (force replace only if the cached instance is the same object)
112
- if (current = @clients[key]) && current.equal?(expected_current)
122
+ # Recreate semantics: reuse a fresh client if another thread already replaced the failed one.
123
+ if (current = @clients[key])
124
+ return current if !current.equal?(expected_current) && current.open?
125
+
113
126
  begin current.close(suppress_close_frame: true) rescue nil end
114
127
  @clients.delete(key)
115
128
  end
@@ -123,6 +136,8 @@ module Hypertube
123
136
  end
124
137
 
125
138
  def initialize(connection_data)
139
+ @connection_data = connection_data
140
+ @closed = false
126
141
  url = connection_data.respond_to?(:hostname) ? connection_data.hostname : connection_data.to_s
127
142
  @connect_timeout = connection_data.respond_to?(:connect_timeout) ? connection_data.connect_timeout : nil
128
143
  @uri = URI.parse(url)
@@ -137,11 +152,14 @@ module Hypertube
137
152
 
138
153
  begin
139
154
  @socket = open_socket
140
- @handshake = WebSocket::Handshake::Client.new(url: url)
155
+ @handshake = WebSocket::Handshake::Client.new(url: url, headers: request_headers)
141
156
  perform_handshake
142
- rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, SocketError, IOError, SystemCallError => e
157
+ rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::EHOSTUNREACH, SocketError, IOError, SystemCallError,
158
+ OpenSSL::SSL::SSLError => e
159
+ mark_closed
143
160
  raise "WebSocket connection to #{url} failed: #{e.message}. Check that the server is running, the URL is correct (ws:// or wss://), and that no firewall or proxy is blocking the connection."
144
161
  rescue WebSocket::Error => e
162
+ mark_closed
145
163
  raise "WebSocket connection to #{url} failed: #{e.message}. Check that the server is running and supports WebSocket."
146
164
  end
147
165
 
@@ -153,6 +171,10 @@ module Hypertube
153
171
  @send_receive_lock.synchronize { yield }
154
172
  end
155
173
 
174
+ def mark_closed
175
+ @closed = true
176
+ end
177
+
156
178
  # Send bytes (String bytes or Array of bytes)
157
179
  def send_bytes(message)
158
180
  data =
@@ -213,24 +235,42 @@ module Hypertube
213
235
  end
214
236
 
215
237
  def open?
238
+ return false if @closed
216
239
  return false if @socket.closed?
217
240
  true
218
- rescue IOError, SystemCallError
241
+ rescue IOError, SystemCallError, OpenSSL::SSL::SSLError
219
242
  false
220
243
  end
221
244
 
222
245
  def close(suppress_close_frame: false)
223
246
  begin
224
247
  send_close_reply unless suppress_close_frame || @socket.closed?
225
- rescue Errno::EPIPE, Errno::ECONNRESET, IOError, SystemCallError, WebSocket::Error
248
+ rescue Errno::EPIPE, Errno::ECONNRESET, IOError, SystemCallError, OpenSSL::SSL::SSLError, WebSocket::Error
226
249
  # ignore
227
250
  ensure
251
+ mark_closed
228
252
  @socket.close unless @socket.closed?
229
253
  end
230
254
  end
231
255
 
232
256
  private
233
257
 
258
+ def request_headers
259
+ return {} unless @connection_data.respond_to?(:headers)
260
+
261
+ @connection_data.headers.each_with_object({}) do |(key, value), headers|
262
+ next if key.nil? || value.nil?
263
+ next if restricted_websocket_header?(key)
264
+
265
+ headers[key.to_s] = value.to_s
266
+ end
267
+ end
268
+
269
+ def restricted_websocket_header?(key)
270
+ normalized = key.to_s.downcase
271
+ %w[host upgrade connection].include?(normalized) || normalized.start_with?('sec-websocket-')
272
+ end
273
+
234
274
  def default_port
235
275
  @uri.scheme == 'wss' ? 443 : 80
236
276
  end
@@ -295,7 +335,7 @@ module Hypertube
295
335
  version: @handshake.version, type: :pong, data: data
296
336
  )
297
337
  write_all(pong.to_s)
298
- rescue Errno::EPIPE, Errno::ECONNRESET, IOError, SystemCallError
338
+ rescue Errno::EPIPE, Errno::ECONNRESET, IOError, SystemCallError, OpenSSL::SSL::SSLError
299
339
  # ignore
300
340
  end
301
341
 
@@ -305,7 +345,7 @@ module Hypertube
305
345
  version: @handshake.version, type: :close
306
346
  )
307
347
  write_all(frame.to_s)
308
- rescue Errno::EPIPE, Errno::ECONNRESET, IOError, SystemCallError
348
+ rescue Errno::EPIPE, Errno::ECONNRESET, IOError, SystemCallError, OpenSSL::SSL::SSLError
309
349
  # ignore
310
350
  end
311
351
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hypertube
4
+ module Utils
5
+ class ConnectionData
6
+ def initialize
7
+ @headers = {}
8
+ end
9
+
10
+ def headers
11
+ @headers.dup
12
+ end
13
+
14
+ def add_header(key, value)
15
+ @headers[key.to_s] = value.to_s
16
+ end
17
+
18
+ def add_headers(headers)
19
+ return if headers.nil?
20
+
21
+ headers.each do |key, value|
22
+ add_header(key, value)
23
+ end
24
+ end
25
+
26
+ def set_headers(headers)
27
+ @headers = {}
28
+ add_headers(headers)
29
+ end
30
+
31
+ private
32
+
33
+ def serialize_headers_for_key
34
+ return '' if headers.nil? || headers.empty?
35
+
36
+ headers
37
+ .sort_by { |key, _| key.to_s }
38
+ .map { |key, value| "#{key}=#{value}" }
39
+ .join(';')
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,38 +1,23 @@
1
1
  # frozen_string_literal: true
2
+ require_relative './connection_data'
2
3
 
3
4
  module Hypertube
4
5
  module Utils
5
- class Http2ConnectionData
6
+ class Http2ConnectionData < ConnectionData
6
7
  DEFAULT_CONNECT_TIMEOUT_SECONDS = 60
7
8
 
8
9
  attr_accessor :hostname, :timeout
9
10
 
10
11
  def initialize(hostname, timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS)
12
+ super()
11
13
  @hostname = hostname
12
14
  @timeout = timeout
13
- @headers = {}
14
15
  end
15
16
 
16
17
  def connection_type
17
18
  Hypertube::Utils::ConnectionType::HTTP2
18
19
  end
19
20
 
20
- def headers
21
- @headers.dup
22
- end
23
-
24
- def add_header(key, value)
25
- @headers[key.to_s] = value.to_s
26
- end
27
-
28
- def add_headers(headers)
29
- return if headers.nil?
30
-
31
- headers.each do |key, value|
32
- add_header(key, value)
33
- end
34
- end
35
-
36
21
  def serialize_connection_data
37
22
  [connection_type, 0, 0, 0, 0, 0, 0]
38
23
  end
@@ -50,14 +35,6 @@ module Hypertube
50
35
 
51
36
  private
52
37
 
53
- def serialize_headers_for_key
54
- return '' if headers.nil? || headers.empty?
55
-
56
- headers
57
- .sort_by { |key, _| key.to_s }
58
- .map { |key, value| "#{key}=#{value}" }
59
- .join(';')
60
- end
61
38
  end
62
39
  end
63
40
  end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ require_relative './connection_data'
3
+ require_relative './connection_type'
4
+
5
+ module Hypertube
6
+ module Utils
7
+ class InMemoryConnectionData < ConnectionData
8
+ def initialize
9
+ super()
10
+ end
11
+
12
+ def connection_type
13
+ Hypertube::Utils::ConnectionType::IN_MEMORY
14
+ end
15
+
16
+ def hostname
17
+ 'inmemory'
18
+ end
19
+
20
+ def serialize_connection_data
21
+ [connection_type, 0, 0, 0, 0, 0, 0]
22
+ end
23
+
24
+ def to_s
25
+ 'inmemory|inmemory'
26
+ end
27
+
28
+ def to_canonical_key
29
+ headers_for_key = serialize_headers_for_key
30
+ return to_s if headers_for_key.empty?
31
+
32
+ "#{to_s}|h:#{headers_for_key}"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,15 +1,16 @@
1
1
  # frozen_string_literal: true
2
+ require_relative './connection_data'
2
3
 
3
4
  module Hypertube
4
5
  module Utils
5
- class TcpConnectionData
6
+ class TcpConnectionData < ConnectionData
6
7
  attr_reader :hostname, :ip_address, :port
7
8
 
8
9
  def initialize(hostname)
10
+ super()
9
11
  host_only, port = parse_hostname(hostname)
10
12
  @hostname = "#{host_only}:#{port}"
11
13
  @port = port
12
- @headers = {}
13
14
  if host_only == 'localhost'
14
15
  @ip_address = '127.0.0.1'
15
16
  else
@@ -21,6 +22,10 @@ module Hypertube
21
22
  end
22
23
  end
23
24
 
25
+ def connection_type
26
+ ConnectionType::TCP
27
+ end
28
+
24
29
  def to_s
25
30
  "tcp|#{@hostname}"
26
31
  end
@@ -37,22 +42,6 @@ module Hypertube
37
42
  [Hypertube::Utils::ConnectionType::TCP] + get_address_bytes + get_port_bytes
38
43
  end
39
44
 
40
- def headers
41
- @headers.dup
42
- end
43
-
44
- def add_header(key, value)
45
- @headers[key.to_s] = value.to_s
46
- end
47
-
48
- def add_headers(headers)
49
- return if headers.nil?
50
-
51
- headers.each do |key, value|
52
- add_header(key, value)
53
- end
54
- end
55
-
56
45
  def to_canonical_key
57
46
  headers_for_key = serialize_headers_for_key
58
47
  return to_s if headers_for_key.empty?
@@ -81,14 +70,6 @@ module Hypertube
81
70
  raise 'TCP hostname must contain a numeric port.'
82
71
  end
83
72
 
84
- def serialize_headers_for_key
85
- return '' if headers.nil? || headers.empty?
86
-
87
- headers
88
- .sort_by { |key, _| key.to_s }
89
- .map { |key, value| "#{key}=#{value}" }
90
- .join(';')
91
- end
92
73
  end
93
74
  end
94
75
  end
@@ -1,38 +1,23 @@
1
1
  # frozen_string_literal: true
2
+ require_relative './connection_data'
2
3
 
3
4
  module Hypertube
4
5
  module Utils
5
- class WsConnectionData
6
+ class WsConnectionData < ConnectionData
6
7
  DEFAULT_CONNECT_TIMEOUT_SECONDS = 60
7
8
 
8
9
  attr_accessor :hostname, :connect_timeout
9
10
 
10
11
  def initialize(hostname, connect_timeout = DEFAULT_CONNECT_TIMEOUT_SECONDS)
12
+ super()
11
13
  @hostname = hostname
12
14
  @connect_timeout = connect_timeout
13
- @headers = {}
14
15
  end
15
16
 
16
17
  def connection_type
17
18
  Hypertube::Utils::ConnectionType::WEB_SOCKET
18
19
  end
19
20
 
20
- def headers
21
- @headers.dup
22
- end
23
-
24
- def add_header(key, value)
25
- @headers[key.to_s] = value.to_s
26
- end
27
-
28
- def add_headers(headers)
29
- return if headers.nil?
30
-
31
- headers.each do |key, value|
32
- add_header(key, value)
33
- end
34
- end
35
-
36
21
  def serialize_connection_data
37
22
  [connection_type, 0, 0, 0, 0, 0, 0]
38
23
  end
@@ -50,14 +35,6 @@ module Hypertube
50
35
 
51
36
  private
52
37
 
53
- def serialize_headers_for_key
54
- return '' if headers.nil? || headers.empty?
55
-
56
- headers
57
- .sort_by { |key, _| key.to_s }
58
- .map { |key, value| "#{key}=#{value}" }
59
- .join(';')
60
- end
61
38
  end
62
39
  end
63
40
  end
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.0.6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hypertube-binaries",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "Hypertube allows you to reference and use modules or packages written in (Java/Kotlin/Groovy/Clojure, C#/VB.NET, Ruby, Perl, Python, JavaScript/TypeScript) like they were created in your technology. It works on Linux/Windows and MacOS for applications created in JVM, CLR/Netcore, Perl, Python, Ruby, NodeJS, C++ or GoLang and gives you unparalleled freedom and flexibility with native performance in building your mixed-technologies products. Let it be accessing best AI or cryptography libraries, devices SDKs, legacy client modules, internal custom packages or anything from public repositories available on NPM, Nuget, PyPI, Maven/Gradle, RubyGems or GitHub. Get free from programming languages barriers today! For more information check out our guides at https://www.hypertube.dev/guides/v2/",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",