You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/04/22 15:25:26 UTC
svn commit: r936835 - in /subversion/trunk/subversion/libsvn_ra_neon: lock.c
options.c ra_neon.h util.c
Author: philip
Date: Thu Apr 22 13:25:26 2010
New Revision: 936835
URL: http://svn.apache.org/viewvc?rev=936835&view=rev
Log:
Check for XML parse errors in more places.
* subversion/libsvn_ra_neon/ra_neon.h
(svn_ra_neon__check_parse_error): New
* subversion/libsvn_ra_neon/util.c
(svn_ra_neon__check_parse_error): Renamed from check_parse_error.
(check_parse_error): Renamed.
(wrapper_reader_cb, parsed_request): Adjust callers.
(svn_ra_neon__request_dispatch): Add check for parse error.
* subversion/libsvn_ra_neon/lock.c
(do_lock, svn_ra_neon_get_lock_internal): Add check for parse error.
* subversion/libsvn_ra_neon/options.c
(svn_ra_neon__exchange_capabilities): Use svn_ra_neon__check_parse_error
instead of inline code.
Modified:
subversion/trunk/subversion/libsvn_ra_neon/lock.c
subversion/trunk/subversion/libsvn_ra_neon/options.c
subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
subversion/trunk/subversion/libsvn_ra_neon/util.c
Modified: subversion/trunk/subversion/libsvn_ra_neon/lock.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/lock.c?rev=936835&r1=936834&r2=936835&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/lock.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/lock.c Thu Apr 22 13:25:26 2010
@@ -300,6 +300,10 @@ do_lock(svn_lock_t **lock,
if (err)
goto cleanup;
+ err = svn_ra_neon__check_parse_error("LOCK", lck_parser, url);
+ if (err)
+ goto cleanup;
+
/*###FIXME: we never verified whether we have received back the type
of lock we requested: was it shared/exclusive? was it write/otherwise?
How many did we get back? Only one? */
@@ -548,6 +552,10 @@ svn_ra_neon__get_lock_internal(svn_ra_ne
goto cleanup;
}
+ err = svn_ra_neon__check_parse_error("PROPFIND", lck_parser, url);
+ if (err)
+ goto cleanup;
+
/*###FIXME We assume here we only got one lock response. The WebDAV
spec makes no such guarantees. How to make sure we grab the one we need? */
err = lock_from_baton(lock, req, fs_path.data, lrb, pool);
Modified: subversion/trunk/subversion/libsvn_ra_neon/options.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/options.c?rev=936835&r1=936834&r2=936835&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/options.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/options.c Thu Apr 22 13:25:26 2010
@@ -285,15 +285,9 @@ svn_ra_neon__exchange_capabilities(svn_r
goto cleanup;
/* Was there an XML parse error somewhere? */
- msg = ne_xml_get_error(parser);
- if (msg && *msg)
- {
- err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
- _("The %s request returned invalid XML "
- "in the response: %s (%s)"),
- "OPTIONS", msg, ras->url->data);
- goto cleanup;
- }
+ err = svn_ra_neon__check_parse_error("OPTIONS", parser, ras->url->data);
+ if (err)
+ goto cleanup;
/* We asked for, and therefore expect, to have found an activity
collection in the response. */
Modified: subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h?rev=936835&r1=936834&r2=936835&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/ra_neon.h Thu Apr 22 13:25:26 2010
@@ -722,6 +722,14 @@ svn_ra_neon__parsed_request(svn_ra_neon_
apr_pool_t *pool);
+/* If XML_PARSER found an XML parse error, then return a Subversion error
+ * saying that the error was found in the response to the DAV request METHOD
+ * for the URL URL. Otherwise, return SVN_NO_ERROR. */
+svn_error_t *
+svn_ra_neon__check_parse_error(const char *method,
+ ne_xml_parser *xml_parser,
+ const char *url);
+
/* ### add SVN_RA_NEON_ to these to prefix conflicts with (sys) headers? */
enum {
/* Redefine Neon elements */
Modified: subversion/trunk/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/util.c?rev=936835&r1=936834&r2=936835&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/util.c Thu Apr 22 13:25:26 2010
@@ -1084,13 +1084,10 @@ wrapper_endelm_cb(void *baton,
return 0;
}
-/* If XML_PARSER found an XML parse error, then return a Subversion error
- * saying that the error was found in the response to the DAV request METHOD
- * for the URL URL. Otherwise, return SVN_NO_ERROR. */
-static svn_error_t *
-check_parse_error(const char *method,
- ne_xml_parser *xml_parser,
- const char *url)
+svn_error_t *
+svn_ra_neon__check_parse_error(const char *method,
+ ne_xml_parser *xml_parser,
+ const char *url)
{
const char *msg = ne_xml_get_error(xml_parser);
if (msg != NULL && *msg != '\0')
@@ -1124,8 +1121,9 @@ wrapper_reader_cb(void *baton, const cha
{
/* Pass XML parser error. */
SVN_RA_NEON__REQ_ERR(pwb->req,
- check_parse_error(pwb->req->method, pwb->parser,
- pwb->req->url));
+ svn_ra_neon__check_parse_error(pwb->req->method,
+ pwb->parser,
+ pwb->req->url));
}
return parser_status;
@@ -1287,7 +1285,7 @@ parsed_request(svn_ra_neon__request_t *r
}
}
- SVN_ERR(check_parse_error(method, success_parser, url));
+ SVN_ERR(svn_ra_neon__check_parse_error(method, success_parser, url));
return SVN_NO_ERROR;
}
@@ -1499,6 +1497,8 @@ svn_ra_neon__request_dispatch(int *code_
/* Any other errors? Report them */
SVN_ERR(req->err);
+ SVN_ERR(svn_ra_neon__check_parse_error(req->method, error_parser, req->url));
+
/* We either have a neon error, or some other error
that we didn't expect. */
return generate_error(req, pool);