itsi 0.2.21.rc2 → 0.2.21

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +20 -0
  3. data/CHANGELOG.md +1 -1
  4. data/Cargo.lock +2 -2
  5. data/Dockerfile +2 -2
  6. data/crates/itsi_acme/src/caches/no.rs +1 -1
  7. data/crates/itsi_acme/src/caches/test.rs +3 -3
  8. data/crates/itsi_acme/src/config.rs +6 -6
  9. data/crates/itsi_acme/src/lib.rs +1 -1
  10. data/crates/itsi_error/src/lib.rs +32 -15
  11. data/crates/itsi_rb_helpers/src/heap_value.rs +2 -2
  12. data/crates/itsi_scheduler/Cargo.toml +1 -1
  13. data/crates/itsi_scheduler/src/itsi_scheduler.rs +1 -1
  14. data/crates/itsi_server/Cargo.toml +1 -1
  15. data/crates/itsi_server/src/ruby_types/itsi_body_proxy/big_bytes.rs +10 -3
  16. data/crates/itsi_server/src/ruby_types/itsi_body_proxy/mod.rs +10 -6
  17. data/crates/itsi_server/src/ruby_types/itsi_grpc_call.rs +7 -5
  18. data/crates/itsi_server/src/ruby_types/itsi_grpc_response_stream/mod.rs +2 -2
  19. data/crates/itsi_server/src/ruby_types/itsi_http_request.rs +10 -7
  20. data/crates/itsi_server/src/ruby_types/itsi_http_response.rs +13 -5
  21. data/crates/itsi_server/src/ruby_types/itsi_server/file_watcher.rs +6 -6
  22. data/crates/itsi_server/src/ruby_types/itsi_server/itsi_server_config.rs +15 -11
  23. data/crates/itsi_server/src/ruby_types/itsi_server.rs +2 -2
  24. data/crates/itsi_server/src/server/middleware_stack/middleware.rs +1 -1
  25. data/crates/itsi_server/src/server/middleware_stack/middlewares/compression.rs +1 -3
  26. data/crates/itsi_server/src/server/middleware_stack/middlewares/mod.rs +2 -2
  27. data/crates/itsi_server/src/server/middleware_stack/middlewares/proxy.rs +2 -2
  28. data/crates/itsi_server/src/server/middleware_stack/middlewares/redirect.rs +1 -1
  29. data/crates/itsi_server/src/server/middleware_stack/middlewares/ruby_app.rs +17 -7
  30. data/crates/itsi_server/src/server/middleware_stack/mod.rs +12 -12
  31. data/crates/itsi_server/src/server/serve_strategy/cluster_mode.rs +4 -3
  32. data/crates/itsi_server/src/services/password_hasher.rs +1 -1
  33. data/crates/itsi_server/src/services/static_file_server.rs +3 -4
  34. data/gems/scheduler/Cargo.lock +4006 -550
  35. data/gems/scheduler/lib/itsi/scheduler/version.rb +1 -1
  36. data/gems/server/Cargo.lock +28 -1
  37. data/gems/server/lib/itsi/server/version.rb +1 -1
  38. data/lib/itsi/version.rb +1 -1
  39. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4117986c1d041e81b0ffd2aa390c19db3798893d98c30ed9c3fe51d8fb5dafd
4
- data.tar.gz: b3025a1c7e133a6afedda5cbe45e92f043c36a30aa3d0e62c325040b9a055d06
3
+ metadata.gz: edac434aa9724351fa9fe5220e3451534473303c08d5b6ad34d56bbd5fb1aec6
4
+ data.tar.gz: 88efe1b953ed1a418666d32730450eb7c14c232d25ea94dcc4b1f169f649367e
5
5
  SHA512:
