You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/10/15 10:52:18 UTC
svn commit: r1532250 [17/37] - in /subversion/branches/cache-server: ./
build/ build/ac-macros/ build/generator/ build/generator/swig/
build/generator/templates/ contrib/client-side/emacs/ contrib/hook-scripts/
contrib/server-side/fsfsfixer/ contrib/se...
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/blame.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/blame.c Tue Oct 15 08:52:06 2013
@@ -24,6 +24,7 @@
#include <apr_uri.h>
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -35,8 +36,6 @@
#include "svn_base64.h"
#include "svn_props.h"
-#include "svn_private_config.h"
-
#include "private/svn_string_private.h"
#include "ra_serf.h"
@@ -47,7 +46,7 @@
* This enum represents the current state of our XML parsing for a REPORT.
*/
typedef enum blame_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
FILE_REVS_REPORT,
FILE_REV,
REV_PROP,
@@ -111,7 +110,6 @@ static const svn_ra_serf__xml_transition
{ 0 }
};
-
/* Conforms to svn_ra_serf__xml_opened_t */
static svn_error_t *
blame_opened(svn_ra_serf__xml_estate_t *xes,
@@ -332,6 +330,7 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
svn_ra_serf__xml_context_t *xmlctx;
const char *req_url;
svn_error_t *err;
+ svn_revnum_t peg_rev;
blame_ctx = apr_pcalloc(pool, sizeof(*blame_ctx));
blame_ctx->pool = pool;
@@ -342,18 +341,26 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
blame_ctx->end = end;
blame_ctx->include_merged_revisions = include_merged_revisions;
+ /* Since Subversion 1.8 we allow retrieving blames backwards. So we can't
+ just unconditionally use end_rev as the peg revision as before */
+ if (end > start)
+ peg_rev = end;
+ else
+ peg_rev = start;
+
SVN_ERR(svn_ra_serf__get_stable_url(&req_url, NULL /* latest_revnum */,
session, NULL /* conn */,
- NULL /* url */, end,
+ NULL /* url */, peg_rev,
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(blame_ttable,
blame_opened,
blame_closed,
blame_cdata,
+ NULL,
blame_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
@@ -366,7 +373,7 @@ svn_ra_serf__get_file_revs(svn_ra_sessio
err = svn_ra_serf__context_run_one(handler, pool);
err = svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err);
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/blncache.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/blncache.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/blncache.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/blncache.c Tue Oct 15 08:52:06 2013
@@ -23,6 +23,7 @@
#include <apr_pools.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_dirent_uri.h"
#include "svn_types.h"
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/commit.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/commit.c Tue Oct 15 08:52:06 2013
@@ -24,6 +24,7 @@
#include <apr_uri.h>
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -36,7 +37,6 @@
#include "svn_path.h"
#include "svn_props.h"
-#include "svn_private_config.h"
#include "private/svn_dep_compat.h"
#include "private/svn_fspath.h"
#include "private/svn_skel.h"
@@ -223,7 +223,7 @@ return_response_err(svn_ra_serf__handler
/* Try to return one of the standard errors for 301, 404, etc.,
then look for an error embedded in the response. */
return svn_error_compose_create(svn_ra_serf__error_on_status(
- handler->sline.code,
+ handler->sline,
handler->path,
handler->location),
err);
@@ -382,7 +382,7 @@ checkout_dir(dir_context_t *dir,
apr_pool_t *scratch_pool)
{
svn_error_t *err;
- dir_context_t *p_dir = dir;
+ dir_context_t *c_dir = dir;
const char *checkout_url;
const char **working;
@@ -393,17 +393,25 @@ checkout_dir(dir_context_t *dir,
/* Is this directory or one of our parent dirs newly added?
* If so, we're already implicitly checked out. */
- while (p_dir)
+ while (c_dir)
{
- if (p_dir->added)
+ if (c_dir->added)
{
+ /* Calculate the working_url by skipping the shared ancestor between
+ * the c_dir_parent->relpath and dir->relpath. This is safe since an
+ * add is guaranteed to have a parent that is checked out. */
+ dir_context_t *c_dir_parent = c_dir->parent_dir;
+ const char *relpath = svn_relpath_skip_ancestor(c_dir_parent->relpath,
+ dir->relpath);
+
/* Implicitly checkout this dir now. */
+ SVN_ERR_ASSERT(c_dir_parent->working_url);
dir->working_url = svn_path_url_add_component2(
- dir->parent_dir->working_url,
- dir->name, dir->pool);
+ c_dir_parent->working_url,
+ relpath, dir->pool);
return SVN_NO_ERROR;
}
- p_dir = p_dir->parent_dir;
+ c_dir = c_dir->parent_dir;
}
/* We could be called twice for the root: once to checkout the baseline;
@@ -544,6 +552,7 @@ checkout_file(file_context_t *file,
if (parent_dir->added)
{
/* Implicitly checkout this file now. */
+ SVN_ERR_ASSERT(parent_dir->working_url);
file->working_url = svn_path_url_add_component2(
parent_dir->working_url,
svn_relpath_skip_ancestor(
@@ -804,8 +813,18 @@ maybe_set_lock_token_header(serf_bucket_
if (token)
{
const char *token_header;
+ const char *token_uri;
+ apr_uri_t uri = commit_ctx->session->session_url;
- token_header = apr_pstrcat(pool, "(<", token, ">)", (char *)NULL);
+ /* Supplying the optional URI affects apache response when
+ the lock is broken, see issue 4369. When present any URI
+ must be absolute (RFC 2518 9.4). */
+ uri.path = (char *)svn_path_url_add_component2(uri.path, relpath,
+ pool);
+ token_uri = apr_uri_unparse(pool, &uri, 0);
+
+ token_header = apr_pstrcat(pool, "<", token_uri, "> (<", token, ">)",
+ (char *)NULL);
serf_bucket_headers_set(headers, "If", token_header);
}
}
@@ -984,7 +1003,7 @@ create_put_body(serf_bucket_t **body_bkt
* check the buffer status; but serf will fall through and create a file
* bucket for us on the buffered svndiff handle.
*/
- apr_file_flush(ctx->svndiff);
+ SVN_ERR(svn_io_file_flush(ctx->svndiff, pool));
#if APR_VERSION_AT_LEAST(1, 3, 0)
apr_file_buffer_set(ctx->svndiff, NULL, 0);
#endif
@@ -1914,7 +1933,18 @@ add_file(const char *path,
if (handler->sline.code != 404)
{
- return svn_error_createf(SVN_ERR_RA_DAV_ALREADY_EXISTS, NULL,
+ if (handler->sline.code != 200)
+ {
+ svn_error_t *err;
+
+ err = svn_ra_serf__error_on_status(handler->sline,
+ handler->path,
+ handler->location);
+
+ SVN_ERR(err);
+ }
+
+ return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
_("File '%s' already exists"), path);
}
}
@@ -2149,8 +2179,8 @@ close_file(void *file_baton,
{
proppatch_context_t *proppatch;
- proppatch = apr_pcalloc(ctx->pool, sizeof(*proppatch));
- proppatch->pool = ctx->pool;
+ proppatch = apr_pcalloc(scratch_pool, sizeof(*proppatch));
+ proppatch->pool = scratch_pool;
proppatch->relpath = ctx->relpath;
proppatch->path = ctx->url;
proppatch->commit = ctx->commit;
@@ -2158,7 +2188,7 @@ close_file(void *file_baton,
proppatch->removed_props = ctx->removed_props;
proppatch->base_revision = ctx->base_revision;
- SVN_ERR(proppatch_resource(proppatch, ctx->commit, ctx->pool));
+ SVN_ERR(proppatch_resource(proppatch, ctx->commit, scratch_pool));
}
return SVN_NO_ERROR;
@@ -2259,7 +2289,9 @@ abort_edit(void *edit_baton,
&& handler->sline.code != 404
)
{
- SVN_ERR_MALFUNCTION();
+ return svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
+ _("DELETE returned unexpected status: %d"),
+ handler->sline.code);
}
return SVN_NO_ERROR;
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/get_deleted_rev.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/get_deleted_rev.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/get_deleted_rev.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/get_deleted_rev.c Tue Oct 15 08:52:06 2013
@@ -36,7 +36,7 @@
* This enum represents the current state of our XML parsing for a REPORT.
*/
enum drev_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
REPORT,
VERSION_NAME
};
@@ -151,10 +151,10 @@ svn_ra_serf__get_deleted_rev(svn_ra_sess
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(getdrev_ttable,
- NULL, getdrev_closed, NULL,
+ NULL, getdrev_closed, NULL, NULL,
drev_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/getdate.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/getdate.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/getdate.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/getdate.c Tue Oct 15 08:52:06 2013
@@ -44,7 +44,7 @@
* This enum represents the current state of our XML parsing for a REPORT.
*/
enum date_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
REPORT,
VERSION_NAME
};
@@ -131,6 +131,7 @@ svn_ra_serf__get_dated_revision(svn_ra_s
svn_ra_serf__handler_t *handler;
svn_ra_serf__xml_context_t *xmlctx;
const char *report_target;
+ svn_error_t *err;
date_ctx = apr_palloc(pool, sizeof(*date_ctx));
date_ctx->time = tm;
@@ -139,10 +140,10 @@ svn_ra_serf__get_dated_revision(svn_ra_s
SVN_ERR(svn_ra_serf__report_resource(&report_target, session, NULL, pool));
xmlctx = svn_ra_serf__xml_context_create(date_ttable,
- NULL, date_closed, NULL,
+ NULL, date_closed, NULL, NULL,
date_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = report_target;
@@ -155,7 +156,15 @@ svn_ra_serf__get_dated_revision(svn_ra_s
*date_ctx->revision = SVN_INVALID_REVNUM;
- /* ### use svn_ra_serf__error_on_status() ? */
+ err = svn_ra_serf__context_run_one(handler, pool);
- return svn_error_trace(svn_ra_serf__context_run_one(handler, pool));
+ SVN_ERR(svn_error_compose_create(
+ svn_ra_serf__error_on_status(handler->sline,
+ report_target,
+ handler->location),
+ err));
+
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(*revision));
+
+ return SVN_NO_ERROR;
}
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocations.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocations.c Tue Oct 15 08:52:06 2013
@@ -27,12 +27,12 @@
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_xml.h"
-#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
@@ -43,7 +43,7 @@
* This enum represents the current state of our XML parsing for a REPORT.
*/
enum loc_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
REPORT,
LOCATION
};
@@ -176,10 +176,10 @@ svn_ra_serf__get_locations(svn_ra_sessio
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(getloc_ttable,
- NULL, getloc_closed, NULL,
+ NULL, getloc_closed, NULL, NULL,
loc_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
@@ -192,7 +192,7 @@ svn_ra_serf__get_locations(svn_ra_sessio
err = svn_ra_serf__context_run_one(handler, pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
req_url,
handler->location),
err));
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocationsegments.c Tue Oct 15 08:52:06 2013
@@ -27,12 +27,12 @@
#include <apr_uri.h>
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_xml.h"
#include "svn_path.h"
-#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
#include "ra_serf.h"
@@ -52,8 +52,8 @@ typedef struct gls_context_t {
} gls_context_t;
-enum {
- INITIAL = 0,
+enum locseg_state_e {
+ INITIAL = XML_STATE_INITIAL,
REPORT,
SEGMENT
};
@@ -178,10 +178,10 @@ svn_ra_serf__get_location_segments(svn_r
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(gls_ttable,
- NULL, gls_closed, NULL,
+ NULL, gls_closed, NULL, NULL,
gls_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
@@ -194,7 +194,7 @@ svn_ra_serf__get_location_segments(svn_r
err = svn_ra_serf__context_run_one(handler, pool);
err = svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err);
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocks.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/getlocks.c Tue Oct 15 08:52:06 2013
@@ -27,6 +27,7 @@
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_pools.h"
@@ -37,7 +38,6 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
-#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
@@ -47,8 +47,8 @@
/*
* This enum represents the current state of our XML parsing for a REPORT.
*/
-enum {
- INITIAL = 0,
+enum getlocks_state_e {
+ INITIAL = XML_STATE_INITIAL,
REPORT,
LOCK,
PATH,
@@ -246,10 +246,10 @@ svn_ra_serf__get_locks(svn_ra_session_t
lock_ctx->hash = apr_hash_make(pool);
xmlctx = svn_ra_serf__xml_context_create(getlocks_ttable,
- NULL, getlocks_closed, NULL,
+ NULL, getlocks_closed, NULL, NULL,
lock_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
@@ -266,7 +266,7 @@ svn_ra_serf__get_locks(svn_ra_session_t
have existed earlier (E.g. 'svn ls http://s/svn/trunk/file@1' */
if (handler->sline.code != 404)
{
- SVN_ERR(svn_ra_serf__error_on_status(handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location));
}
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/inherited_props.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/inherited_props.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/inherited_props.c Tue Oct 15 08:52:06 2013
@@ -25,6 +25,7 @@
#include <apr_tables.h>
#include <apr_xml.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_ra.h"
@@ -35,13 +36,12 @@
#include "private/svn_dav_protocol.h"
#include "../libsvn_ra/ra_loader.h"
-#include "svn_private_config.h"
#include "ra_serf.h"
/* The current state of our XML parsing. */
typedef enum iprops_state_e {
- NONE = 0,
+ INITIAL = XML_STATE_INITIAL,
IPROPS_REPORT,
IPROPS_ITEM,
IPROPS_PATH,
@@ -61,18 +61,12 @@ typedef struct iprops_context_t {
/* The repository's root URL. */
const char *repos_root_url;
- /* Current CDATA values*/
- svn_stringbuf_t *curr_path;
+ /* Current property name */
svn_stringbuf_t *curr_propname;
- svn_stringbuf_t *curr_propval;
- const char *curr_prop_val_encoding;
/* Current element in IPROPS. */
svn_prop_inherited_item_t *curr_iprop;
- /* Serf context completion flag for svn_ra_serf__context_run_wait() */
- svn_boolean_t done;
-
/* Path we are finding inherited properties for. This is relative to
the RA session passed to svn_ra_serf__get_inherited_props. */
const char *path;
@@ -80,162 +74,121 @@ typedef struct iprops_context_t {
svn_revnum_t revision;
} iprops_context_t;
+#define S_ SVN_XML_NAMESPACE
+static const svn_ra_serf__xml_transition_t iprops_table[] = {
+ { INITIAL, S_, SVN_DAV__INHERITED_PROPS_REPORT, IPROPS_REPORT,
+ FALSE, { NULL }, FALSE },
+
+ { IPROPS_REPORT, S_, SVN_DAV__IPROP_ITEM, IPROPS_ITEM,
+ FALSE, { NULL }, TRUE },
+
+ { IPROPS_ITEM, S_, SVN_DAV__IPROP_PATH, IPROPS_PATH,
+ TRUE, { NULL }, TRUE },
+
+ { IPROPS_ITEM, S_, SVN_DAV__IPROP_PROPNAME, IPROPS_PROPNAME,
+ TRUE, { NULL }, TRUE },
+
+ { IPROPS_ITEM, S_, SVN_DAV__IPROP_PROPVAL, IPROPS_PROPVAL,
+ TRUE, { "?V:encoding", NULL }, TRUE },
+
+ { 0 }
+};
+
+/* Conforms to svn_ra_serf__xml_opened_t */
static svn_error_t *
-start_element(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- const char **attrs,
+iprops_opened(svn_ra_serf__xml_estate_t *xes,
+ void *baton,
+ int entered_state,
+ const svn_ra_serf__dav_props_t *tag,
apr_pool_t *scratch_pool)
{
- iprops_context_t *iprops_ctx = parser->user_data;
- iprops_state_e state;
+ iprops_context_t *iprops_ctx = baton;
- state = parser->state->current_state;
- if (state == NONE
- && strcmp(name.name, SVN_DAV__INHERITED_PROPS_REPORT) == 0)
- {
- svn_ra_serf__xml_push_state(parser, IPROPS_REPORT);
- }
- else if (state == IPROPS_REPORT &&
- strcmp(name.name, SVN_DAV__IPROP_ITEM) == 0)
+ if (entered_state == IPROPS_ITEM)
{
- svn_stringbuf_setempty(iprops_ctx->curr_path);
svn_stringbuf_setempty(iprops_ctx->curr_propname);
- svn_stringbuf_setempty(iprops_ctx->curr_propval);
- iprops_ctx->curr_prop_val_encoding = NULL;
- iprops_ctx->curr_iprop = NULL;
- svn_ra_serf__xml_push_state(parser, IPROPS_ITEM);
- }
- else if (state == IPROPS_ITEM &&
- strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0)
- {
- const char *prop_val_encoding = svn_xml_get_attr_value("encoding",
- attrs);
- iprops_ctx->curr_prop_val_encoding = apr_pstrdup(iprops_ctx->pool,
- prop_val_encoding);
- svn_ra_serf__xml_push_state(parser, IPROPS_PROPVAL);
- }
- else if (state == IPROPS_ITEM &&
- strcmp(name.name, SVN_DAV__IPROP_PATH) == 0)
- {
- svn_ra_serf__xml_push_state(parser, IPROPS_PATH);
- }
- else if (state == IPROPS_ITEM &&
- strcmp(name.name, SVN_DAV__IPROP_PROPNAME) == 0)
- {
- svn_ra_serf__xml_push_state(parser, IPROPS_PROPNAME);
- }
- else if (state == IPROPS_ITEM &&
- strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0)
- {
- svn_ra_serf__xml_push_state(parser, IPROPS_PROPVAL);
- }
+ iprops_ctx->curr_iprop = apr_pcalloc(iprops_ctx->pool,
+ sizeof(*iprops_ctx->curr_iprop));
+
+ iprops_ctx->curr_iprop->prop_hash = apr_hash_make(iprops_ctx->pool);
+ }
return SVN_NO_ERROR;
}
+/* Conforms to svn_ra_serf__xml_closed_t */
static svn_error_t *
-end_element(svn_ra_serf__xml_parser_t *parser,
- svn_ra_serf__dav_props_t name,
- apr_pool_t *scratch_pool)
+iprops_closed(svn_ra_serf__xml_estate_t *xes,
+ void *baton,
+ int leaving_state,
+ const svn_string_t *cdata,
+ apr_hash_t *attrs,
+ apr_pool_t *scratch_pool)
{
- iprops_context_t *iprops_ctx = parser->user_data;
- iprops_state_e state;
-
- state = parser->state->current_state;
+ iprops_context_t *iprops_ctx = baton;
- if (state == IPROPS_REPORT &&
- strcmp(name.name, SVN_DAV__INHERITED_PROPS_REPORT) == 0)
+ if (leaving_state == IPROPS_ITEM)
{
- svn_ra_serf__xml_pop_state(parser);
+ APR_ARRAY_PUSH(iprops_ctx->iprops, svn_prop_inherited_item_t *) =
+ iprops_ctx->curr_iprop;
+
+ iprops_ctx->curr_iprop = NULL;
}
- else if (state == IPROPS_PATH
- && strcmp(name.name, SVN_DAV__IPROP_PATH) == 0)
+ else if (leaving_state == IPROPS_PATH)
{
- iprops_ctx->curr_iprop = apr_palloc(
- iprops_ctx->pool, sizeof(svn_prop_inherited_item_t));
+ /* Every <iprop-item> has a single <iprop-path> */
+ if (iprops_ctx->curr_iprop->path_or_url)
+ return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
iprops_ctx->curr_iprop->path_or_url =
svn_path_url_add_component2(iprops_ctx->repos_root_url,
- iprops_ctx->curr_path->data,
+ cdata->data,
iprops_ctx->pool);
- iprops_ctx->curr_iprop->prop_hash = apr_hash_make(iprops_ctx->pool);
- svn_ra_serf__xml_pop_state(parser);
}
- else if (state == IPROPS_PROPVAL
- && strcmp(name.name, SVN_DAV__IPROP_PROPVAL) == 0)
+ else if (leaving_state == IPROPS_PROPNAME)
{
- const svn_string_t *prop_val;
+ if (iprops_ctx->curr_propname->len)
+ return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
- if (iprops_ctx->curr_prop_val_encoding)
- {
- svn_string_t encoded_prop_val;
+ /* Store propname for value */
+ svn_stringbuf_set(iprops_ctx->curr_propname, cdata->data);
+ }
+ else if (leaving_state == IPROPS_PROPVAL)
+ {
+ const char *encoding;
+ const svn_string_t *val_str;
- if (strcmp(iprops_ctx->curr_prop_val_encoding, "base64") != 0)
- return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
+ if (! iprops_ctx->curr_propname->len)
+ return svn_error_create(SVN_ERR_XML_MALFORMED, NULL, NULL);
- encoded_prop_val.data = iprops_ctx->curr_propval->data;
- encoded_prop_val.len = iprops_ctx->curr_propval->len;
- prop_val = svn_base64_decode_string(&encoded_prop_val,
- iprops_ctx->pool);
+ encoding = svn_hash_gets(attrs, "V:encoding");
+
+ if (encoding)
+ {
+ if (strcmp(encoding, "base64") != 0)
+ return svn_error_createf(SVN_ERR_XML_MALFORMED,
+ NULL,
+ _("Got unrecognized encoding '%s'"),
+ encoding);
+
+ /* Decode into the right pool. */
+ val_str = svn_base64_decode_string(cdata, iprops_ctx->pool);
}
else
{
- prop_val = svn_string_create_from_buf(iprops_ctx->curr_propval,
- iprops_ctx->pool);
+ /* Copy into the right pool. */
+ val_str = svn_string_dup(cdata, iprops_ctx->pool);
}
svn_hash_sets(iprops_ctx->curr_iprop->prop_hash,
apr_pstrdup(iprops_ctx->pool,
iprops_ctx->curr_propname->data),
- prop_val);
- /* Clear current propname and propval in the event there are
- multiple properties on the current path. */
+ val_str);
+ /* Clear current propname. */
svn_stringbuf_setempty(iprops_ctx->curr_propname);
- svn_stringbuf_setempty(iprops_ctx->curr_propval);
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == IPROPS_PROPNAME
- && strcmp(name.name, SVN_DAV__IPROP_PROPNAME) == 0)
- {
- svn_ra_serf__xml_pop_state(parser);
- }
- else if (state == IPROPS_ITEM
- && strcmp(name.name, SVN_DAV__IPROP_ITEM) == 0)
- {
- APR_ARRAY_PUSH(iprops_ctx->iprops, svn_prop_inherited_item_t *) =
- iprops_ctx->curr_iprop;
- svn_ra_serf__xml_pop_state(parser);
- }
- return SVN_NO_ERROR;
-}
-
-
-static svn_error_t *
-cdata_handler(svn_ra_serf__xml_parser_t *parser,
- const char *data,
- apr_size_t len,
- apr_pool_t *scratch_pool)
-{
- iprops_context_t *iprops_ctx = parser->user_data;
- iprops_state_e state = parser->state->current_state;
-
- switch (state)
- {
- case IPROPS_PATH:
- svn_stringbuf_appendbytes(iprops_ctx->curr_path, data, len);
- break;
-
- case IPROPS_PROPNAME:
- svn_stringbuf_appendbytes(iprops_ctx->curr_propname, data, len);
- break;
-
- case IPROPS_PROPVAL:
- svn_stringbuf_appendbytes(iprops_ctx->curr_propval, data, len);
- break;
-
- default:
- break;
}
+ else
+ SVN_ERR_MALFUNCTION(); /* Invalid transition table */
return SVN_NO_ERROR;
}
@@ -281,7 +234,7 @@ svn_ra_serf__get_inherited_props(svn_ra_
iprops_context_t *iprops_ctx;
svn_ra_serf__session_t *session = ra_session->priv;
svn_ra_serf__handler_t *handler;
- svn_ra_serf__xml_parser_t *parser_ctx;
+ svn_ra_serf__xml_context_t *xmlctx;
const char *req_url;
SVN_ERR(svn_ra_serf__get_stable_url(&req_url,
@@ -290,24 +243,26 @@ svn_ra_serf__get_inherited_props(svn_ra_
NULL /* conn */,
NULL /* url */,
revision,
- result_pool, scratch_pool));
+ scratch_pool, scratch_pool));
SVN_ERR_ASSERT(session->repos_root_str);
iprops_ctx = apr_pcalloc(scratch_pool, sizeof(*iprops_ctx));
- iprops_ctx->done = FALSE;
iprops_ctx->repos_root_url = session->repos_root_str;
iprops_ctx->pool = result_pool;
- iprops_ctx->curr_path = svn_stringbuf_create_empty(scratch_pool);
iprops_ctx->curr_propname = svn_stringbuf_create_empty(scratch_pool);
- iprops_ctx->curr_propval = svn_stringbuf_create_empty(scratch_pool);
iprops_ctx->curr_iprop = NULL;
iprops_ctx->iprops = apr_array_make(result_pool, 1,
sizeof(svn_prop_inherited_item_t *));
iprops_ctx->path = path;
iprops_ctx->revision = revision;
- handler = apr_pcalloc(scratch_pool, sizeof(*handler));
+ xmlctx = svn_ra_serf__xml_context_create(iprops_table,
+ iprops_opened, iprops_closed,
+ NULL, NULL,
+ iprops_ctx,
+ scratch_pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, scratch_pool);
handler->method = "REPORT";
handler->path = req_url;
@@ -318,27 +273,14 @@ svn_ra_serf__get_inherited_props(svn_ra_
handler->body_type = "text/xml";
handler->handler_pool = scratch_pool;
- parser_ctx = apr_pcalloc(scratch_pool, sizeof(*parser_ctx));
-
- parser_ctx->pool = scratch_pool;
- parser_ctx->user_data = iprops_ctx;
- parser_ctx->start = start_element;
- parser_ctx->end = end_element;
- parser_ctx->cdata = cdata_handler;
- parser_ctx->done = &iprops_ctx->done;
-
- handler->response_handler = svn_ra_serf__handle_xml_parser;
- handler->response_baton = parser_ctx;
-
err = svn_ra_serf__context_run_one(handler, scratch_pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location),
err));
- if (iprops_ctx->done)
- *iprops = iprops_ctx->iprops;
+ *iprops = iprops_ctx->iprops;
return SVN_NO_ERROR;
}
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/locks.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/locks.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/locks.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/locks.c Tue Oct 15 08:52:06 2013
@@ -142,6 +142,10 @@ static const svn_ra_serf__xml_transition
{ 0 }
};
+static const int locks_expected_status[] = {
+ 207,
+ 0
+};
/* Conforms to svn_ra_serf__xml_closed_t */
static svn_error_t *
@@ -214,29 +218,26 @@ static svn_error_t *
determine_error(svn_ra_serf__handler_t *handler,
svn_error_t *err)
{
- {
- apr_status_t errcode;
-
- if (handler->sline.code == 423)
- errcode = SVN_ERR_FS_PATH_ALREADY_LOCKED;
- else if (handler->sline.code == 403)
- errcode = SVN_ERR_RA_DAV_FORBIDDEN;
- else
- return err;
+ apr_status_t errcode;
- /* Client-side or server-side error already. Return it. */
- if (err != NULL)
- return err;
-
- /* The server did not send us a detailed human-readable error.
- Provide a generic error. */
- err = svn_error_createf(errcode, NULL,
- _("Lock request failed: %d %s"),
- handler->sline.code,
- handler->sline.reason);
- }
+ if (err)
+ return err;
- return err;
+ if (handler->sline.code == 200 || handler->sline.code == 207)
+ return SVN_NO_ERROR;
+ else if (handler->sline.code == 423)
+ errcode = SVN_ERR_FS_PATH_ALREADY_LOCKED;
+ else if (handler->sline.code == 403)
+ errcode = SVN_ERR_RA_DAV_FORBIDDEN;
+ else
+ errcode = SVN_ERR_RA_DAV_REQUEST_FAILED;
+
+ /* The server did not send us a detailed human-readable error.
+ Provide a generic error. */
+ return svn_error_createf(errcode, NULL,
+ _("Lock request failed: %d %s"),
+ handler->sline.code,
+ handler->sline.reason ? handler->sline.reason : "");
}
@@ -381,10 +382,10 @@ svn_ra_serf__get_lock(svn_ra_session_t *
lock_ctx->lock->path = apr_pstrdup(pool, path); /* be sure */
xmlctx = svn_ra_serf__xml_context_create(locks_ttable,
- NULL, locks_closed, NULL,
+ NULL, locks_closed, NULL, NULL,
lock_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, locks_expected_status, pool);
handler->method = "PROPFIND";
handler->path = req_url;
@@ -406,7 +407,7 @@ svn_ra_serf__get_lock(svn_ra_session_t *
lock_ctx->handler = handler;
err = svn_ra_serf__context_run_one(handler, pool);
- err = determine_error(handler, err);
+ err = svn_error_trace(determine_error(handler, err));
if (handler->sline.code == 404)
{
@@ -472,10 +473,10 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
lock_ctx->path, iterpool);
xmlctx = svn_ra_serf__xml_context_create(locks_ttable,
- NULL, locks_closed, NULL,
+ NULL, locks_closed, NULL, NULL,
lock_ctx,
iterpool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, iterpool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, iterpool);
handler->method = "LOCK";
handler->path = req_url;
@@ -497,7 +498,7 @@ svn_ra_serf__lock(svn_ra_session_t *ra_s
lock_ctx->handler = handler;
err = svn_ra_serf__context_run_one(handler, iterpool);
- err = determine_error(handler, err);
+ err = svn_error_trace(determine_error(handler, err));
if (lock_func)
new_err = lock_func(lock_baton, lock_ctx->path, TRUE, lock_ctx->lock,
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/log.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/log.c Tue Oct 15 08:52:06 2013
@@ -26,6 +26,7 @@
#include <apr_uri.h>
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -39,7 +40,6 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_string_private.h"
#include "private/svn_subr_private.h"
-#include "svn_private_config.h"
#include "ra_serf.h"
#include "../libsvn_ra/ra_loader.h"
@@ -48,8 +48,8 @@
/*
* This enum represents the current state of our XML parsing for a REPORT.
*/
-enum {
- INITIAL = 0,
+enum log_state_e {
+ INITIAL = XML_STATE_INITIAL,
REPORT,
ITEM,
VERSION,
@@ -76,6 +76,7 @@ typedef struct log_context_t {
svn_boolean_t changed_paths;
svn_boolean_t strict_node_history;
svn_boolean_t include_merged_revisions;
+ svn_move_behavior_t move_behavior;
const apr_array_header_t *revprops;
int nest_level; /* used to track mergeinfo nesting levels */
int count; /* only incremented when nest_level == 0 */
@@ -451,6 +452,14 @@ create_log_body(serf_bucket_t **body_bkt
alloc);
}
+ if (log_ctx->move_behavior != svn_move_behavior_no_moves)
+ {
+ svn_ra_serf__add_tag_buckets(buckets,
+ "S:move-behavior",
+ apr_ltoa(pool, log_ctx->move_behavior),
+ alloc);
+ }
+
if (log_ctx->revprops)
{
int i;
@@ -507,6 +516,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
svn_boolean_t discover_changed_paths,
svn_boolean_t strict_node_history,
svn_boolean_t include_merged_revisions,
+ svn_move_behavior_t move_behavior,
const apr_array_header_t *revprops,
svn_log_entry_receiver_t receiver,
void *receiver_baton,
@@ -532,6 +542,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
log_ctx->changed_paths = discover_changed_paths;
log_ctx->strict_node_history = strict_node_history;
log_ctx->include_merged_revisions = include_merged_revisions;
+ log_ctx->move_behavior = move_behavior;
log_ctx->revprops = revprops;
log_ctx->nest_level = 0;
@@ -579,10 +590,10 @@ svn_ra_serf__get_log(svn_ra_session_t *r
pool, pool));
xmlctx = svn_ra_serf__xml_context_create(log_ttable,
- log_opened, log_closed, NULL,
+ log_opened, log_closed, NULL, NULL,
log_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = req_url;
@@ -595,7 +606,7 @@ svn_ra_serf__get_log(svn_ra_session_t *r
err = svn_ra_serf__context_run_one(handler, pool);
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(handler->sline.code,
+ svn_ra_serf__error_on_status(handler->sline,
req_url,
handler->location),
err));
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/merge.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/merge.c Tue Oct 15 08:52:06 2013
@@ -27,6 +27,7 @@
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -38,7 +39,6 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
-#include "svn_private_config.h"
#include "ra_serf.h"
#include "../libsvn_ra/ra_loader.h"
@@ -48,7 +48,7 @@
* This enum represents the current state of our XML parsing for a MERGE.
*/
typedef enum merge_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
MERGE_RESPONSE,
UPDATED_SET,
RESPONSE,
@@ -404,10 +404,10 @@ svn_ra_serf__run_merge(const svn_commit_
merge_ctx->merge_url = session->session_url.path;
xmlctx = svn_ra_serf__xml_context_create(merge_ttable,
- NULL, merge_closed, NULL,
+ NULL, merge_closed, NULL, NULL,
merge_ctx,
scratch_pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, scratch_pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, scratch_pool);
handler->method = "MERGE";
handler->path = merge_ctx->merge_url;
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/mergeinfo.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/mergeinfo.c Tue Oct 15 08:52:06 2013
@@ -24,6 +24,7 @@
#include <apr_tables.h>
#include <apr_xml.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_mergeinfo.h"
#include "svn_path.h"
@@ -33,7 +34,6 @@
#include "private/svn_dav_protocol.h"
#include "../libsvn_ra/ra_loader.h"
-#include "svn_private_config.h"
#include "ra_serf.h"
@@ -41,7 +41,7 @@
/* The current state of our XML parsing. */
typedef enum mergeinfo_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
MERGEINFO_REPORT,
MERGEINFO_ITEM,
MERGEINFO_PATH,
@@ -191,7 +191,7 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
svn_boolean_t include_descendants,
apr_pool_t *pool)
{
- svn_error_t *err, *err2;
+ svn_error_t *err;
mergeinfo_context_t *mergeinfo_ctx;
svn_ra_serf__session_t *session = ra_session->priv;
svn_ra_serf__handler_t *handler;
@@ -214,10 +214,10 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
mergeinfo_ctx->include_descendants = include_descendants;
xmlctx = svn_ra_serf__xml_context_create(mergeinfo_ttable,
- NULL, mergeinfo_closed, NULL,
+ NULL, mergeinfo_closed, NULL, NULL,
mergeinfo_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "REPORT";
handler->path = path;
@@ -229,15 +229,10 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
err = svn_ra_serf__context_run_one(handler, pool);
- err2 = svn_ra_serf__error_on_status(handler->sline.code, handler->path,
- handler->location);
- if (err2)
- {
- svn_error_clear(err);
- return err2;
- }
-
- SVN_ERR(err);
+ SVN_ERR(svn_error_compose_create(
+ svn_ra_serf__error_on_status(handler->sline, handler->path,
+ handler->location),
+ err));
if (handler->done && apr_hash_count(mergeinfo_ctx->result_catalog))
*catalog = mergeinfo_ctx->result_catalog;
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/options.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/options.c Tue Oct 15 08:52:06 2013
@@ -27,6 +27,7 @@
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_dirent_uri.h"
#include "svn_hash.h"
#include "svn_pools.h"
@@ -35,7 +36,6 @@
#include "svn_xml.h"
#include "../libsvn_ra/ra_loader.h"
-#include "svn_private_config.h"
#include "private/svn_fspath.h"
#include "ra_serf.h"
@@ -50,7 +50,7 @@
* This enum represents the current state of our XML parsing for an OPTIONS.
*/
enum options_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
OPTIONS,
ACTIVITY_COLLECTION,
HREF
@@ -362,6 +362,8 @@ options_response_handler(serf_request_t
capability_no);
svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS,
capability_no);
+ svn_hash_sets(session->capabilities, SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE,
+ capability_no);
/* Then see which ones we can discover. */
serf_bucket_headers_do(hdrs, capabilities_headers_iterator_callback,
@@ -399,10 +401,10 @@ create_options_req(options_context_t **o
new_ctx->youngest_rev = SVN_INVALID_REVNUM;
xmlctx = svn_ra_serf__xml_context_create(options_ttable,
- NULL, options_closed, NULL,
+ NULL, options_closed, NULL, NULL,
new_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx, NULL, pool);
handler->method = "OPTIONS";
handler->path = session->session_url.path;
@@ -436,11 +438,12 @@ svn_ra_serf__v2_get_youngest_revnum(svn_
SVN_ERR(create_options_req(&opt_ctx, session, conn, scratch_pool));
SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
- SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline,
opt_ctx->handler->path,
opt_ctx->handler->location));
*youngest = opt_ctx->youngest_rev;
+ SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(*youngest));
return SVN_NO_ERROR;
}
@@ -460,7 +463,7 @@ svn_ra_serf__v1_get_activity_collection(
SVN_ERR(create_options_req(&opt_ctx, session, conn, scratch_pool));
SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
- SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline.code,
+ SVN_ERR(svn_ra_serf__error_on_status(opt_ctx->handler->sline,
opt_ctx->handler->path,
opt_ctx->handler->location));
@@ -499,7 +502,7 @@ svn_ra_serf__exchange_capabilities(svn_r
}
SVN_ERR(svn_error_compose_create(
- svn_ra_serf__error_on_status(opt_ctx->handler->sline.code,
+ svn_ra_serf__error_on_status(opt_ctx->handler->sline,
serf_sess->session_url.path,
opt_ctx->handler->location),
err));
@@ -517,6 +520,65 @@ svn_ra_serf__exchange_capabilities(svn_r
}
+static svn_error_t *
+create_simple_options_body(serf_bucket_t **body_bkt,
+ void *baton,
+ serf_bucket_alloc_t *alloc,
+ apr_pool_t *pool)
+{
+ serf_bucket_t *body;
+ serf_bucket_t *s;
+
+ body = serf_bucket_aggregate_create(alloc);
+ svn_ra_serf__add_xml_header_buckets(body, alloc);
+
+ s = SERF_BUCKET_SIMPLE_STRING("<D:options xmlns:D=\"DAV:\" />", alloc);
+ serf_bucket_aggregate_append(body, s);
+
+ *body_bkt = body;
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_ra_serf__probe_proxy(svn_ra_serf__session_t *serf_sess,
+ apr_pool_t *scratch_pool)
+{
+ svn_ra_serf__handler_t *handler;
+
+ handler = apr_pcalloc(scratch_pool, sizeof(*handler));
+ handler->handler_pool = scratch_pool;
+ handler->method = "OPTIONS";
+ handler->path = serf_sess->session_url.path;
+ handler->conn = serf_sess->conns[0];
+ handler->session = serf_sess;
+
+ /* We don't care about the response body, so discard it. */
+ handler->response_handler = svn_ra_serf__handle_discard_body;
+
+ /* We need a simple body, in order to send it in chunked format. */
+ handler->body_delegate = create_simple_options_body;
+
+ /* No special headers. */
+
+ SVN_ERR(svn_ra_serf__context_run_one(handler, scratch_pool));
+ /* Some versions of nginx in reverse proxy mode will return 411. They want
+ a Content-Length header, rather than chunked requests. We can keep other
+ HTTP/1.1 features, but will disable the chunking. */
+ if (handler->sline.code == 411)
+ {
+ serf_sess->using_chunked_requests = FALSE;
+
+ return SVN_NO_ERROR;
+ }
+ SVN_ERR(svn_ra_serf__error_on_status(handler->sline,
+ handler->path,
+ handler->location));
+
+ return SVN_NO_ERROR;
+}
+
+
svn_error_t *
svn_ra_serf__has_capability(svn_ra_session_t *ra_session,
svn_boolean_t *has,
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/property.c?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/property.c Tue Oct 15 08:52:06 2013
@@ -25,6 +25,7 @@
#include <serf.h>
+#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_base64.h"
@@ -35,14 +36,13 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
#include "private/svn_string_private.h"
-#include "svn_private_config.h"
#include "ra_serf.h"
/* Our current parsing state we're in for the PROPFIND response. */
typedef enum prop_state_e {
- INITIAL = 0,
+ INITIAL = XML_STATE_INITIAL,
MULTISTATUS,
RESPONSE,
HREF,
@@ -136,10 +136,14 @@ static const svn_ra_serf__xml_transition
{ 0 }
};
+static const int propfind_expected_status[] = {
+ 207,
+ 0
+};
/* Return the HTTP status code contained in STATUS_LINE, or 0 if
there's a problem parsing it. */
-static int parse_status_code(const char *status_line)
+static apr_int64_t parse_status_code(const char *status_line)
{
/* STATUS_LINE should be of form: "HTTP/1.1 200 OK" */
if (status_line[0] == 'H' &&
@@ -257,7 +261,7 @@ propfind_closed(svn_ra_serf__xml_estate_
that we wish to ignore. (Typically, if it's not a 200, the
status will be 404 to indicate that a property we
specifically requested from the server doesn't exist.) */
- int status = parse_status_code(cdata->data);
+ apr_int64_t status = parse_status_code(cdata->data);
if (status != 200)
svn_ra_serf__xml_note(xes, PROPSTAT, "ignore-prop", "*");
}
@@ -598,10 +602,12 @@ svn_ra_serf__deliver_props(svn_ra_serf__
xmlctx = svn_ra_serf__xml_context_create(propfind_ttable,
propfind_opened,
propfind_closed,
- NULL,
+ NULL, NULL,
new_prop_ctx,
pool);
- handler = svn_ra_serf__create_expat_handler(xmlctx, pool);
+ handler = svn_ra_serf__create_expat_handler(xmlctx,
+ propfind_expected_status,
+ pool);
handler->method = "PROPFIND";
handler->path = path;
@@ -635,7 +641,7 @@ svn_ra_serf__wait_for_props(svn_ra_serf_
err = svn_ra_serf__context_run_one(handler, scratch_pool);
- err2 = svn_ra_serf__error_on_status(handler->sline.code,
+ err2 = svn_ra_serf__error_on_status(handler->sline,
handler->path,
handler->location);
Modified: subversion/branches/cache-server/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/cache-server/subversion/libsvn_ra_serf/ra_serf.h?rev=1532250&r1=1532249&r2=1532250&view=diff
==============================================================================
--- subversion/branches/cache-server/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/cache-server/subversion/libsvn_ra_serf/ra_serf.h Tue Oct 15 08:52:06 2013
@@ -50,20 +50,13 @@ extern "C" {
/* Enforce the minimum version of serf. */
-#if !SERF_VERSION_AT_LEAST(0, 7, 1)
-#error Please update your version of serf to at least 0.7.1.
+#if !SERF_VERSION_AT_LEAST(1, 2, 1)
+#error Please update your version of serf to at least 1.2.1.
#endif
/** 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
@@ -144,6 +137,13 @@ struct svn_ra_serf__session_t {
HTTP/1.0. Thus, we cannot send chunked requests. */
svn_boolean_t http10;
+ /* Should we use Transfer-Encoding: chunked for HTTP/1.1 servers. */
+ svn_boolean_t using_chunked_requests;
+
+ /* Do we need to detect whether the connection supports chunked requests?
+ i.e. is there a (reverse) proxy that does not support them? */
+ svn_boolean_t detect_chunking;
+
/* Our Version-Controlled-Configuration; may be NULL until we know it. */
const char *vcc_url;
@@ -186,7 +186,7 @@ struct svn_ra_serf__session_t {
const char *activity_collection_url;
/* Are we using a proxy? */
- int using_proxy;
+ svn_boolean_t using_proxy;
const char *proxy_username;
const char *proxy_password;
@@ -429,6 +429,10 @@ typedef struct svn_ra_serf__handler_t {
enabled. */
svn_boolean_t custom_accept_encoding;
+ /* If TRUE then default DAV: capabilities request headers is not configured
+ for request. */
+ svn_boolean_t no_dav_headers;
+
/* Has the request/response been completed? */
svn_boolean_t done;
@@ -651,11 +655,6 @@ struct svn_ra_serf__xml_parser_t {
See libsvn_ra_serf/util.c */
struct svn_ra_serf__pending_t *pending;
-
- /* Response restart support */
- const void *headers_baton; /* Last pointer to headers */
- apr_off_t skip_size; /* Number of bytes to skip */
- apr_off_t read_size; /* Number of bytes read from response */
};
@@ -723,6 +722,16 @@ typedef svn_error_t *
apr_size_t len,
apr_pool_t *scratch_pool);
+/* Called when releasing the XML parser to signal that the entire document was
+ read successfully */
+typedef svn_error_t *
+(*svn_ra_serf__xml_done_t)(void *baton,
+ apr_pool_t *scratch_pool);
+
+
+/* Magic state value for the initial state in a svn_ra_serf__xml_transition_t
+ table */
+#define XML_STATE_INITIAL 0
/* State transition table.
@@ -732,6 +741,8 @@ typedef svn_error_t *
In a list of transitions, use { 0 } to indicate the end. Specifically,
the code looks for NS == NULL.
+ The initial state for each transition table is XML_STATE_INITIAL.
+
### more docco
*/
typedef struct svn_ra_serf__xml_transition_t {
@@ -776,7 +787,10 @@ typedef struct svn_ra_serf__xml_transiti
COLLECT_CDATA flag). It will be called in every state, so the callback
must examine the CURRENT_STATE parameter to decide what to do.
- The same BATON value will be passed to all three callbacks.
+ If DONE_CB is not NULL, then it will be called when the parser is closed
+ after successfully parsing an entire document.
+
+ The same BATON value will be passed to all four callbacks.
The context will be created within RESULT_POOL. */
svn_ra_serf__xml_context_t *
@@ -785,21 +799,29 @@ svn_ra_serf__xml_context_create(
svn_ra_serf__xml_opened_t opened_cb,
svn_ra_serf__xml_closed_t closed_cb,
svn_ra_serf__xml_cdata_t cdata_cb,
+ svn_ra_serf__xml_done_t done_cb,
void *baton,
apr_pool_t *result_pool);
-/* Destroy all subpools for this structure. */
-void
-svn_ra_serf__xml_context_destroy(
- svn_ra_serf__xml_context_t *xmlctx);
+/* Verifies if the parsing completed successfully and destroys
+ all subpools. */
+svn_error_t *
+svn_ra_serf__xml_context_done(svn_ra_serf__xml_context_t *xmlctx);
/* Construct a handler with the response function/baton set up to parse
a response body using the given XML context. The handler and its
internal structures are allocated in RESULT_POOL.
+ As part of the handling the http status value is compared to 200, or
+ if EXPECTED_STATUS is not NULL to all the values in EXPECTED_STATUS.
+ EXPECTED_STATUS is expected to be a list of integers ending with a 0
+ that lives at least as long as RESULT_POOL. If the status doesn't
+ match the request has failed and will be parsed as en error response.
+
This also initializes HANDLER_POOL to the given RESULT_POOL. */
svn_ra_serf__handler_t *
svn_ra_serf__create_expat_handler(svn_ra_serf__xml_context_t *xmlctx,
+ const int *expected_status,
apr_pool_t *result_pool);
@@ -1334,6 +1356,14 @@ svn_ra_serf__run_merge(const svn_commit_
/** OPTIONS-related functions **/
+/* When running with a proxy, we may need to detect and correct for problems.
+ This probing function will send a simple OPTIONS request to detect problems
+ with the connection. */
+svn_error_t *
+svn_ra_serf__probe_proxy(svn_ra_serf__session_t *serf_sess,
+ apr_pool_t *scratch_pool);
+
+
/* On HTTPv2 connections, run an OPTIONS request over CONN to fetch the
current youngest revnum, returning it in *YOUNGEST.
@@ -1468,6 +1498,7 @@ svn_ra_serf__get_log(svn_ra_session_t *s
svn_boolean_t discover_changed_paths,
svn_boolean_t strict_node_history,
svn_boolean_t include_merged_revisions,
+ svn_move_behavior_t move_behavior,
const apr_array_header_t *revprops,
svn_log_entry_receiver_t receiver,
void *receiver_baton,
@@ -1744,7 +1775,7 @@ svn_ra_serf__credentials_callback(char *
* where it necessary.
*/
svn_error_t *
-svn_ra_serf__error_on_status(int status_code,
+svn_ra_serf__error_on_status(serf_status_line sline,
const char *path,
const char *location);