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?

I've tested it only on Windows, so more testing would be useful.

[1] http://sourceforge.net/p/predef/wiki/OperatingSystems/

-- 
Ivan Zhakov
Index: subversion/libsvn_ra_serf/ra_serf.h
===================================================================
--- subversion/libsvn_ra_serf/ra_serf.h (revision 1403730)
+++ subversion/libsvn_ra_serf/ra_serf.h (working copy)
@@ -56,8 +56,27 @@
 /** Use this to silence compiler warnings about unused parameters. */
 #define UNUSED_CTX(x) ((void)(x))
 
-/** 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
+
+    /** Our User-Agent string. */
+#define USER_AGENT "SVN/" SVN_VER_NUMBER "(" USER_AGENT_PLATFORM ")" \
+                   " serf/" \
                    APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
                    APR_STRINGIFY(SERF_MINOR_VERSION) "." \
                    APR_STRINGIFY(SERF_PATCH_VERSION)

Reply via email to