Hi,
The attached patch removes the fixed user-agent strings used in the svn
library and replaces them with a define. That way, svn clients can set
that define to a custom user-agent string when compiling the library.
If the client does not define a custom user-agent string, a default
("SVN/") is used (the same as before).
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
[[[
Allow the user-agent string sent over http to be defined by the
client. The define CLIENT_USER_AGENT is used as the string. If it is
not defined, the default "SVN/" is used.
* subversion/libsvn_ra_neon/session.c,
subversion/libsvn_ra_serf/ra_serf.h : use define for user agent
string instead of fixed string.
]]]
Index: subversion/libsvn_ra_neon/session.c
===================================================================
--- subversion/libsvn_ra_neon/session.c (revision 27831)
+++ subversion/libsvn_ra_neon/session.c (working copy)
@@ -44,6 +44,10 @@
#define DEFAULT_HTTP_TIMEOUT 3600
+#ifndef CLIENT_USER_AGENT
+#define CLIENT_USER_AGENT SVN/
+#endif
+
/* a cleanup routine attached to the pool that contains the RA session
baton. */
@@ -930,8 +934,8 @@
ne_set_read_timeout(sess2, timeout);
}
- ne_set_useragent(sess, "SVN/" SVN_VERSION);
- ne_set_useragent(sess2, "SVN/" SVN_VERSION);
+ ne_set_useragent(sess, APR_STRINGIFY(CLIENT_USER_AGENT) SVN_VERSION);
+ ne_set_useragent(sess2, APR_STRINGIFY(CLIENT_USER_AGENT) SVN_VERSION);
/* clean up trailing slashes from the URL */
len = strlen(uri->path);
Index: subversion/libsvn_ra_serf/ra_serf.h
===================================================================
--- subversion/libsvn_ra_serf/ra_serf.h (revision 27831)
+++ subversion/libsvn_ra_serf/ra_serf.h (working copy)
@@ -38,8 +38,11 @@
/** Use this to silence compiler warnings about unused parameters. */
#define UNUSED_CTX(x) ((void)(x))
+#ifndef CLIENT_USER_AGENT
+#define CLIENT_USER_AGENT SVN/
+#endif
/** Our User-Agent string. */
-#define USER_AGENT "SVN/" SVN_VERSION " serf/" \
+#define USER_AGENT APR_STRINGIFY(CLIENT_USER_AGENT) SVN_VERSION " serf/" \
APR_STRINGIFY(SERF_MAJOR_VERSION) "." \
APR_STRINGIFY(SERF_MINOR_VERSION) "." \
APR_STRINGIFY(SERF_PATCH_VERSION)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Nov 15 21:14:42 2007