You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/10/07 00:39:03 UTC

svn commit: r1707164 - /subversion/trunk/subversion/libsvn_ra_serf/multistatus.c

Author: rhuijben
Date: Tue Oct  6 22:39:03 2015
New Revision: 1707164

URL: http://svn.apache.org/viewvc?rev=1707164&view=rev
Log:
Expose some error messages generated by github (or any buggy server) that
are transferred as invalid xml.

In the case I encountered the xml document ends with a '\0' byte, which makes
it invalid xml... but the client already received a more specific error
message.

This changes the message I got from
[[
svn: E170013: Unable to connect to a repository at URL 'https://github.com/libgit2/libgit2/tags/v0.23.3'
svn: E175009: The XML response contains invalid XML
svn: E130003: Malformed XML: not well-formed (invalid token)
]]

to

[[
svn: E170013: Unable to connect to a repository at URL 'https://github.com/libgit2/libgit2/tags/v0.23.3'
svn: E175009: The XML response contains invalid XML
svn: E130003: Malformed XML: not well-formed (invalid token)
svn: E200042: Additional errors:
svn: E900002: This repository is hosted on a new server that doesn't support SVN yet. Please contact support if you need SVN access for this repository.
]]

* subversion/libsvn_ra_serf/multistatus.c
  (svn_ra_serf__handle_server_error): If we already recorded an error, return
    that with the xml parser errors of possible further errors.

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

Modified: subversion/trunk/subversion/libsvn_ra_serf/multistatus.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/multistatus.c?rev=1707164&r1=1707163&r2=1707164&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/multistatus.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/multistatus.c Tue Oct  6 22:39:03 2015
@@ -707,7 +707,16 @@ svn_ra_serf__handle_server_error(svn_ra_
      clear the error and return - allowing serf to wait for more data.
      */
   if (!err || SERF_BUCKET_READ_ERROR(err->apr_err))
-    return svn_error_trace(err);
+    {
+      /* Perhaps we already parsed some server generated message. Let's pass
+         all information we can get.*/
+      if (err && server_error->items->nelts)
+        err = svn_error_compose_create(
+                err,
+                svn_ra_serf__server_error_create(handler, scratch_pool));
+
+      return svn_error_trace(err);
+    }
 
   if (!APR_STATUS_IS_EOF(err->apr_err))
     {