User-Agent string syntax

Describes the formatting option for User-Agent strings used by Publish or Perish

The HTTP User-Agent identification that a client sends to an HTTP server identifies the client program and version. In many practical cases, the string contains more or less detailed information not only about the client program, but also about the operating system it's running on. A typical User-Agent string might look like:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)

Publish or Perish internally uses the same HTTP libraries as Internet Explorer and for that reason sends the same User-Agent string as Internet Explorer does. However, some data sources have special requirements for the User-Agent string contents, so that is why Publish or Perish supports User-Agent strings that are tailored to a specific data source.

For ease of configuration, the User-Agent string field may contain zero or more of the following:

  • Literal text, for example Mozilla/5.0
  • Replaceable field placeholders starting with %, for example %W

The replaceable field placeholders will be expanded when the Publish or Perish starts and include the following:

Placeholder Expands to
%% Single '%' character
%@ User-Agent string as used by Internet Explorer
%A Application name + version number, for example PoP/6.8.5967.6487
%B Windows build number, for example 7601
%D Current date as YYYYMMDD, for example 20141023
%E Trident engine version number as major.minor, for example 7.0
%I Internet Explorer version number as major.minor, for example 11.0
%M Mozilla version number as major.minor, matches the pseudo-Mozilla version that IE would have returned; for example 5.0
%P Process identifier as decimal number, for example 384
%R Pseudo-random decimal number 0-65535, for example 34270
%T Current time as HHMMSS, for example 130425
%V Pseudo-random version number as major.minor, for example 6363.37629
%W Windows version number as major.minor, for example 6.1

Notes

  • The default User-Agent string as of Publish or Perish version 4.16 is %@ (which resolves to the same identification that Internet Explorer uses in compatibility mode).
  • Internet Explorer 11 uses a User-Agent string equivalent to Mozilla/%M (Windows NT %W; Trident/%E; rv:%I) like Gecko
  • Earlier versions of Publish or Perish used Mozilla/%M (compatible; MSIE %I; Windows NT %W)
  • If you leave the User-Agent string field empty, it defaults to Mozilla/%M (compatible; MSIE %I; Windows NT %W; Trident/%E)