mirror of
https://github.com/alibaba/higress.git
synced 2026-05-31 16:17:28 +08:00
Ai data masking fix (#1420)
This commit is contained in:
@@ -309,7 +309,9 @@ where
|
||||
fn on_http_request_headers(&mut self, num_headers: usize, end_of_stream: bool) -> HeaderAction {
|
||||
let binding = self.rule_matcher.borrow();
|
||||
self.config = binding.get_match_config().map(|config| config.1.clone());
|
||||
|
||||
if self.config.is_none() {
|
||||
return HeaderAction::Continue;
|
||||
}
|
||||
for (k, v) in self.get_http_request_headers_bytes() {
|
||||
match String::from_utf8(v) {
|
||||
Ok(header_value) => {
|
||||
@@ -340,6 +342,9 @@ where
|
||||
}
|
||||
|
||||
fn on_http_request_body(&mut self, body_size: usize, end_of_stream: bool) -> DataAction {
|
||||
if self.config.is_none() {
|
||||
return DataAction::Continue;
|
||||
}
|
||||
if !self.http_content.borrow().cache_request_body() {
|
||||
return self
|
||||
.http_content
|
||||
@@ -362,6 +367,9 @@ where
|
||||
}
|
||||
|
||||
fn on_http_request_trailers(&mut self, num_trailers: usize) -> Action {
|
||||
if self.config.is_none() {
|
||||
return Action::Continue;
|
||||
}
|
||||
self.http_content
|
||||
.borrow_mut()
|
||||
.on_http_request_trailers(num_trailers)
|
||||
@@ -372,6 +380,9 @@ where
|
||||
num_headers: usize,
|
||||
end_of_stream: bool,
|
||||
) -> HeaderAction {
|
||||
if self.config.is_none() {
|
||||
return HeaderAction::Continue;
|
||||
}
|
||||
for (k, v) in self.get_http_response_headers_bytes() {
|
||||
match String::from_utf8(v) {
|
||||
Ok(header_value) => {
|
||||
@@ -399,6 +410,9 @@ where
|
||||
}
|
||||
|
||||
fn on_http_response_body(&mut self, body_size: usize, end_of_stream: bool) -> DataAction {
|
||||
if self.config.is_none() {
|
||||
return DataAction::Continue;
|
||||
}
|
||||
if !self.http_content.borrow().cache_response_body() {
|
||||
return self
|
||||
.http_content
|
||||
@@ -423,6 +437,9 @@ where
|
||||
}
|
||||
|
||||
fn on_http_response_trailers(&mut self, num_trailers: usize) -> Action {
|
||||
if self.config.is_none() {
|
||||
return Action::Continue;
|
||||
}
|
||||
self.http_content
|
||||
.borrow_mut()
|
||||
.on_http_response_trailers(num_trailers)
|
||||
|
||||
@@ -68,7 +68,7 @@ pub fn has_request_body() -> bool {
|
||||
content_type, content_length_str, transfer_encoding
|
||||
)
|
||||
).unwrap();
|
||||
if !content_type.is_some_and(|x| !x.is_empty()) {
|
||||
if content_type.is_some_and(|x| !x.is_empty()) {
|
||||
return true;
|
||||
}
|
||||
if let Some(cl) = content_length_str {
|
||||
|
||||
Reference in New Issue
Block a user