Skip to content

Commit 9afe4bb

Browse files
authored
Feat: check for matching proto message before fallbacks (mitmproxy#275)
1 parent 813e3ca commit 9afe4bb

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mitmproxy-contentviews/src/protobuf/existing_proto_definitions.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ fn find_best_message(
7878
rpc.method
7979
);
8080
}
81+
for method in file.messages() {
82+
if method.proto().name() != rpc.method {
83+
continue;
84+
}
85+
return Some(method);
86+
}
8187
}
8288
log::info!("Did not find {rpc} in protobuf definitions.");
8389
}
@@ -144,7 +150,10 @@ impl std::fmt::Display for RpcInfo {
144150
if !self.package.is_empty() {
145151
write!(f, "{}.", self.package)?;
146152
}
147-
write!(f, "{}.{}", self.service, self.method)
153+
if !self.service.is_empty() {
154+
write!(f, "{}.", self.service)?;
155+
}
156+
write!(f, "{}", self.method)
148157
}
149158
}
150159

0 commit comments

Comments
 (0)