synapse/changelog.d
Quentin Gliech 09f0957b36
Helpers to transform Twisted requests to Rust http Requests/Responses (#17081)
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(())
}
```
2024-04-18 12:20:30 +02:00
..
.gitignore Correct attrs package name in requirements (#3492) 2018-07-07 10:46:59 +10:00
16920.bugfix Parse Integer negative value validation (#16920) 2024-04-16 19:12:36 +00:00
16943.bugfix bugfix: make msc3967 idempotent (#16943) 2024-04-15 10:57:56 +00:00
17032.misc Use receipts `event_stream_ordering` instead of joins (#17032) 2024-04-12 09:28:44 +01:00
17036.misc Fix mypy on latest Twisted release (#17036) 2024-04-11 16:03:45 +01:00
17079.misc Bump minimum required Rust version to 1.66.0 (#17079) 2024-04-17 15:44:40 +02:00
17081.misc Helpers to transform Twisted requests to Rust http Requests/Responses (#17081) 2024-04-18 12:20:30 +02:00
17086.feature Support for MSC4108 via delegation (#17086) 2024-04-17 16:47:35 +02:00
17096.misc Fix remote receipts for events we don't have (#17096) 2024-04-17 16:08:40 +01:00