You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2019/11/06 03:50:10 UTC

[GitHub] [incubator-apisix] spacewander commented on a change in pull request #809: fix: core.utils.parse_addr didn't parse IPv6 address correctly

spacewander commented on a change in pull request #809: fix: core.utils.parse_addr didn't parse IPv6 address correctly
URL: https://github.com/apache/incubator-apisix/pull/809#discussion_r342906458
 
 

 ##########
 File path: lua/apisix/core/utils.lua
 ##########
 @@ -83,12 +83,28 @@ function _M.dns_parse(resolvers, domain)
 end
 
 
+local function rfind_char(s, ch, idx)
 
 Review comment:
   The `rfind_char` (reverse find a char) is critical for the correctness when handling the IPv6 address, because the IPv6 address itself might contains one or many colons.
   As for performance, look up single character one by one when the port part is small might be as fast as a `memchr` call, which is used by LuaJIT under the hook.
   The glibc's `memchr` implementation, https://repo.or.cz/glibc.git/blob/HEAD:/string/memchr.c#l67, does the same thing when the len(s) is small.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services