leaf-potato opened a new issue, #2336:
URL: https://github.com/apache/brpc/issues/2336

   **Describe the bug (描述bug)**
   
   client在使用h2协议访问pb server时,client和server都无法正确获取到压缩类型。
   
   **To Reproduce (复现方法)**
   1. example/echo_c++/client.cpp新增代码开启gzip压缩和相关日志:
   ```c++
   ...
   request.set_message("hello world");
   cntl.set_request_compress_type(brpc::COMPRESS_TYPE_GZIP);
   ...
   if (!cntl.Failed()) {
       LOG(INFO) << "Received response from " << cntl.remote_side()
               << " to " << cntl.local_side()
               << ": " << response.message()
               << " compress_type:" << cntl.response_compress_type()
               << " protocol:" << cntl.request_protocol()
               << " (attached=" << cntl.response_attachment() << ")"
               << " latency=" << cntl.latency_us() << "us";
   }
   ```
   2. example/echo_c++/server.cpp新增代码开启gzip压缩和相关日志:
   
   ```c++
   LOG(INFO) << "Received request[log_id=" << cntl->log_id()
           << "] from " << cntl->remote_side()
           << " to " << cntl->local_side()
           << ": " << request->message()
           << " compress_type:" <<  cntl->request_compress_type()
           << " protocol:" << cntl->request_protocol()
           << " (attached=" << cntl->request_attachment() << ")";
   
   response->set_message(request->message());
   cntl->set_response_compress_type(brpc::COMPRESS_TYPE_GZIP);
   ```
   3. 启动Server:`./echo_server --http_body_compress_threshold=1`
   4. 启动Client:`./echo_client --protocol="h2" --http_body_compress_threshold=1 
--http_verbose`
   
   Client端日志:
   
![image](https://github.com/apache/brpc/assets/49188857/bc980c9e-f7b3-415f-9ccf-cec334ea6192)
   
   
   Server端日志:
   
![image](https://github.com/apache/brpc/assets/49188857/181cbda2-273c-4fff-a627-9b6594dac4ae)
   
   **Expected behavior (期望行为)**
   使用http访问pb server时也能像baidu_std协议的方式获取压缩方式。
   
   **Versions (各种版本)**
   OS: Ubuntu 22.04.2 LTS
   Compiler: gcc 11.3.0
   brpc: master
   protobuf: 3.12.4
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to