mirror of
https://github.com/lennart-k/rustical.git
synced 2026-01-30 20:08:19 +00:00
Compare commits
3 Commits
feat/ical-
...
v0.12.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99287f85f4 | ||
|
|
df3143cd4c | ||
|
|
92a3418f8e |
24
Cargo.lock
generated
24
Cargo.lock
generated
@@ -3317,7 +3317,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical"
|
name = "rustical"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"argon2",
|
"argon2",
|
||||||
@@ -3364,7 +3364,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_caldav"
|
name = "rustical_caldav"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -3406,7 +3406,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_carddav"
|
name = "rustical_carddav"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -3440,7 +3440,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_dav"
|
name = "rustical_dav"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -3466,7 +3466,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_dav_push"
|
name = "rustical_dav_push"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -3491,7 +3491,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_frontend"
|
name = "rustical_frontend"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"askama",
|
"askama",
|
||||||
"askama_web",
|
"askama_web",
|
||||||
@@ -3527,7 +3527,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_ical"
|
name = "rustical_ical"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -3546,7 +3546,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_oidc"
|
name = "rustical_oidc"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum",
|
"axum",
|
||||||
@@ -3562,7 +3562,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_store"
|
name = "rustical_store"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -3595,7 +3595,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_store_sqlite"
|
name = "rustical_store_sqlite"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -3620,7 +3620,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustical_xml"
|
name = "rustical_xml"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
"thiserror 2.0.18",
|
"thiserror 2.0.18",
|
||||||
@@ -5442,7 +5442,7 @@ checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xml_derive"
|
name = "xml_derive"
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling 0.23.0",
|
"darling 0.23.0",
|
||||||
"heck",
|
"heck",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
members = ["crates/*"]
|
members = ["crates/*"]
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.11.17"
|
version = "0.12.0"
|
||||||
rust-version = "1.92"
|
rust-version = "1.92"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "A CalDAV server"
|
description = "A CalDAV server"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ impl IntoResponse for Precondition {
|
|||||||
if let Err(err) = error.serialize_root(&mut writer) {
|
if let Err(err) = error.serialize_root(&mut writer) {
|
||||||
return rustical_dav::Error::from(err).into_response();
|
return rustical_dav::Error::from(err).into_response();
|
||||||
}
|
}
|
||||||
let mut res = Response::builder().status(StatusCode::PRECONDITION_FAILED);
|
let mut res = Response::builder().status(StatusCode::FORBIDDEN);
|
||||||
res.headers_mut().unwrap().typed_insert(ContentType::xml());
|
res.headers_mut().unwrap().typed_insert(ContentType::xml());
|
||||||
res.body(Body::from(output)).unwrap()
|
res.body(Body::from(output)).unwrap()
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,10 @@ impl Error {
|
|||||||
Self::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
Self::XmlDecodeError(_) => StatusCode::BAD_REQUEST,
|
||||||
Self::ChronoParseError(_) | Self::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
Self::ChronoParseError(_) | Self::NotImplemented => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
Self::NotFound => StatusCode::NOT_FOUND,
|
Self::NotFound => StatusCode::NOT_FOUND,
|
||||||
Self::PreconditionFailed(_err) => StatusCode::PRECONDITION_FAILED,
|
// The correct status code for a failed precondition is not PreconditionFailed but
|
||||||
|
// Forbidden (or Conflict):
|
||||||
|
// https://datatracker.ietf.org/doc/html/rfc4791#section-1.3
|
||||||
|
Self::PreconditionFailed(_err) => StatusCode::FORBIDDEN,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,10 +85,7 @@ impl IntoResponse for Error {
|
|||||||
if let Self::PreconditionFailed(precondition) = self {
|
if let Self::PreconditionFailed(precondition) = self {
|
||||||
return precondition.into_response();
|
return precondition.into_response();
|
||||||
}
|
}
|
||||||
if matches!(
|
if matches!(self.status_code(), StatusCode::INTERNAL_SERVER_ERROR) {
|
||||||
self.status_code(),
|
|
||||||
StatusCode::INTERNAL_SERVER_ERROR | StatusCode::PRECONDITION_FAILED
|
|
||||||
) {
|
|
||||||
error!("{self}");
|
error!("{self}");
|
||||||
}
|
}
|
||||||
(self.status_code(), self.to_string()).into_response()
|
(self.status_code(), self.to_string()).into_response()
|
||||||
|
|||||||
@@ -51,19 +51,18 @@ impl Error {
|
|||||||
_ => StatusCode::BAD_REQUEST,
|
_ => StatusCode::BAD_REQUEST,
|
||||||
},
|
},
|
||||||
Self::PropReadOnly => StatusCode::CONFLICT,
|
Self::PropReadOnly => StatusCode::CONFLICT,
|
||||||
Self::PreconditionFailed => StatusCode::PRECONDITION_FAILED,
|
|
||||||
Self::InternalError | Self::IOError(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
Self::InternalError | Self::IOError(_) => StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
Self::Forbidden => StatusCode::FORBIDDEN,
|
// The correct status code for a failed precondition is not PreconditionFailed but
|
||||||
|
// Forbidden (or Conflict):
|
||||||
|
// https://datatracker.ietf.org/doc/html/rfc4791#section-1.3
|
||||||
|
Self::PreconditionFailed | Self::Forbidden => StatusCode::FORBIDDEN,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl axum::response::IntoResponse for Error {
|
impl axum::response::IntoResponse for Error {
|
||||||
fn into_response(self) -> axum::response::Response {
|
fn into_response(self) -> axum::response::Response {
|
||||||
if matches!(
|
if matches!(self.status_code(), StatusCode::INTERNAL_SERVER_ERROR) {
|
||||||
self.status_code(),
|
|
||||||
StatusCode::INTERNAL_SERVER_ERROR | StatusCode::PRECONDITION_FAILED
|
|
||||||
) {
|
|
||||||
error!("{self}");
|
error!("{self}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,7 @@ impl IntoResponse for Error {
|
|||||||
fn into_response(self) -> axum::response::Response {
|
fn into_response(self) -> axum::response::Response {
|
||||||
if matches!(
|
if matches!(
|
||||||
self.status_code(),
|
self.status_code(),
|
||||||
StatusCode::INTERNAL_SERVER_ERROR
|
StatusCode::INTERNAL_SERVER_ERROR | StatusCode::CONFLICT
|
||||||
| StatusCode::PRECONDITION_FAILED
|
|
||||||
| StatusCode::CONFLICT
|
|
||||||
) {
|
) {
|
||||||
error!("{self}");
|
error!("{self}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ END:VCALENDAR";
|
|||||||
.typed_insert(Authorization::basic("user", "pass"));
|
.typed_insert(Authorization::basic("user", "pass"));
|
||||||
|
|
||||||
let response = app.clone().oneshot(request).await.unwrap();
|
let response = app.clone().oneshot(request).await.unwrap();
|
||||||
assert_eq!(response.status(), StatusCode::PRECONDITION_FAILED);
|
assert_eq!(response.status(), StatusCode::FORBIDDEN);
|
||||||
let body = response.extract_string().await;
|
let body = response.extract_string().await;
|
||||||
insta::assert_snapshot!(body, @r#"
|
insta::assert_snapshot!(body, @r#"
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|||||||
Reference in New Issue
Block a user