[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Add platform information to user agent string

From: Stefan Sperling <stsp_at_elego.de>
Date: Tue, 30 Oct 2012 16:49:38 +0100

On Tue, Oct 30, 2012 at 07:28:27PM +0400, Ivan Zhakov wrote:
> Hi,
>
> I think it will be useful to add client platform information to user
> agent string, to use it Apache HTTP Server configuration or Subversion
> hooks. Within my patch applied user agent will be like this:
> SVN/1.8.0 (Windows) serf/1.1.1 TortoiseSVN/1.8.0
> SVN/1.8.0 (Macintosh) serf/1.1.1
> SVN/1.8.0 (FreeBSD) serf/1.1.1
>
> [[[
> * subversion/libsvn_ra_serf/ra_serf.h
> (USER_AGENT_PLATFORM): New.
> (USER_AGENT): Add platform information.
> ]]]
>
> Any objections?

Some users might not want to broadcast this information.
Should we provide a way for users to override this?
Maybe from the client configuration file?

> -/** Our User-Agent string. */
> -#define USER_AGENT "SVN/" SVN_VER_NUMBER " serf/" \
> +#if defined(_WIN32)
> +#define USER_AGENT_PLATFORM "Windows"
> +#elif __APPLE__
> +#define USER_AGENT_PLATFORM "Macintosh"
> +#elif __linux__
> +#define USER_AGENT_PLATFORM "Linux"
> +#elif __FreeBSD__
> +#define USER_AGENT_PLATFORM "FreeBSD"
> +#elif __NetBSD__
> +#define USER_AGENT_PLATFORM "NetBSD"
> +#elif __OpenBSD__
> +#define USER_AGENT_PLATFORM "OpenBSD"
> +#elif __unix__
> +#define USER_AGENT_PLATFORM "Unix"
> +#else
> +#define USER_AGENT_PLATFORM "Unknown"
> +#endif

A hard-coded list like this will need to be maintained over time.

Note that a trunk client prints the OS name with this command:
  svn --verbose --version
I'd suggest getting the OS name the same way in libsvn_ra_serf.
Received on 2012-10-30 16:50:22 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.