This is an automated email from the ASF dual-hosted git repository.
wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 8f4dd639 Set http default method to "/" (#2168)
8f4dd639 is described below
commit 8f4dd6396b609b3c07fcd17645b4b87f989fbf36
Author: Bright Chen <[email protected]>
AuthorDate: Wed Apr 26 15:44:49 2023 +0800
Set http default method to "/" (#2168)
---
src/brpc/policy/http_rpc_protocol.cpp | 4 +++-
src/brpc/policy/http_rpc_protocol.h | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/brpc/policy/http_rpc_protocol.cpp
b/src/brpc/policy/http_rpc_protocol.cpp
index 6927e377..bd880960 100644
--- a/src/brpc/policy/http_rpc_protocol.cpp
+++ b/src/brpc/policy/http_rpc_protocol.cpp
@@ -151,6 +151,7 @@ CommonStrings::CommonStrings()
, GRPC_STATUS("grpc-status")
, GRPC_MESSAGE("grpc-message")
, GRPC_TIMEOUT("grpc-timeout")
+ , DEFAULT_PATH("/")
{}
static CommonStrings* common = NULL;
@@ -1596,7 +1597,8 @@ bool ParseHttpServerAddress(butil::EndPoint* point, const
char* server_addr_and_
const std::string& GetHttpMethodName(
const google::protobuf::MethodDescriptor*,
const Controller* cntl) {
- return cntl->http_request().uri().path();
+ const std::string& path = cntl->http_request().uri().path();
+ return !path.empty() ? path : common->DEFAULT_PATH;
}
} // namespace policy
diff --git a/src/brpc/policy/http_rpc_protocol.h
b/src/brpc/policy/http_rpc_protocol.h
index 4dce6037..91acae77 100644
--- a/src/brpc/policy/http_rpc_protocol.h
+++ b/src/brpc/policy/http_rpc_protocol.h
@@ -75,6 +75,8 @@ struct CommonStrings {
std::string GRPC_MESSAGE;
std::string GRPC_TIMEOUT;
+ std::string DEFAULT_PATH;
+
CommonStrings();
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]