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

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

问题描述

如果你打算在数据库中存储一个用户代理,你会有多大?

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规范不限制标题长度一点都不
但是,Web服务器会限制它们接受的标头大小,如果超过,则抛出 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天全站免登陆