- Apr 18, 2024
-
-
Quentin Gliech authored
This adds functions to transform a Twisted request to the `http::Request`, and then to send back an `http::Response` through it. It also imports the SynapseError exception so that we can throw that from Rust code directly Example usage of this would be: ```rust use crate::http::{http_request_from_twisted, http_response_to_twisted, HeaderMapPyExt}; fn handler(twisted_request: &PyAny) -> PyResult<()> { let request = http_request_from_twisted(twisted_request)?; let ua: headers::UserAgent = request.headers().typed_get_required()?; if whatever { return Err((crate::errors::SynapseError::new( StatusCode::UNAUTHORIZED, "Whatever".to_owned "M_UNAUTHORIZED", None, None, ))); } let response = Response::new("hello".as_bytes()); http_response_to_twisted(twisted_request, response)?; Ok(()) } ```
-
- Jan 08, 2024
-
-
Erik Johnston authored
There are a couple of things we need to be careful of here: 1. The current python code does no validation when loading from the DB, so we need to be careful to ignore such errors (at least on jki.re there are some old events with internal metadata fields of the wrong type). 2. We want to be memory efficient, as we often have many hundreds of thousands of events in the cache at a time. --------- Co-authored-by:
Quentin Gliech <quenting@element.io>
-
- Sep 26, 2023
-
-
Patrick Cloke authored
* Pre-compiles the server ACLs onto an object per room and invalidates them when new events come in. * Converts the server ACL checking into Rust.
-
- Feb 03, 2023
-
-
Patrick Cloke authored
Since pyo3-log is initialized very early in the Python start-up it caches the state of the loggers before they're fully initialized (and thus are essentially disabled). Whenever we reload the logging configuration we now also tell pyo3-log to discard any cached logging configuration it has; it will refetch the current logging configuration from Python at the next point it logs. This fixes Rust log lines not appearing in the homeserver logs.
-
- Sep 20, 2022
-
-
Erik Johnston authored
-
- Sep 12, 2022
-
-
Erik Johnston authored
This protects against the common mistake of failing to remember to rebuild Rust code after making changes.
-
- Sep 09, 2022
-
-
Erik Johnston authored
-
- Sep 06, 2022
-
-
Erik Johnston authored
-