Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3F505103DE for ; Tue, 2 Jul 2013 17:44:18 +0000 (UTC) Received: (qmail 90977 invoked by uid 500); 2 Jul 2013 17:44:18 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 90965 invoked by uid 500); 2 Jul 2013 17:44:17 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 90958 invoked by uid 99); 2 Jul 2013 17:44:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jul 2013 17:44:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jul 2013 17:44:13 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D46D62388831; Tue, 2 Jul 2013 17:43:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1499033 - /subversion/trunk/subversion/libsvn_ra_serf/util.c Date: Tue, 02 Jul 2013 17:43:52 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130702174352.D46D62388831@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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;