6
- metadata.gz: 0e27ce25615c7528cc2732c42bbe1966de03b31c91633ddfbbcf0d42bf439bff56c8878bb631dfd3644115309149dfc69e7ac1cf32b059d9f429b9819dd77893
7
- data.tar.gz: f6f30ce1824850bc24109ac052613f63f43afaf300ee75280d8a2ad24501998cfe2486594f79b5b272bcc53459b823457c103ef32dfa5c59a82e71dab0a1a838
6
+ metadata.gz: 675fe7f09ec66c9583f3c69963127f3ec01e46bf613657bc7d8778919dfccf2a38d420348af3ed51fd5f4df6d05291fec816eab78daa67325196d589eb7dae82
7
+ data.tar.gz: e6d3276f2b3e59f5dd6cda1f3bcb44e54a59260ca0bf265092bd26069f6ecb3a2c56ad804792a2304062f3e6f3e0e355cf668b89a9a8a93a18168ca4f90ed811
data/.rubocop.yml ADDED
@@ -0,0 +1,20 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+ Include:
6
+ - gems/server/lib/**/*.rb
7
+ - gems/scheduler/lib/**/*.rb
8
+ Exclude:
9
+ - examples/**/*
10
+ - gems/**/tmp/**/*
11
+ - target/**/*
12
+ - pkg/**/*
13
+ - vendor/**/*
14
+ - tmp/**/*
15
+
16
+ Style/StringLiterals:
17
+ EnforcedStyle: double_quotes
18
+
19
+ Style/StringLiteralsInInterpolation:
20
+ EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.2.21-rc2] - 2026-02-16
1
+ ## [0.2.21] - 2026-02-16
2
2
  - Fix Ruby 2.7 startup NameError in static_assets redirect schema load path
3
3
 
4
4
  ## [0.2.21-rc1] - 2026-01-08
data/Cargo.lock CHANGED
@@ -1644,7 +1644,7 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
1644
1644
 
1645
1645
  [[package]]
1646
1646
  name = "itsi-scheduler"
