URI 中包含空格字符会影响性能吗?
我知道现代浏览器将允许 URI 中包含空格,并且我想可能会进行一些原本可能不存在的编码/解码。
URI 中包含空格是否会对性能产生任何重大影响?
I know that modern browsers will allow URIs with spaces in them, and I imagine that there's some encoding/decoding going on that might not be there otherwise.
Are there any material performance impacts that can be attributed to having spaces in a URI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,浏览器会将空格转换为%20,因此服务器不会注意到。事实上,在 Firefox 中,如果您从地址栏中复制包含空格的 URL,它将被转换为 %20。
另外,我认为这不值得追求。衡量性能影响确实很困难,而且无论如何它似乎只是负载的一小部分。
此外,负载将位于 PC 上,而不是服务器上。
我(作为编写代码或链接的程序员)会输入 %20,因为它更安全(不太可能失败)并且更接近实际发生的情况。
As far as I know, browsers convert space to %20 so the server will not notice. In fact, in Firefox if you copy a URL that has spaces from the address bar it will be converted to %20.
Also, I think this is not worth pursuing. It would be really hard to measure the performance impact and it seems to be a really tiny part of the load anyway.
Also, the load would be on the PCs,,, not on your servers.
I (as a programmer writing code or links) would type %20 because it is safer (less likely to fail) and closer to what actually happens.