Paragrf commented on code in PR #3002: URL: https://github.com/apache/brpc/pull/3002#discussion_r2176288042
########## src/brpc/policy/http_rpc_protocol.cpp: ########## @@ -1331,7 +1331,26 @@ ParseResult ParseHttpMessage(butil::IOBuf *source, Socket *socket, } } -static void SendUnauthorizedResponse(const std::string& user_error_text, Socket* socket) { +static void SendUnauthorizedResponse(const std::string& user_error_text, Socket* socket, const InputMessageBase* msg) { + HttpContext* http_request = (HttpContext*)msg; + const bool is_http2 = http_request->header().is_http2(); + if (is_http2) { + // for grpc client + const H2StreamContext* h2_sctx = static_cast<const H2StreamContext*>(msg); + brpc::Controller* cntl = new brpc::Controller(); Review Comment: @chenBright A cntl object is indeed needed to set the error code and message for authentication failures. Are you suggesting that we should avoid using a pointer here, and instead simply declare it as "Controller cntl = Controller()";, thereby also eliminating the need to call "delete cntl" -- 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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org