mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Add error checking to ViewProtobuf
There are protobufs that protoc can't parse. When protoc --decode_raw fails, it returns nothing to stdin, and writes "Failed to parse input." to stderr. Before this commit, if protoc --decode_raw couldn't parse the protobuf, the blank stdout output would get returned to the view; with this commit stderr gets caught and returned to the view.
This commit is contained in:
parent
61c794e08f
commit
f78dada550
@ -389,8 +389,11 @@ class ViewProtobuf:
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, _ = p.communicate(input=content)
|
||||
return out
|
||||
out, err = p.communicate(input=content)
|
||||
if out:
|
||||
return out
|
||||
else:
|
||||
return err
|
||||
|
||||
def __call__(self, hdrs, content, limit):
|
||||
decoded = self.decode_protobuf(content)
|
||||
|
Loading…
Reference in New Issue
Block a user