用户代理字符串可以有多大? [英] How big can a user agent string get?

查看:32
本文介绍了用户代理字符串可以有多大?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您要将用户代理存储在数据库中,您会容纳多大的空间?

If you were going to store a user agent in a database, how large would you accomdate for?

我发现这篇 technet 文章 建议将 UA 保持在 200 以下.看起来这不是在 HTTP 规范中定义的,至少不是我发现的.我的 UA 已经是 149 个字符了,似乎每个版本的 .NET 都会添加进去.

I found this technet article which recommends keeping UA under 200. It doesn't look like this is defined in the HTTP specification at least not that I found. My UA is already 149 characters, and it seems like each version of .NET will be adding to it.

我知道我可以解析字符串并将其分解,但我宁愿不这样做.

I know I can parse the string out and break it down but I'd rather not.

编辑
基于此博客 IE9 将更改为发送短 UA 字符串.这是一个很好的改变.

EDIT
Based on this Blog IE9 will be changing to send the short UA string. This is a good change.

推荐答案

HTTP 规范根本不限制头的长度.然而,网络服务器确实限制了他们接受的标头大小,如果超过则抛出 413 Entity Too Large.

HTTP specification does not limit length of headers at all. However web-servers do limit header size they accept, throwing 413 Entity Too Large if it exceeds.

根据网络服务器及其设置,这些限制从 4KB 到 64KB(所有标头的总数)不等.

Depending on web-server and their settings these limits vary from 4KB to 64KB (total for all headers).

这篇关于用户代理字符串可以有多大?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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