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 2021/08/05 14:54:05 UTC
[GitHub] [incubator-brpc] guodongxiaren commented on a change in pull request #1506: check is printable character in uri
guodongxiaren commented on a change in pull request #1506:
URL: https://github.com/apache/incubator-brpc/pull/1506#discussion_r683531341
##########
File path: src/brpc/uri.cpp
##########
@@ -98,6 +102,20 @@ inline const char* SplitHostAndPort(const char* host_begin,
return host_end;
}
+// valid characters in URL
+// https://datatracker.ietf.org/doc/html/rfc3986#section-2.1
+// https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
+// https://datatracker.ietf.org/doc/html/rfc3986#section-2.4
+static bool is_valid_char(const char* p) {
+ static const std::unordered_set<char> other_valid_char = {
+ ':', '/', '?', '#', '[', ']', '@', '!', '$', '&',
+ '\'', '(', ')'/ '*', '+', ',', ';', '='/ '-', '.',
Review comment:
已有的单测,应该就够了吧。我看写的挺全的。
https://github.com/apache/incubator-brpc/blob/master/test/brpc_uri_unittest.cpp
我的修改只要能跑过这些例子就ok。当然也可以补一个非法的字符来check一下,让SetHttpURL失败。或者是其他case(暂时没想到别的case),看owner们是否需要吧。
--
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