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