itsi-server 0.1.7 → 0.1.8
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.
Potentially problematic release.
This version of itsi-server might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Cargo.lock +2917 -0
- data/Cargo.toml +7 -0
- data/ext/itsi_error/src/from.rs +26 -29
- data/ext/itsi_server/Cargo.lock +2956 -0
- data/ext/itsi_server/Cargo.toml +1 -1
- data/ext/itsi_server/src/request/itsi_request.rs +7 -7
- data/ext/itsi_server/src/server/bind.rs +4 -3
- data/ext/itsi_server/src/server/itsi_server.rs +1 -8
- data/ext/itsi_server/src/server/listener.rs +98 -107
- data/ext/itsi_server/src/server/serve_strategy/single_mode.rs +22 -12
- data/ext/itsi_server/src/server/tls.rs +9 -5
- data/lib/itsi/index.html.erb +91 -0
- data/lib/itsi/server/scheduler_mode.rb +1 -1
- data/lib/itsi/server/version.rb +1 -1
- data/lib/itsi/server.rb +22 -2
- metadata +5 -1
data/Cargo.toml
ADDED
data/ext/itsi_error/src/from.rs
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
+
use magnus::{
|
2
|
+
Error,
|
3
|
+
error::ErrorType,
|
4
|
+
exception::{self, arg_error, exception},
|
5
|
+
};
|
6
|
+
use nix::errno::Errno;
|
7
|
+
|
1
8
|
use crate::ItsiError;
|
2
|
-
use std::ffi::NulError;
|
9
|
+
use std::{ffi::NulError, io};
|
3
10
|
|
4
11
|
pub static CLIENT_CONNECTION_CLOSED: &str = "Client disconnected";
|
5
12
|
|
@@ -9,14 +16,14 @@ impl From<httparse::Error> for ItsiError {
|
|
9
16
|
}
|
10
17
|
}
|
11
18
|
|
12
|
-
impl From<
|
13
|
-
fn from(err:
|
19
|
+
impl From<Errno> for ItsiError {
|
20
|
+
fn from(err: Errno) -> Self {
|
14
21
|
ItsiError::ArgumentError(err.to_string())
|
15
22
|
}
|
16
23
|
}
|
17
24
|
|
18
|
-
impl From<
|
19
|
-
fn from(err:
|
25
|
+
impl From<io::Error> for ItsiError {
|
26
|
+
fn from(err: io::Error) -> Self {
|
20
27
|
ItsiError::ArgumentError(err.to_string())
|
21
28
|
}
|
22
29
|
}
|
@@ -33,39 +40,29 @@ impl From<NulError> for ItsiError {
|
|
33
40
|
}
|
34
41
|
}
|
35
42
|
|
36
|
-
impl From<
|
37
|
-
fn from(err:
|
43
|
+
impl From<Error> for ItsiError {
|
44
|
+
fn from(err: Error) -> Self {
|
38
45
|
match err.error_type() {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
}
|
43
|
-
magnus::error::ErrorType::Exception(exception) => {
|
44
|
-
ItsiError::ArgumentError(exception.to_string())
|
45
|
-
}
|
46
|
+
ErrorType::Jump(tag) => ItsiError::Jump(tag.to_string()),
|
47
|
+
ErrorType::Error(_exception_class, cow) => ItsiError::ArgumentError(cow.to_string()),
|
48
|
+
ErrorType::Exception(exception) => ItsiError::ArgumentError(exception.to_string()),
|
46
49
|
}
|
47
50
|
}
|
48
51
|
}
|
49
52
|
|
50
|
-
impl From<ItsiError> for
|
53
|
+
impl From<ItsiError> for Error {
|
51
54
|
fn from(err: ItsiError) -> Self {
|
52
55
|
match err {
|
53
|
-
ItsiError::InvalidInput(msg) =>
|
54
|
-
ItsiError::InternalServerError(msg) =>
|
55
|
-
|
56
|
-
|
57
|
-
ItsiError::
|
58
|
-
|
59
|
-
}
|
60
|
-
ItsiError::ArgumentError(msg) => {
|
61
|
-
magnus::Error::new(magnus::exception::arg_error(), msg)
|
62
|
-
}
|
63
|
-
ItsiError::Jump(msg) => magnus::Error::new(magnus::exception::local_jump_error(), msg),
|
64
|
-
ItsiError::Break() => magnus::Error::new(magnus::exception::interrupt(), "Break"),
|
56
|
+
ItsiError::InvalidInput(msg) => Error::new(arg_error(), msg),
|
57
|
+
ItsiError::InternalServerError(msg) => Error::new(exception(), msg),
|
58
|
+
ItsiError::UnsupportedProtocol(msg) => Error::new(arg_error(), msg),
|
59
|
+
ItsiError::ArgumentError(msg) => Error::new(arg_error(), msg),
|
60
|
+
ItsiError::Jump(msg) => Error::new(exception::local_jump_error(), msg),
|
61
|
+
ItsiError::Break() => Error::new(exception::interrupt(), "Break"),
|
65
62
|
ItsiError::ClientConnectionClosed => {
|
66
|
-
|
63
|
+
Error::new(exception::eof_error(), CLIENT_CONNECTION_CLOSED)
|
67
64
|
}
|
68
|
-
ItsiError::Pass() =>
|
65
|
+
ItsiError::Pass() => Error::new(exception::interrupt(), "Pass"),
|
69
66
|
}
|
70
67
|
}
|
71
68
|
}
|