1647
- version = "0.2.21-rc1"
1647
+ version = "0.2.21"
1648
1648
  dependencies = [
1649
1649
  "bytes",
1650
1650
  "derive_more",
@@ -1662,7 +1662,7 @@ dependencies = [
1662
1662
 
1663
1663
  [[package]]
1664
1664
  name = "itsi-server"
1665
- version = "0.2.21-rc1"
1665
+ version = "0.2.21"
1666
1666
  dependencies = [
1667
1667
  "argon2",
1668
1668
  "async-channel",
data/Dockerfile CHANGED
@@ -3,7 +3,7 @@ FROM ruby:3.4
3
3
  RUN apt-get update && apt-get install build-essential libclang-dev -y && apt-get clean && rm -rf /var/lib/apt/lists/*
4
4
  RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
5
5
 
6
- COPY pkg/itsi-server-0.2.21.rc1.gem .
7
- RUN gem install itsi-server-0.2.21.rc1.gem
6
+ COPY pkg/itsi-server-0.2.21.gem .
7
+ RUN gem install itsi-server-0.2.21.gem
8
8
 
9
9
  CMD ["itsi", "serve"]
@@ -7,7 +7,7 @@ use std::sync::atomic::AtomicPtr;
7
7
 
8
8
  /// No-op cache, which does nothing.
9
9
  /// ```rust
10
- /// # use tokio_rustls_acme::caches::NoCache;
10
+ /// # use itsi_acme::caches::NoCache;
11
11
  /// # type EC = std::io::Error;
12
12
  /// # type EA = EC;
13
13
  /// let no_cache = NoCache::<EC, EA>::new();
@@ -10,9 +10,9 @@ use std::sync::atomic::AtomicPtr;
10
10
  use std::sync::Arc;
11
11
 
12
12
  /// Test cache, which generates certificates for ACME incompatible test environments.
13
- /// ```rust
14
- /// # use tokio_rustls_acme::{AcmeConfig};
15
- /// # use tokio_rustls_acme::caches::{DirCache, TestCache};
13
+ /// ```rust,no_run
14
+ /// # use itsi_acme::AcmeConfig;
15
+ /// # use itsi_acme::caches::{DirCache, TestCache};
16
16
  /// # let test_environment = true;
17
17
  /// let mut config = AcmeConfig::new(["example.com"])
18
18
  /// .cache(DirCache::new("./cache"));
@@ -31,9 +31,9 @@ impl AcmeConfig<Infallible, Infallible> {
31
31
  /// error types will be `Infallible` since the cache cannot return an error. The methods to set
32
32
  /// a cache will change the error types to match those returned by the supplied cache.
33
33
  ///
34
- /// ```rust
35
- /// # use tokio_rustls_acme::AcmeConfig;
36
- /// use tokio_rustls_acme::caches::DirCache;
34
+ /// ```rust,no_run
35
+ /// # use itsi_acme::AcmeConfig;
36
+ /// use itsi_acme::caches::DirCache;
37
37
  /// let config = AcmeConfig::new(["example.com"]).cache(DirCache::new("./rustls_acme_cache"));
38
38
  /// ```
39
39
  ///
@@ -43,9 +43,9 @@ impl AcmeConfig<Infallible, Infallible> {
43
43
  /// An uncached instance of [AcmeConfig] with particular type parameters can be created using
44
44
  /// [NoCache].
45
45
  ///
46
- /// ```rust
47
- /// # use tokio_rustls_acme::AcmeConfig;
48
- /// use tokio_rustls_acme::caches::NoCache;
46
+ /// ```rust,no_run
47
+ /// # use itsi_acme::AcmeConfig;
48
+ /// use itsi_acme::caches::NoCache;
49
49
  /// # type EC = std::io::Error;
50
50
  /// # type EA = EC;
51
51
  /// let config: AcmeConfig<EC, EA> = AcmeConfig::new(["example.com"]).cache(NoCache::new());
@@ -31,7 +31,7 @@
31
31
  //! ```rust,no_run
32
32
  //! use tokio::io::AsyncWriteExt;
33
33
  //! use futures::StreamExt;
34
- //! use tokio_rustls_acme::{AcmeConfig, caches::DirCache};
34
+ //! use itsi_acme::{AcmeConfig, caches::DirCache};
35
35
  //! use tokio_stream::wrappers::TcpListenerStream;
36
36
  //!
37
37
  //! #[tokio::main]
@@ -1,9 +1,6 @@
1
1
  pub use anyhow::Context;
2
2
  use magnus::Error as MagnusError;
3
- use magnus::{
4
- error::ErrorType,
5
- exception::{self, arg_error, standard_error},
6
- };
3
+ use magnus::{error::ErrorType, Ruby};
7
4
  use thiserror::Error;
8
5
 
9
6
  pub static CLIENT_CONNECTION_CLOSED: &str = "Client disconnected";
@@ -73,7 +70,10 @@ pub trait IntoMagnusError {
73
70
 
74
71
  impl<T: std::error::Error> IntoMagnusError for T {
75
72
  fn into_magnus_error(self) -> MagnusError {
76
- MagnusError::new(standard_error(), self.to_string())
73
+ MagnusError::new(
74
+ Ruby::get().unwrap().exception_standard_error(),
75
+ self.to_string(),
76
+ )
77
77
  }
78
78
  }
79
79
 
@@ -92,17 +92,34 @@ impl From<String> for ItsiError {
92
92
  impl From<ItsiError> for magnus::Error {
93
93
  fn from(err: ItsiError) -> Self {
94
94
  match err {
95
- ItsiError::InvalidInput(msg) => magnus::Error::new(arg_error(), msg),
96
- ItsiError::InternalServerError(msg) => magnus::Error::new(standard_error(), msg),
97
- ItsiError::InternalError(msg) => magnus::Error::new(standard_error(), msg),
98
- ItsiError::UnsupportedProtocol(msg) => magnus::Error::new(arg_error(), msg),
99
- ItsiError::ArgumentError(msg) => magnus::Error::new(arg_error(), msg),
100
- ItsiError::Jump(msg) => magnus::Error::new(exception::local_jump_error(), msg),
101
- ItsiError::ClientConnectionClosed => {
102
- magnus::Error::new(exception::eof_error(), CLIENT_CONNECTION_CLOSED)
95
+ ItsiError::InvalidInput(msg) => {
96
+ magnus::Error::new(Ruby::get().unwrap().exception_arg_error(), msg)
97
+ }
98
+ ItsiError::InternalServerError(msg) => {
99
+ magnus::Error::new(Ruby::get().unwrap().exception_standard_error(), msg)
100
+ }
101
+ ItsiError::InternalError(msg) => {
102
+ magnus::Error::new(Ruby::get().unwrap().exception_standard_error(), msg)
103
+ }
104
+ ItsiError::UnsupportedProtocol(msg) => {
105
+ magnus::Error::new(Ruby::get().unwrap().exception_arg_error(), msg)
106
+ }
107
+ ItsiError::ArgumentError(msg) => {
108
+ magnus::Error::new(Ruby::get().unwrap().exception_arg_error(), msg)
109
+ }
110
+ ItsiError::Jump(msg) => {
111
+ magnus::Error::new(Ruby::get().unwrap().exception_local_jump_error(), msg)
112
+ }
113
+ ItsiError::ClientConnectionClosed => magnus::Error::new(
114
+ Ruby::get().unwrap().exception_eof_error(),
115
+ CLIENT_CONNECTION_CLOSED,
116
+ ),
117
+ ItsiError::Break => {
118
+ magnus::Error::new(Ruby::get().unwrap().exception_interrupt(), "Break")
119
+ }
120
+ ItsiError::Pass => {
121
+ magnus::Error::new(Ruby::get().unwrap().exception_interrupt(), "Pass")
103
122
  }
104
- ItsiError::Break => magnus::Error::new(exception::interrupt(), "Break"),
105
- ItsiError::Pass => magnus::Error::new(exception::interrupt(), "Pass"),
106
123
  ItsiError::Io(err) => err.into_magnus_error(),
107
124
  ItsiError::Rcgen(err) => err.into_magnus_error(),
108
125
  ItsiError::HttpParse(err) => err.into_magnus_error(),
@@ -66,7 +66,7 @@ where
66
66
  T: ReprValue,
67
67
  {
68
68
  fn into_value_with(self, _: &Ruby) -> Value {
69
- self.0.into_value()
69
+ self.0.into_value_with(&magnus::Ruby::get().unwrap())
70
70
  }
71
71
  }
72
72
 
@@ -116,7 +116,7 @@ impl Deref for HeapVal {
116
116
 
117
117
  impl IntoValue for HeapVal {
118
118
  fn into_value_with(self, _: &Ruby) -> Value {
119
- self.0.into_value()
119
+ self.0.into_value_with(&magnus::Ruby::get().unwrap())
120
120
  }
121
121
  }
122
122
 
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "itsi-scheduler"
3
- version = "0.2.21-rc1"
3
+ version = "0.2.21"
4
4
  edition = "2021"
5
5
  authors = ["Wouter Coppieters <wc@pico.net.nz>"]
6
6
  license = "MIT"
@@ -68,7 +68,7 @@ impl ItsiScheduler {
68
68
  pub fn wake(&self) -> MagnusResult<()> {
69
69
  self.waker.lock().wake().map_err(|_| {
70
70
  magnus::Error::new(
71
- magnus::exception::standard_error(),
71
+ magnus::Ruby::get().unwrap().exception_standard_error(),
72
72
  "Failed to wake the scheduler",
73
73
  )
74
74
  })?;
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "itsi-server"
3
- version = "0.2.21-rc1"
3
+ version = "0.2.21"
4
4
  edition = "2021"
5
5
  authors = ["Wouter Coppieters <wc@pico.net.nz>"]
6
6
  license = "MIT"
@@ -50,14 +50,21 @@ impl BigBytes {
50
50
  if bytes.is_empty() {
51
51
  None
52
52
  } else {
53
- Some(bytes.into_value())
53
+ Some(bytes.into_value_with(&magnus::Ruby::get().unwrap()))
54
54
  }
55
55
  }
56
56
  BigBytes::OnDisk(path) => {
57
57
  let ruby = Ruby::get().unwrap();
58
58
  let rarray = ruby.ary_new();
59
- rarray.push(path.path().to_str().unwrap().into_value()).ok();
60
- Some(rarray.into_value())
59
+ rarray
60
+ .push(
61
+ path.path()
62
+ .to_str()
63
+ .unwrap()
64
+ .into_value_with(&magnus::Ruby::get().unwrap()),
65
+ )
66
+ .ok();
67
+ Some(rarray.into_value_with(&magnus::Ruby::get().unwrap()))
61
68
  }
62
69
  }
63
70
  }
@@ -32,7 +32,9 @@ impl ItsiBody {
32
32
  pub fn into_value(&self) -> Option<Value> {
33
33
  match self {
34
34
  ItsiBody::Buffered(bytes) => bytes.as_value(),
35
- ItsiBody::Stream(proxy) => Some(proxy.clone().into_value()),
35
+ ItsiBody::Stream(proxy) => {
36
+ Some(proxy.clone().into_value_with(&magnus::Ruby::get().unwrap()))
37
+ }
36
38
  ItsiBody::Empty => None,
37
39
  }
38
40
  }
@@ -54,7 +56,7 @@ impl ItsiBodyProxy {
54
56
  if let Some(chunk) = block_on(stream.next()) {
55
57
  let chunk = chunk.map_err(|err| {
56
58
  magnus::Error::new(
57
- magnus::exception::standard_error(),
59
+ magnus::Ruby::get().unwrap().exception_standard_error(),
58
60
  format!("Error reading body {:?}", err),
59
61
  )
60
62
  })?;
@@ -86,7 +88,7 @@ impl ItsiBodyProxy {
86
88
  if let Some(chunk) = block_on(stream.next()) {
87
89
  let chunk = chunk.map_err(|err| {
88
90
  magnus::Error::new(
89
- magnus::exception::standard_error(),
91
+ magnus::Ruby::get().unwrap().exception_standard_error(),
90
92
  format!("Error reading body {:?}", err),
91
93
  )
92
94
  })?;
@@ -97,7 +99,9 @@ impl ItsiBodyProxy {
97
99
  break;
98
100
  }
99
101
  }
100
- let output_string = buffer.take().unwrap_or(RString::buf_new(buf.len()));
102
+ let output_string = buffer
103
+ .take()
104
+ .unwrap_or(magnus::Ruby::get().unwrap().str_buf_new(buf.len()));
101
105
  output_string.cat(buf.clone());
102
106
  buf.clear();
103
107
  Ok(Some(output_string))
@@ -111,7 +115,7 @@ impl ItsiBodyProxy {
111
115
  while let Some(chunk) = block_on(stream.next()) {
112
116
  let chunk = chunk.map_err(|err| {
113
117
  magnus::Error::new(
114
- magnus::exception::standard_error(),
118
+ magnus::Ruby::get().unwrap().exception_standard_error(),
115
119
  format!("Error reading body {:?}", err),
116
120
  )
117
121
  })?;
@@ -133,7 +137,7 @@ impl ItsiBodyProxy {
133
137
  fn verify_open(&self) -> MagnusResult<()> {
134
138
  if self.closed.load(atomic::Ordering::SeqCst) {
135
139
  return Err(magnus::Error::new(
136
- magnus::exception::standard_error(),
140
+ magnus::Ruby::get().unwrap().exception_standard_error(),
137
141
  "Body stream is closed",
138
142
  ));
139
143
  }
@@ -64,7 +64,9 @@ impl ItsiGrpcCall {
64
64
  let snake_case_method_name = METHOD_NAME_REGEX
65
65
  .replace_all(method_name, "${1}_${2}")
66
66
  .to_lowercase();
67
- Ok(Symbol::new(snake_case_method_name))
67
+ Ok(magnus::Ruby::get()
68
+ .unwrap()
69
+ .to_symbol(snake_case_method_name))
68
70
  }
69
71
 
70
72
  pub fn stream(&self) -> MagnusResult<ItsiGrpcResponseStream> {
@@ -205,7 +207,7 @@ impl ItsiGrpcCall {
205
207
  })
206
208
  .map_err(|e: std::io::Error| {
207
209
  Error::new(
208
- magnus::exception::standard_error(),
210
+ magnus::Ruby::get().unwrap().exception_standard_error(),
209
211
  format!("deflate decompression failed: {}", e),
210
212
  )
211
213
  })?;
@@ -224,7 +226,7 @@ impl ItsiGrpcCall {
224
226
  })
225
227
  .map_err(|e: std::io::Error| {
226
228
  Error::new(
227
- magnus::exception::standard_error(),
229
+ magnus::Ruby::get().unwrap().exception_standard_error(),
228
230
  format!("gzip decompression failed: {}", e),
229
231
  )
230
232
  })?;
@@ -243,7 +245,7 @@ impl ItsiGrpcCall {
243
245
  })
244
246
  .map_err(|e| {
245
247
  Error::new(
246
- magnus::exception::standard_error(),
248
+ magnus::Ruby::get().unwrap().exception_standard_error(),
247
249
  format!("gzip compression failed: {e}"),
248
250
  )
249
251
  })?;
@@ -262,7 +264,7 @@ impl ItsiGrpcCall {
262
264
  })
263
265
  .map_err(|e| {
264
266
  Error::new(
265
- magnus::exception::standard_error(),
267
+ magnus::Ruby::get().unwrap().exception_standard_error(),
266
268
  format!("deflate compression failed: {e}"),
267
269
  )
268
270
  })?;
@@ -59,7 +59,7 @@ impl ItsiGrpcResponseStreamInner {
59
59
  .blocking_send(ByteFrame::Data(bytes))
60
60
  .map_err(|err| {
61
61
  magnus::Error::new(
62
- magnus::exception::io_error(),
62
+ magnus::Ruby::get().unwrap().exception_io_error(),
63
63
  format!("Trying to write to closed stream: {:?}", err),
64
64
  )
65
65
  })?;
@@ -80,7 +80,7 @@ impl ItsiGrpcResponseStreamInner {
80
80
  let trailer_tx = std::mem::replace(&mut self.trailer_tx, oneshot::channel().0);
81
81
  trailer_tx.send(header_map).map_err(|err| {
82
82
  magnus::Error::new(
83
- magnus::exception::standard_error(),
83
+ magnus::Ruby::get().unwrap().exception_standard_error(),
84
84
  format!("Error sending trailers {:?}", err),
85
85
  )
86
86
  })?;
@@ -6,9 +6,9 @@ use itsi_error::CLIENT_CONNECTION_CLOSED;
6
6
  use itsi_rb_helpers::{funcall_no_ret, print_rb_backtrace, HeapValue};
7
7
  use itsi_tracing::debug;
8
8
  use magnus::{
9
- block::{yield_values, Proc},
9
+ block::Proc,
10
10
  error::{ErrorType, Result as MagnusResult},
11
- Error, IntoValue, RHash, Symbol,
11
+ Error, IntoValue, RHash,
12
12
  };
13
13
  use magnus::{
14
14
  value::{LazyId, ReprValue},
@@ -110,20 +110,20 @@ impl ItsiHttpRequest {
110
110
  // when building against Ruby < 3.2...
111
111
  #[cfg(not(ruby_gte_3_2))]
112
112
  {
113
- RHash::new()
113
+ magnus::Ruby::get().unwrap().hash_new()
114
114
  }
115
115
  };
116
116
  for (i, group_name) in re.capture_names().enumerate().skip(1) {
117
117
  if let Some(name) = group_name {
118
118
  if let Some(m) = caps.get(i) {
119
119
  // Insert into the hash: key is the group name, value is the match.
120
- params.aset(Symbol::new(name), m.as_str())?;
120
+ params.aset(magnus::Ruby::get().unwrap().to_symbol(name), m.as_str())?;
121
121
  }
122
122
  }
123
123
  }
124
124
  Ok(params)
125
125
  } else {
126
- Ok(RHash::new())
126
+ Ok(magnus::Ruby::get().unwrap().hash_new())
127
127
  }
128
128
  }
129
129
 
@@ -201,7 +201,7 @@ impl ItsiHttpRequest {
201
201
  }
202
202
  },
203
203
  Ok(_) => match receiver.await {
204
- Ok(ResponseFrame::HttpResponse(response)) => Ok(response),
204
+ Ok(ResponseFrame::HttpResponse(response)) => Ok(*response),
205
205
  Ok(ResponseFrame::HijackedResponse(response)) => {
206
206
  match response.process_hijacked_response().await {
207
207
  Ok(result) => Ok(result),
@@ -354,7 +354,10 @@ impl ItsiHttpRequest {
354
354
 
355
355
  pub(crate) fn each_header(&self) -> MagnusResult<()> {
356
356
  self.parts.headers.iter().for_each(|(hn, hv)| {
357
- yield_values::<_, Value>((hn.as_str(), hv.to_str().unwrap_or(""))).ok();
357
+ magnus::Ruby::get()
358
+ .unwrap()
359
+ .yield_values::<_, Value>((hn.as_str(), hv.to_str().unwrap_or("")))
360
+ .ok();
358
361
  });
359
362
  Ok(())
360
363
  }
@@ -63,7 +63,7 @@ pub struct ResponseInner {
63
63
 
64
64
  #[derive(Debug)]
65
65
  pub enum ResponseFrame {
66
- HttpResponse(HttpResponse),
66
+ HttpResponse(Box<HttpResponse>),
67
67
  HijackedResponse(ItsiHttpResponse),
68
68
  }
69
69
 
@@ -225,7 +225,9 @@ impl ItsiHttpResponse {
225
225
  if let Some(mut response) = self.response.write().take() {
226
226
  *response.status_mut() = StatusCode::INTERNAL_SERVER_ERROR;
227
227
  if let Some(sender) = self.response_sender.write().take() {
228
- sender.send(ResponseFrame::HttpResponse(response)).ok();
228
+ sender
229
+ .send(ResponseFrame::HttpResponse(Box::new(response)))
230
+ .ok();
229
231
  }
230
232
  }
231
233
  }
@@ -235,7 +237,9 @@ impl ItsiHttpResponse {
235
237
  if let Some(mut response) = self.response.write().take() {
236
238
  *response.status_mut() = StatusCode::SERVICE_UNAVAILABLE;
237
239
  if let Some(sender) = self.response_sender.write().take() {
238
- sender.send(ResponseFrame::HttpResponse(response)).ok();
240
+ sender
241
+ .send(ResponseFrame::HttpResponse(Box::new(response)))
242
+ .ok();
239
243
  }
240
244
  }
241
245
  }
@@ -253,7 +257,9 @@ impl ItsiHttpResponse {
253
257
  *response.body_mut() = HttpBody::stream(buffered);
254
258
  self.frame_writer.write().replace(writer);
255
259
  if let Some(sender) = self.response_sender.write().take() {
256
- sender.send(ResponseFrame::HttpResponse(response)).ok();
260
+ sender
261
+ .send(ResponseFrame::HttpResponse(Box::new(response)))
262
+ .ok();
257
263
  }
258
264
  } else {
259
265
  info!("No response!");
@@ -280,7 +286,9 @@ impl ItsiHttpResponse {
280
286
  *response.body_mut() = HttpBody::full(frame);
281
287
  }
282
288
  if let Some(sender) = self.response_sender.write().take() {
283
- sender.send(ResponseFrame::HttpResponse(response)).ok();
289
+ sender
290
+ .send(ResponseFrame::HttpResponse(Box::new(response)))
291
+ .ok();
284
292
  }
285
293
  }
286
294
 
@@ -110,7 +110,7 @@ pub fn send_watcher_command(fd: &OwnedFd, cmd: WatcherCommand) -> Result<()> {
110
110
  match write(fd, &buf) {
111
111
  Ok(_) => Ok(()),
112
112
  Err(e) => Err(magnus::Error::new(
113
- magnus::exception::standard_error(),
113
+ magnus::Ruby::get().unwrap().exception_standard_error(),
114
114
  format!("Failed to send command to watcher: {}", e),
115
115
  )),
116
116
  }
@@ -122,14 +122,14 @@ pub fn watch_groups(
122
122
  // Create bidirectional pipes for communication
123
123
  let (parent_read_fd, child_write_fd): (OwnedFd, OwnedFd) = pipe().map_err(|e| {
124
124
  magnus::Error::new(
125
- magnus::exception::standard_error(),
125
+ magnus::Ruby::get().unwrap().exception_standard_error(),
126
126
  format!("Failed to create parent read pipe: {}", e),
127
127
  )
128
128
  })?;
129
129
 
130
130
  let (child_read_fd, parent_write_fd): (OwnedFd, OwnedFd) = pipe().map_err(|e| {
131
131
  magnus::Error::new(
132
- magnus::exception::standard_error(),
132
+ magnus::Ruby::get().unwrap().exception_standard_error(),
133
133
  format!("Failed to create child read pipe: {}", e),
134
134
  )
135
135
  })?;
@@ -137,7 +137,7 @@ pub fn watch_groups(
137
137
  let fork_result = unsafe {
138
138
  fork().map_err(|e| {
139
139
  magnus::Error::new(
140
- magnus::exception::standard_error(),
140
+ magnus::Ruby::get().unwrap().exception_standard_error(),
141
141
  format!("Failed to fork file watcher: {}", e),
142
142
  )
143
143
  })
@@ -194,7 +194,7 @@ pub fn watch_groups(
194
194
 
195
195
  let glob = Glob::new(&remaining_pattern).map_err(|e| {
196
196
  magnus::Error::new(
197
- magnus::exception::standard_error(),
197
+ magnus::Ruby::get().unwrap().exception_standard_error(),
198
198
  format!(
199
199
  "Failed to create watch glob for pattern '{}': {}",
200
200
  remaining_pattern, e
@@ -203,7 +203,7 @@ pub fn watch_groups(
203
203
  })?;
204
204
  let glob_set = GlobSetBuilder::new().add(glob).build().map_err(|e| {
205
205
  magnus::Error::new(
206
- magnus::exception::standard_error(),
206
+ magnus::Ruby::get().unwrap().exception_standard_error(),
207
207
  format!("Failed to create watch glob set: {}", e),
208
208
  )
209
209
  })?;
@@ -14,7 +14,7 @@ use magnus::{
14
14
  block::Proc,
15
15
  error::Result,
16
16
  value::{LazyId, ReprValue},
17
- RArray, RHash, Ruby, Symbol, TryConvert, Value,
17
+ RArray, RHash, Ruby, TryConvert, Value,
18
18
  };
19
19
  use nix::{
20
20
  fcntl::{fcntl, FcntlArg, FdFlag},
@@ -161,14 +161,14 @@ impl ServerParams {
161
161
  Vec::<String>::try_convert(error_lines.unwrap().as_value())?;
162
162
  ItsiServerConfig::print_config_errors(errors);
163
163
  return Err(magnus::Error::new(
164
- magnus::exception::runtime_error(),
164
+ magnus::Ruby::get().unwrap().exception_runtime_error(),
165
165
  "Failed to set middleware",
166
166
  ));
167
167
  }
168
168
  let middleware = MiddlewareSet::new(routes_raw)?;
169
169
  self.middleware.set(middleware).map_err(|_| {
170
170
  magnus::Error::new(
171
- magnus::exception::runtime_error(),
171
+ magnus::Ruby::get().unwrap().exception_runtime_error(),
172
172
  "Failed to set middleware",
173
173
  )
174
174
  })?;
@@ -361,7 +361,7 @@ impl ServerParams {
361
361
  let bind_to_fd_map: HashMap<String, i32> = serde_json::from_str(preexisting_listeners)
362
362
  .map_err(|e| {
363
363
  magnus::Error::new(
364
- magnus::exception::standard_error(),
364
+ magnus::Ruby::get().unwrap().exception_standard_error(),
365
365
  format!("Invalid listener info: {}", e),
366
366
  )
367
367
  })?;
@@ -393,7 +393,10 @@ impl ServerParams {
393
393
  .iter()
394
394
  .map(|listener| {
395
395
  listener.handover().map_err(|e| {
396
- magnus::Error::new(magnus::exception::runtime_error(), e.to_string())
396
+ magnus::Error::new(
397
+ magnus::Ruby::get().unwrap().exception_runtime_error(),
398
+ e.to_string(),
399
+ )
397
400
  })
398
401
  })
399
402
  .collect::<Result<HashMap<String, i32>>>()?;
@@ -419,7 +422,8 @@ impl ItsiServerConfig {
419
422
  itsi_config_proc.clone(),
420
423
  ) {
421
424
  Ok(server_params) => {
422
- cli_params.delete::<_, Value>(Symbol::new("listeners"))?;
425
+ cli_params
426
+ .delete::<_, Value>(magnus::Ruby::get().unwrap().to_symbol("listeners"))?;
423
427
 
424
428
  let watcher_fd = if let Some(watchers) = server_params.notify_watchers.clone() {
425
429
  file_watcher::watch_groups(watchers)?
@@ -436,7 +440,7 @@ impl ItsiServerConfig {
436
440
  })
437
441
  }
438
442
  Err(err) => Err(magnus::Error::new(
439
- magnus::exception::standard_error(),
443
+ magnus::Ruby::get().unwrap().exception_standard_error(),
440
444
  format!("Error loading initial configuration {:?}", err),
441
445
  )),
442
446
  }
@@ -493,7 +497,7 @@ impl ItsiServerConfig {
493
497
  if !errors.is_empty() {
494
498
  Self::print_config_errors(errors);
495
499
  return Err(magnus::Error::new(
496
- magnus::exception::standard_error(),
500
+ magnus::Ruby::get().unwrap().exception_standard_error(),
497
501
  "Invalid server config",
498
502
  ));
499
503
  }
@@ -567,13 +571,13 @@ impl ItsiServerConfig {
567
571
  .map(|(str, fd)| {
568
572
  let dupped_fd = dup(*fd).map_err(|errno| {
569
573
  magnus::Error::new(
570
- magnus::exception::standard_error(),
574
+ magnus::Ruby::get().unwrap().exception_standard_error(),
571
575
  format!("Errno {} while trying to dup {}", errno, fd),
572
576
  )
573
577
  })?;
574
578
  Self::clear_cloexec(dupped_fd).map_err(|e| {
575
579
  magnus::Error::new(
576
- magnus::exception::standard_error(),
580
+ magnus::Ruby::get().unwrap().exception_standard_error(),
577
581
  format!("Failed to clear cloexec flag for fd {}: {}", dupped_fd, e),
578
582
  )
579
583
  })?;
@@ -629,7 +633,7 @@ impl ItsiServerConfig {
629
633
  serde_json::to_string(&self.server_params.read().listener_info.lock().clone())
630
634
  .map_err(|e| {
631
635
  magnus::Error::new(
632
- magnus::exception::standard_error(),
636
+ magnus::Ruby::get().unwrap().exception_standard_error(),
633
637
  format!("Invalid listener info: {}", e),
634
638
  )
635
639
  })?;