-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http url中含有‘#’的处理问题 #440
Comments
|
名字诡异确实是一方面,但是uri编解码也是必要的 |
This problem was solved by XiaoMi/rdsn#357, reopen it when there is futher issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在http请求中,'#'之后的部分叫做锚部分,该部分代表网页中的一个位置,用于浏览器读取这个url后,自动滚动到锚部分指定的区域。
由于锚部分是用来指导浏览器动作的,对服务器完全无用,所以HTTP请求中不会包含锚部分,也就是说,会将其截断、不发送给服务器。
目前我们有一个http接口,用于获取perf counter信息,例如:
http://127.0.0.1:34101/perfCounter?name=collector*app.pegasus*app.stat.read_qps#_all_
用于获取名字为collector*app.pegasus*app.stat.read_qps#_all_
的perf counter信息,但是由于该名字中包含了‘#’,所以会将#_all_这部分截断,服务器获取到的请求就变成了http://127.0.0.1:34101/perfCounter?name=collector*app.pegasus*app.stat.read_qps
,导致无法获取正确的perf counter信息。目前我想到的办法是:
1.对用户端发出的请求和服务端收到的请求添加编解码,对这种特殊字符进行转义。
2.实现http_message_parser中对header部分的解析,将name={perf_counter_name}放到header部分中
1是比较常规的做法,业内对于传递特殊字符都需要编解码。2这里感觉也比较有必要,因为目前我们的http实现不健全,对于header和body部分都没有实现读取
The text was updated successfully, but these errors were encountered: