Author: ivan
Date: Thu Aug 15 15:13:00 2013
New Revision: 1514315

URL: http://svn.apache.org/r1514315
Log:
Use loaded serf version in User-Agent not version used for compilation.

Found by: philip

* subversion/libsvn_ra_serf/ra_serf.h
  (USER_AGENT): Remove.

* subversion/libsvn_ra_serf/serf.c
  (get_user_agent_string): New. Use serf_lib_version() to get serf version.
  (svn_ra_serf__open): Use get_user_agent_string() function.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
    subversion/trunk/subversion/libsvn_ra_serf/serf.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1514315&r1=1514314&r2=1514315&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Thu Aug 15 15:13:00 
2013
@@ -57,13 +57,6 @@ extern "C" {
 /** 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 " (" SVN_BUILD_TARGET ")" \
-                   " serf/" \
-                   APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
-                   APR_STRINGIFY(SERF_MINOR_VERSION) "." \
-                   APR_STRINGIFY(SERF_PATCH_VERSION)
-
 /** Wait duration (in microseconds) used in calls to serf_context_run() */
 #define SVN_RA_SERF__CONTEXT_RUN_DURATION 500000
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/serf.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/serf.c?rev=1514315&r1=1514314&r2=1514315&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/serf.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/serf.c Thu Aug 15 15:13:00 2013
@@ -416,6 +416,18 @@ svn_ra_serf__progress(void *progress_bat
     }
 }
 
+/** Our User-Agent string. */
+static const char *
+get_user_agent_string(apr_pool_t *pool)
+{
+  int major, minor, patch;
+  serf_lib_version(&major, &minor, &patch);
+
+  return apr_psprintf(pool, "SVN/" SVN_VER_NUMBER " (" SVN_BUILD_TARGET ") "
+                      " serf/%d.%d.%d",
+                      major, minor, patch);
+}
+
 /* Implements svn_ra__vtable_t.open_session(). */
 static svn_error_t *
 svn_ra_serf__open(svn_ra_session_t *session,
@@ -498,10 +510,10 @@ svn_ra_serf__open(svn_ra_session_t *sess
     SVN_ERR(callbacks->get_client_string(callback_baton, &client_string, 
pool));
 
   if (client_string)
-    serf_sess->useragent = apr_pstrcat(pool, USER_AGENT, " ",
+    serf_sess->useragent = apr_pstrcat(pool, get_user_agent_string(pool), " ",
                                        client_string, (char *)NULL);
   else
-    serf_sess->useragent = USER_AGENT;
+    serf_sess->useragent = get_user_agent_string(pool);
 
   /* go ahead and tell serf about the connection. */
   status =


Reply via email to