pub struct Transaction { /* private fields */ }Expand description
A ModSecurity transaction for processing a single request.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new(ruleset: Arc<CompiledRuleset>, default_status: u16) -> Self
pub fn new(ruleset: Arc<CompiledRuleset>, default_status: u16) -> Self
Create a new transaction.
Sourcepub fn process_uri(
&mut self,
uri: &str,
method: &str,
protocol: &str,
) -> Result<()>
pub fn process_uri( &mut self, uri: &str, method: &str, protocol: &str, ) -> Result<()>
Process the request URI.
Sourcepub fn add_request_header(&mut self, name: &str, value: &str) -> Result<()>
pub fn add_request_header(&mut self, name: &str, value: &str) -> Result<()>
Add a request header.
Sourcepub fn process_request_headers(&mut self) -> Result<()>
pub fn process_request_headers(&mut self) -> Result<()>
Process request headers (Phase 1).
Sourcepub fn append_request_body(&mut self, data: &[u8]) -> Result<()>
pub fn append_request_body(&mut self, data: &[u8]) -> Result<()>
Append data to request body.
Sourcepub fn process_request_body(&mut self) -> Result<()>
pub fn process_request_body(&mut self) -> Result<()>
Process request body (Phase 2).
Sourcepub fn add_response_header(&mut self, name: &str, value: &str) -> Result<()>
pub fn add_response_header(&mut self, name: &str, value: &str) -> Result<()>
Add a response header.
Sourcepub fn process_response_headers(&mut self) -> Result<()>
pub fn process_response_headers(&mut self) -> Result<()>
Process response headers (Phase 3).
Sourcepub fn append_response_body(&mut self, data: &[u8]) -> Result<()>
pub fn append_response_body(&mut self, data: &[u8]) -> Result<()>
Append data to response body.
Sourcepub fn process_response_body(&mut self) -> Result<()>
pub fn process_response_body(&mut self) -> Result<()>
Process response body (Phase 4).
Sourcepub fn process_logging(&mut self) -> Result<()>
pub fn process_logging(&mut self) -> Result<()>
Process logging phase (Phase 5).
Sourcepub fn intervention(&self) -> Option<&Intervention>
pub fn intervention(&self) -> Option<&Intervention>
Get current intervention (if any).
Sourcepub fn has_intervention(&self) -> bool
pub fn has_intervention(&self) -> bool
Check if there’s an intervention.
Sourcepub fn matched_rules(&self) -> &[String]
pub fn matched_rules(&self) -> &[String]
Get matched rule IDs.
Sourcepub fn anomaly_score(&self) -> i32
pub fn anomaly_score(&self) -> i32
Get the anomaly score.
Sourcepub fn tx(&self) -> &TxCollection
pub fn tx(&self) -> &TxCollection
Get the TX collection.
Sourcepub fn tx_mut(&mut self) -> &mut TxCollection
pub fn tx_mut(&mut self) -> &mut TxCollection
Get mutable TX collection.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Transaction
impl !RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl !UnwindSafe for Transaction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more