Closed TENX-S closed 2 years ago
So this error usually happens when the incoming frames don't match what hyper expects. This could be due to you sending h1 when it really expects h2. If you're using the transport feature and Server by default it will have http2_only
on by default. This could be the cause of the failure of reading the frame.
I've been debugging it for a while. It seems like the Err is returned here:
it will jump to:
and we got the "invalid compression flag" here:
It seems like the error arises when tonic try to fetch the trailers and clear the body. But it's not the correct body?
I've captured the packet by using the default client and server. And found that the packet is exactly the same as the previous one, except the date of header. So, I guess there's a problem with my decoder?
I made it, but I don't know why: just change my decoder to:
fn decode(&mut self, src: &mut DecodeBuf<'_>) -> Result<Option<Self::Item>, Self::Error> {
let buf = src.chunk();
let length = buf.len();
let resp = get_hello_response(buf);
src.advance(length);
Ok(Some(resp))
}
and it works!
env: tonic v0.7.2 tonic-build v0.7.2
macOS 12.4
Hi, I'm trying to make a tool like bloomRPC. And I prefer to implement the core API with rust. Here is my attempt. Start the server first, then the client. And I get:
This error is confusing. I use Wireshark to get the packet and the compression flag is not corrupted: