aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorleonidlazarev <leonidlazarev@yandex-team.com>2023-05-24 18:23:04 +0300
committerleonidlazarev <leonidlazarev@yandex-team.com>2023-05-24 18:23:04 +0300
commit170691c8d5cb2744c15d7d89495eaca1c24be10a (patch)
tree2c58b86a20909594e9b7a82e08667ac08db461e9 /library
parent16415b2fe8d3df86cddba4304086b6b5f5974eea (diff)
downloadydb-170691c8d5cb2744c15d7d89495eaca1c24be10a.tar.gz
feat grpc: decode URL-encoded peer address in grpc library
Diffstat (limited to 'library')
-rw-r--r--library/cpp/grpc/server/grpc_async_ctx_base.h7
-rw-r--r--library/cpp/grpc/server/grpc_request.h6
2 files changed, 11 insertions, 2 deletions
diff --git a/library/cpp/grpc/server/grpc_async_ctx_base.h b/library/cpp/grpc/server/grpc_async_ctx_base.h
index 7b88c072fa..d2461b8b0d 100644
--- a/library/cpp/grpc/server/grpc_async_ctx_base.h
+++ b/library/cpp/grpc/server/grpc_async_ctx_base.h
@@ -2,6 +2,8 @@
#include "grpc_server.h"
+#include <library/cpp/string_utils/quote/quote.h>
+
#include <util/generic/vector.h>
#include <util/generic/string.h>
#include <util/system/yassert.h>
@@ -24,7 +26,10 @@ public:
}
TString GetPeerName() const {
- return Context.peer();
+ // Decode URL-encoded square brackets
+ auto ip = Context.peer();
+ CGIUnescape(ip);
+ return ip;
}
TInstant Deadline() const {
diff --git a/library/cpp/grpc/server/grpc_request.h b/library/cpp/grpc/server/grpc_request.h
index 4e869ef5f6..d9871f801d 100644
--- a/library/cpp/grpc/server/grpc_request.h
+++ b/library/cpp/grpc/server/grpc_request.h
@@ -6,6 +6,7 @@
#include <library/cpp/monlib/dynamic_counters/counters.h>
#include <library/cpp/logger/priority.h>
+#include <library/cpp/string_utils/quote/quote.h>
#include "grpc_response.h"
#include "event_callback.h"
@@ -118,7 +119,10 @@ public:
}
TString GetPeer() const override {
- return TString(this->Context.peer());
+ // Decode URL-encoded square brackets
+ auto ip = TString(this->Context.peer());
+ CGIUnescape(ip);
+ return ip;
}
bool SslServer() const override {