guodongxiaren opened a new pull request #1506:
URL: https://github.com/apache/incubator-brpc/pull/1506


   这个PR的目的检查url中是否有不可打印字符。
   
   可打印字符的维基百科:
   https://en.wikipedia.org/wiki/ASCII#Printable_characters
   
   之前遇到过一个问题,在调用一个HTTP 
API接口的时候,要加一个签名字段作为query参数。用openssl计算签名的时候,最后意外多复制了一位,这一位是不可打印的字符。
   让后请求接口一直失败,日志打印URL查看也没有问题,因为是不可打印字符,所以无法输出,其实是多了一个隐藏字符。
   导致调试了很长时间。
   
   
   
   
当然可打印的字符中也不是全部都是URL的合法字符,但是其他的非法字符,只要是可打印的都可以很快定位到问题,因此不做考虑。因为判断合法字符的比较繁琐(也容易错漏,引发不必要问题),以下这些都是合法字符:
   
   `A-Z`, `a-z`, `0-9`, `-`, `.`, `_`, `~`, `:`, `/`, `?`, `#`, `[`, `]`, `@`, 
`!`, `$`, `&`, `'`, `(`, `)`, `*`, `+`, `,`, `;`, `%`, `=`
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to