ithewei / ithewei/libhv

路由的占位符解析和查询参数的解析覆盖问题

Open
#573 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
7.6k
Forks
1.4k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

router.cpp示例中:
https://github.com/ithewei/libhv/blob/0325f2d07f10986139174ff2db75dd151c09b605/examples/httpd/router.cpp#L131-L134

这里路由占位符的解析是在Handler::restful中调用了HttpContext的param,即HttpRequest的GetParam:
https://github.com/ithewei/libhv/blob/0325f2d07f10986139174ff2db75dd151c09b605/examples/httpd/handler.cpp#L171-L179

这个方法是查询参数的解析,这样合在一起会导致这里占位符的解析覆盖了查询参数的解析,如对于/api/test/{str},会导致 GET http://ip:port/api/test/xxx?str=yyy 后,服务器获取查询参数param("str")时,xxx会覆盖yyy

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.