Session.userAgent

Get userAgent property.

  1. string userAgent [@property getter]
    class Session
    @property
    string
    userAgent
    ()
  2. string userAgent [@property setter]

Return Value

Type: string

User-Agent string.

If non-null, the value to use for the "User-Agent" header on class@Messages sent from this session.

RFC 2616 says: "The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests."

The User-Agent header contains a list of one or more product tokens, separated by whitespace, with the most significant product token coming first. The tokens must be brief, ASCII, and mostly alphanumeric (although "-", "_", and "." are also allowed), and may optionally include a "/" followed by a version string. You may also put comments, enclosed in parentheses, between or after the tokens.

If you set a property@Session:user-agent property that has trailing whitespace, #SoupSession will append its own product token (eg, libsoup/2.3.2) to the end of the header for you.