Skip to content

修复 hv_parse_url 处理 '#' 和 '?' 顺序优先级 bug #719

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

House-Men
Copy link
Contributor

解决类似“/xxx/xxx.htm#xxx?xxxx”的顺序导致解析结果有错误。

@ithewei
Copy link
Owner

ithewei commented Apr 16, 2025

根据 RFC 3986 标准定义,URI 的通用语法结构为:

scheme:[//authority]path[?query][#fragment]

(方括号表示可选,但顺序不可调换)

@House-Men
Copy link
Contributor Author

House-Men commented Apr 16, 2025

根据 RFC 3986 标准定义,URI 的通用语法结构为:

scheme:[//authority]path[?query][#fragment]

(方括号表示可选,但顺序不可调换)

标准格式顺序确实是这样,但是#字符的出现代表后面可以是任意剩余字符,其中就可以出现?,而且代码 http/HttpMessage.cpp 中对 HttpRequest::Path() 的处理也是有?与#做了优先级处理的,经过主流浏览器地址栏与开发者工具观察请求报文也是可以证实确实存在优先级处理,#如果比?优先出现那么后面都属于fragment而不会识别成path=/xxx/xxx.htm#xxx,query=xxxx,fragment=空

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants