svn_error_t * svn_ra_neon__copy(svn_ra_neon__session_t *ras, svn_boolean_t overwrite, int depth, const char *src, const char *dst, apr_pool_t *pool) { const char *abs_dst; apr_hash_t *extra_headers = apr_hash_make(pool); abs_dst = apr_psprintf(pool, "%s://%s%s", ne_get_scheme(ras->ne_sess), ne_get_server_hostport(ras->ne_sess), dst); apr_hash_set(extra_headers, "Destination", APR_HASH_KEY_STRING, abs_dst); apr_hash_set(extra_headers, "Overwrite", APR_HASH_KEY_STRING, overwrite ? "T" : "F"); svn_ra_neon__add_depth_header(extra_headers, depth); return svn_ra_neon__simple_request(NULL, ras, "COPY", src, extra_headers, NULL, 201, 204, pool); }
svn_error_t * svn_ra_neon__get_props(apr_hash_t **results, svn_ra_neon__session_t *sess, const char *url, int depth, const char *label, const ne_propname *which_props, apr_pool_t *pool) { propfind_ctx_t pc; svn_stringbuf_t *body; apr_hash_t *extra_headers = apr_hash_make(pool); svn_ra_neon__add_depth_header(extra_headers, depth); /* If we have a label, use it. */ if (label != NULL) apr_hash_set(extra_headers, "Label", 5, label); /* It's easier to roll our own PROPFIND here than use neon's current interfaces. */ /* The start of the request body is fixed: */ body = svn_stringbuf_create ("<?xml version=\"1.0\" encoding=\"utf-8\"?>" DEBUG_CR "<propfind xmlns=\"DAV:\">" DEBUG_CR, pool); /* Are we asking for specific propert(y/ies), or just all of them? */ if (which_props) { int n; apr_pool_t *iterpool = svn_pool_create(pool); svn_stringbuf_appendcstr(body, "<prop>" DEBUG_CR); for (n = 0; which_props[n].name != NULL; n++) { svn_pool_clear(iterpool); svn_stringbuf_appendcstr (body, apr_pstrcat(iterpool, "<", which_props[n].name, " xmlns=\"", which_props[n].nspace, "\"/>" DEBUG_CR, NULL)); } svn_stringbuf_appendcstr(body, "</prop></propfind>" DEBUG_CR); svn_pool_destroy(iterpool); } else { svn_stringbuf_appendcstr(body, "<allprop/></propfind>" DEBUG_CR); } /* Initialize our baton. */ memset(&pc, 0, sizeof(pc)); pc.pool = pool; pc.propbuffer = apr_hash_make(pool); pc.props = apr_hash_make(pool); pc.cdata = svn_stringbuf_create("", pool); /* Create and dispatch the request! */ SVN_ERR(svn_ra_neon__parsed_request(sess, "PROPFIND", url, body->data, 0, set_parser, start_element, svn_ra_neon__xml_collect_cdata, end_element, &pc, extra_headers, NULL, FALSE, pool)); *results = pc.props; return SVN_NO_ERROR; }