subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1499033 - /subversion/trunk/subversion/libsvn_ra_serf/util.c
Date Tue, 02 Jul 2013 17:43:52 GMT
Author: rhuijben
Date: Tue Jul  2 17:43:52 2013
New Revision: 1499033

URL: http://svn.apache.org/r1499033
Log:
* subversion/libsvn_ra_serf/util.c
  (expat_response_handler): Don't create an XML parser if we are ignoring
    the entire body, by hooking the empty body handler (which might use
    its own XML parser for errors). Add ### comment explaining the error
    handling.

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/util.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1499033&r1=1499032&r2=1499033&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Tue Jul  2 17:43:52 2013
@@ -2505,27 +2505,35 @@ expat_response_handler(serf_request_t *r
 {
   struct expat_ctx_t *ectx = baton;
 
-  if (!ectx->parser)
-    {
-      ectx->parser = XML_ParserCreate(NULL);
-      apr_pool_cleanup_register(ectx->cleanup_pool, &ectx->parser,
-                                xml_parser_cleanup, apr_pool_cleanup_null);
-      XML_SetUserData(ectx->parser, ectx);
-      XML_SetElementHandler(ectx->parser, expat_start, expat_end);
-      XML_SetCharacterDataHandler(ectx->parser, expat_cdata);
-    }
-
   /* ### TODO: sline.code < 200 should really be handled by the core */
   if ((ectx->handler->sline.code < 200) || (ectx->handler->sline.code >=
300))
     {
       /* By deferring to expect_empty_body(), it will make a choice on
          how to handle the body. Whatever the decision, the core handler
          will take over, and we will not be called again.  */
+
+      /* ### This handles xml bodies as svn-errors (returned via serf context
+         ### loop), but ignores non-xml errors.
+
+         Current code depends on this behavior and checks itself while other
+         continues, and then verifies if work has been performed.
+
+         ### TODO: Make error checking consistent */
       return svn_error_trace(svn_ra_serf__expect_empty_body(
                                request, response, ectx->handler,
                                scratch_pool));
     }
 
+  if (!ectx->parser)
+    {
+      ectx->parser = XML_ParserCreate(NULL);
+      apr_pool_cleanup_register(ectx->cleanup_pool, &ectx->parser,
+                                xml_parser_cleanup, apr_pool_cleanup_null);
+      XML_SetUserData(ectx->parser, ectx);
+      XML_SetElementHandler(ectx->parser, expat_start, expat_end);
+      XML_SetCharacterDataHandler(ectx->parser, expat_cdata);
+    }
+
   while (1)
     {
       apr_status_t status;



Mime
View raw message