Commit
Author: mdecimus [mauro@stalw.art]
Hash: a6cd1d6cc0a79943903e8154eecc29f2de003e2a
Timestamp: Fri, 21 Jul 2023 09:58:23 +0000 (1 year ago)

+12 -0 +/-1 browse
Add helper functions to AuthenticatedMessage
1diff --git a/src/common/message.rs b/src/common/message.rs
2index b5a33c1..7575405 100644
3--- a/src/common/message.rs
4+++ b/src/common/message.rs
5 @@ -198,10 +198,22 @@ impl<'x> AuthenticatedMessage<'x> {
6 self.date_header_present
7 }
8
9+ pub fn raw_message(&self) -> &[u8] {
10+ self.raw_message
11+ }
12+
13 pub fn raw_headers(&self) -> &[u8] {
14 self.raw_message.get(..self.body_offset).unwrap_or_default()
15 }
16
17+ pub fn raw_parsed_headers(&self) -> &[(&[u8], &[u8])] {
18+ &self.headers
19+ }
20+
21+ pub fn raw_body(&self) -> &[u8] {
22+ self.raw_message.get(self.body_offset..).unwrap_or_default()
23+ }
24+
25 pub fn body_offset(&self) -> usize {
26 self.body_offset
27 }