Author: lgo
Date: Thu Dec 6 21:04:08 2012
New Revision: 1418077
URL: http://svn.apache.org/viewvc?rev=1418077&view=rev
Log:
Follow up r1417642: a 1.8 server will send a header that indicates the
preferred update request mode (skelta or bulk). Use the value of this header
when deciding what to do:
- Server doesn't allow bulk updates (Off): use skelta mode.
- Server prefers bulk updates (Prefer): use bulk update mode.
- Server allows bulk updates (On) or is pre-1.8: use skelta mode or mode as set
by the user in the config file.
* subversion/libsvn_ra_serf/options.c
(capabilities_headers_iterator_callback): read the new header.
* subversion/libsvn_ra_serf/ra_serf.h
(struct svn_ra_serf__session_t): new server_allows_bulk member.
* subversion/libsvn_ra_serf/update.c
(make_update_reporter): Use the new header (if set) and the user's config
to decide on the use of bulk update or skelta mode.
Modified:
subversion/trunk/subversion/libsvn_ra_serf/options.c
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/update.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/options.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/options.c?rev=1418077&r1=1418076&r2=1418077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/options.c Thu Dec 6 21:04:08
2012
@@ -280,6 +280,10 @@ capabilities_headers_iterator_callback(v
{
opt_ctx->youngest_rev = SVN_STR_TO_REV(val);
}
+ else if (svn_cstring_casecmp(key, SVN_DAV_ALLOW_BULK_UPDATES) == 0)
+ {
+ session->server_allows_bulk = apr_pstrdup(session->pool, val);
+ }
else if (svn_cstring_casecmp(key, SVN_DAV_SUPPORTED_POSTS_HEADER) == 0)
{
/* May contain multiple values, separated by commas. */
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=1418077&r1=1418076&r2=1418077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Thu Dec 6 21:04:08
2012
@@ -228,6 +228,11 @@ struct svn_ra_serf__session_t {
all the properties and content in the update-report response. If FALSE,
request a skelta update-report with inlined properties. */
svn_boolean_t bulk_updates;
+
+ /* Indicates if the server wants bulk update requests (Prefer) or only
+ accepts skelta requests (Off). If this value is On both options are
+ allowed. */
+ const char *server_allows_bulk;
};
#define SVN_RA_SERF__HAVE_HTTPV2_SUPPORT(sess) ((sess)->me_resource != NULL)
Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1418077&r1=1418076&r2=1418077&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Thu Dec 6 21:04:08 2012
@@ -3161,6 +3161,30 @@ make_update_reporter(svn_ra_session_t *r
svn_io_file_del_on_pool_cleanup,
report->pool, scratch_pool));
+ if (sess->server_allows_bulk)
+ {
+ if (apr_strnatcasecmp(sess->server_allows_bulk, "off") == 0)
+ {
+ /* Server doesn't want bulk updates */
+ sess->bulk_updates = FALSE;
+ }
+ else if (apr_strnatcasecmp(sess->server_allows_bulk, "prefer") == 0)
+ {
+ /* Server prefers bulk updates, and we respect that */
+ sess->bulk_updates = TRUE;
+ }
+ else
+ {
+ /* Server allows bulk updates, but doesn't dictate its use. Do
+ whatever is the default or what the user defined in the config. */
+ }
+ }
+ else
+ {
+ /* Pre-1.8 server didn't send the bulk_updates header. Do
+ whatever is the default or what the user defined in the config. */
+ }
+
if (sess->bulk_updates)
{
svn_xml_make_open_tag(&buf, scratch_pool, svn_xml_normal,