You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/02/07 08:26:05 UTC

[GitHub] [incubator-brpc] wwbmmm commented on a change in pull request #1690: Support parse proto-text format http request body

wwbmmm commented on a change in pull request #1690:
URL: https://github.com/apache/incubator-brpc/pull/1690#discussion_r800405494



##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -513,6 +522,12 @@ void SerializeHttpRequest(butil::IOBuf* /*not used*/,
                 return cntl->SetFailed(EREQUEST, "Fail to serialize %s",
                                        pbreq->GetTypeName().c_str());
             }
+        } else if (content_type == HTTP_CONTENT_PROTO_TEXT) {
+            if (!google::protobuf::TextFormat::Print(*pbreq, &wrapper)) {
+                cntl->request_attachment().clear();
+                return cntl->SetFailed(EREQUEST, "Fail to print %s",

Review comment:
       Fail to print %s as proto-text

##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -1470,6 +1489,12 @@ void ProcessHttpRequest(InputMessageBase *msg) {
                                     req->GetDescriptor()->full_name().c_str());
                     return;
                 }
+            } else if (content_type == HTTP_CONTENT_PROTO_TEXT) {
+                if (!ParsePbTextFromIOBuf(req, req_body)) {
+                    cntl->SetFailed(EREQUEST, "Fail to parse http body as %s",

Review comment:
       Fail to parse http proto-text body as %s

##########
File path: src/brpc/policy/http_rpc_protocol.cpp
##########
@@ -757,6 +772,10 @@ HttpResponseSender::~HttpResponseSender() {
             if (!res->SerializeToZeroCopyStream(&wrapper)) {
                 cntl->SetFailed(ERESPONSE, "Fail to serialize %s", res->GetTypeName().c_str());
             }
+        } else if (content_type == HTTP_CONTENT_PROTO_TEXT) {
+            if (!google::protobuf::TextFormat::Print(*res, &wrapper)) {
+                cntl->SetFailed(ERESPONSE, "Fail to print %s", res->GetTypeName().c_str());

Review comment:
       Fail to print %s as proto-text




-- 
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-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org