如果我的网址中包含./或../或... /怎么办?

假设我们有如下所示的Urls

  1. complete guide with examples
  2. http://localhost:8080/sample/url/./something?queryparam=something
  3. http://localhost:8080/sample/url/../something?queryparam=something

这些是有效网址,可以获取一些响应。 但是只有第三个网址正确被命中,命中后的前两个被更改为

http://localhost:8080/sample/url/.../something?queryparam=something(已删除“ ./”)

http://localhost:8080/sample/url/something?queryparam=something(已删除“ ../”)

但适用于第三个网址。

这种转义是怎么发生的?

congliangfa 回答:如果我的网址中包含./或../或... /怎么办?

第二个应该实际评估为:

http://localhost:8080/sample/something?queryparam=something

您在这里看到的是相对分辨率的结果,尤其是https://www.greenbytes.de/tech/webdav/rfc3986.html#relative-dot-segments

如果要使用文字“。”。或URI中的“ ..”,则必须对它们进行百分比转义。

本文链接:https://www.f2er.com/3154560.html

大家都在问