Reputation: 3354
I could not find anything in the RFC docs about whether the User-Agent field needed to be formatted the way it commonly is. For example, could I just do:
User-Agent: Mozilla windows NT
and still pass a valid request?
Upvotes: 0
Views: 618
Reputation: 598134
The formal definition of the User-Agent
header is defined in RFC 2616 Section 14.43 as follows:
User-Agent = "User-Agent" ":" 1*( product | comment )
product
is defined in Section 3.8 as follows:
product = token ["/" product-version]
product-version = token
token
and comment
are defined in Section 2.2 as follows:
token = 1*<any CHAR except CTLs or separators>
comment = "(" *( ctext | quoted-pair | comment ) ")"
Whitespace is a separator, so to answer your question, Mozilla windows NT
is NOT a valid product by the above token
definition. If you want to follow the spec, you could instead format it more like this: Mozilla (Windows NT)
.
Upvotes: 1
Reputation: 390
Sure, you can 'fake' a user agent. Check for yourself with this tool for instance: https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg
Upvotes: 0