1. HTTP (Hypertext Transfer Protocol)

  1. HTTP Headers

  1. User-Agent
    1. Writing requests (clients)
    2. Reading requests (servers)
    3. Overview table
    4. Syntax
      1. Example

User-Agent

The "User-Agent" header field contains information about the user agent originating the request, which is often used by servers to help identify the scope of reported interoperability problems, to work around or tailor responses to avoid particular user agent limitations, and for analytics regarding browser or operating system use.

The header consists of one or more product names and versions, and comments.

Writing requests (clients)

Clients should typically include a User-Agent header unless specifically configured to omit it. HTTP libraries should include a default user agent that can be disabled, and offers the option to add a custom product name ahead of the library name. If there is a homepage about the user-agent, provide it in a comment (this URI cannot contain parentheses). For example:

User-Agent: Surfer/2.15 (http://example.com/about) libwww/2.17b3

Reading requests (servers)

Servers may record the user agent string to keep aggregated metrics on what sort of clients are accessing. Note that clients don't have to be honest, and frequently provide misleading information for the sake of bypassing feature detection that relies on testing the User-Agent string. Do not use the User-Agent string for feature detection.

Overview table

Name
User-Agent
Description
Names the user agent and version making the request.
Direction
Request
Specification
HTTP/1.1 Semantics and Content ยง5.5.3. User-Agent

Syntax

User-Agent      = product *( RWS ( product / comment ) )
product         = token ["/" product-version]
product-version = token
comment         = "(" *( ctext / quoted-pair / comment ) ")"
ctext           = HTAB / SP / %x21-27 / %x2A-5B / %x5D-7E / obs-text
quoted-pair     = "\" ( HTAB / SP / VCHAR / obs-text )

Example

User-Agent: User-Agent: Surfer/2.15 (http://example.com/about) libwww/2.17b3
User-Agent: curl/7.54.0