URL路径中的段应该是一个安全的最大长度是多少? [英] What is a safe maximum length a segment in a URL path should be?

查看:163
本文介绍了URL路径中的段应该是一个安全的最大长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多人都在问网址的最大长度是多少?但据我所知,没有人问这个问题:

A lot of people are asking "What is the maximum length a URL can be?" but as far as I can see nobody is asking the question:


URL路径中的一个段应该是一个安全的最大长度是什么?

What is a safe maximum length a segment in a URL path should be?

我认为这个问题同样重要。

I think this question is equally as important.

这个问题是一个一般性问题,旨在尽可能多地支持开箱即用的系统。

This question is a general question aimed at supporting as many systems out of the box as possible.

在C#中,您可以从传入请求中获取URL路径段列表,并安装安全模块,该路径段被视为URL路径中段的最大长度适用于这种情况?

In C#, you can get a list of URL path segments from an incoming request, with security modules installed what is considered the maximum length a segment in a URL path can be for this scenario?

我在下一页上看到,超过260个字符的URL路径段可能会导致自定义ASP.NET模块出现问题:

I've read on the following page that URL path segments over 260 characters can cause problems in custom ASP.NET modules:

  • http://www.paraesthesia.com/archive/2011/08/26/long-url-path-segments-in-asp-net-routing-yield-400.aspx/

在网络浏览器中,无论您访问哪个网站,都键入URL段, / 是一个URL路径段,通常映射到主页。使用Internet Explorer,Chrome和Firefox是受欢迎的浏览器,它们支持的URL路径段长度的最大长度是多少?

In web browsers, you type URL segments regardless of what website you visit, / is a URL path segment which is usually mapped to a homepage. With Internet Explorer, Chrome and Firefox being popular browsers, what is the maximum length of a URL path segment length they support?

我可以从以下资源中看到最大值不同浏览器的URL路径长度不同,数字有时非常高:

I can see from the following resource that the maximum length of a URL path differs for different browsers and the figure is sometimes quite high:

  • What is apache's maximum url length?

但这是一个路径而不是路径段。

But this is a path and not a path segment.

我也知道在重写路径时,底层文件系统路径长度起作用了,我可以看到支持的球场图在* nix OS中大约255个字符。

I'm also aware that when rewriting paths, the underlying file system path length comes into play, and the ball park figure of what I can see supported is around 255 characters in a *nix OS.

其他注意事项包括数据库表中URL路径段的最大长度。例如,在MySQL中,varchar列最多可以包含255个字符,但是有这种情况,人们是在MySQL中的表中存储路径段还是在varchar列中存储完整URL的人?对于URL路径段,这可能意味着255个字符太长了吗?

Other considerations include the maximum length of a URL path segment in a database table. For instance, in MySQL a varchar column can contain up to 255 characters, but is there a case for this, are people storing segments of paths in tables in MySQL or are people storing full URL's in varchar columns? Could this mean 255 characters is too long for a URL path segment?

是否有任何关于URL路径段的W3C规范,因为我无法发现任何内容?

Is there any W3C specification on how long a URL path segment can be as I can't spot anything?

我确实在URI上阅读了W3C规范,但我再次没有发现任何使用:

I did read the W3C specification on URI's but again I didn't spot anything of use:

  • http://www.ietf.org/rfc/rfc2396.txt

我很困惑,URL路径段的长度没有设定标准,所以也许我错过了什么?

I'm quite baffled that there is no set standard on what a length a URL path segment should be, so maybe I am missing something?

我真的在寻找尽可能多的不同系统支持的信息,以及URL路径段的安全长度。

I'm really looking for as much information as possible on what different systems support, and what is considered a safe length for a URL path segment.

推荐答案

可能与不同浏览器中URL的最大长度是多少?

根据HTTP规范,URL的长度没有限制。保持您的网址不超过2048个字符;这将确保URL适用于所有客户端&服务器配置。此外,像URL一样的搜索引擎仍然保持在大约2000个字符之下。

According to the HTTP spec, there is no limit to a URL's length. Keep your URLs under 2048 characters; this will ensure the URLs work in all clients & server configurations. Also, search engines like URLs to remain under approximately 2000 characters.

Chrome对URL有2MB限制,IE8和9限制为2084个字符。因此,所有内容都将您的网址限制在约。 2000个字符。

Chrome has a 2MB limit for URLs, IE8 and 9 have a 2084 character limit. So everything points in keeping your URLs limited to approx. 2000 characters.

此外,从可用性的角度来看,用户长不可用/可读的网址。

Also, from a usability point-of-view, URLs that long are not usable/readable by users.

但是,域名有最大值。长度为255个字符。
所以为了安全起见,最多鉴于您的网址不属于1段,网址段的长度约为1745个字符。

However, the domain name has a max. length of 255 characters. So to be on the safe side, the max. length of an URL segment would be around 1745 characters, given that your URL exists out of 1 segment.

这篇关于URL路径中的段应该是一个安全的最大长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